feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
124
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/KeyInfo.java
Normal file
124
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/KeyInfo.java
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* $Id: KeyInfo.java,v 1.7 2005/05/10 16:35:34 mullan Exp $
|
||||
*/
|
||||
package javax.xml.crypto.dsig.keyinfo;
|
||||
|
||||
import java.util.List;
|
||||
import javax.xml.crypto.MarshalException;
|
||||
import javax.xml.crypto.XMLCryptoContext;
|
||||
import javax.xml.crypto.XMLStructure;
|
||||
|
||||
/**
|
||||
* A representation of the XML <code>KeyInfo</code> element as defined in
|
||||
* the <a href="http://www.w3.org/TR/xmldsig-core/">
|
||||
* W3C Recommendation for XML-Signature Syntax and Processing</a>.
|
||||
* A <code>KeyInfo</code> contains a list of {@link XMLStructure}s, each of
|
||||
* which contain information that enables the recipient(s) to obtain the key
|
||||
* needed to validate an XML signature. The XML Schema Definition is defined as:
|
||||
*
|
||||
* <pre>
|
||||
* <element name="KeyInfo" type="ds:KeyInfoType"/>
|
||||
* <complexType name="KeyInfoType" mixed="true">
|
||||
* <choice maxOccurs="unbounded">
|
||||
* <element ref="ds:KeyName"/>
|
||||
* <element ref="ds:KeyValue"/>
|
||||
* <element ref="ds:RetrievalMethod"/>
|
||||
* <element ref="ds:X509Data"/>
|
||||
* <element ref="ds:PGPData"/>
|
||||
* <element ref="ds:SPKIData"/>
|
||||
* <element ref="ds:MgmtData"/>
|
||||
* <any processContents="lax" namespace="##other"/>
|
||||
* <!-- (1,1) elements from (0,unbounded) namespaces -->
|
||||
* </choice>
|
||||
* <attribute name="Id" type="ID" use="optional"/>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
* A <code>KeyInfo</code> instance may be created by invoking one of the
|
||||
* {@link KeyInfoFactory#newKeyInfo newKeyInfo} methods of the
|
||||
* {@link KeyInfoFactory} class, and passing it a list of one or more
|
||||
* <code>XMLStructure</code>s and an optional id parameter;
|
||||
* for example:
|
||||
* <pre>
|
||||
* KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
|
||||
* KeyInfo keyInfo = factory.newKeyInfo
|
||||
* (Collections.singletonList(factory.newKeyName("Alice"), "keyinfo-1"));
|
||||
* </pre>
|
||||
*
|
||||
* <p><code>KeyInfo</code> objects can also be marshalled to XML by invoking
|
||||
* the {@link #marshal marshal} method.
|
||||
*
|
||||
* @author Sean Mullan
|
||||
* @author JSR 105 Expert Group
|
||||
* @since 1.6
|
||||
* @see KeyInfoFactory#newKeyInfo(List)
|
||||
* @see KeyInfoFactory#newKeyInfo(List, String)
|
||||
*/
|
||||
public interface KeyInfo extends XMLStructure {
|
||||
|
||||
/**
|
||||
* Returns an {@link java.util.Collections#unmodifiableList unmodifiable
|
||||
* list} containing the key information. Each entry of the list is
|
||||
* an {@link XMLStructure}.
|
||||
*
|
||||
* <p>If there is a public subclass representing the type of
|
||||
* <code>XMLStructure</code>, it is returned as an instance of that
|
||||
* class (ex: an <code>X509Data</code> element would be returned as an
|
||||
* instance of {@link javax.xml.crypto.dsig.keyinfo.X509Data}).
|
||||
*
|
||||
* @return an unmodifiable list of one or more <code>XMLStructure</code>s
|
||||
* in this <code>KeyInfo</code>. Never returns <code>null</code> or an
|
||||
* empty list.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
List getContent();
|
||||
|
||||
/**
|
||||
* Return the optional Id attribute of this <code>KeyInfo</code>, which
|
||||
* may be useful for referencing this <code>KeyInfo</code> from other
|
||||
* XML structures.
|
||||
*
|
||||
* @return the Id attribute of this <code>KeyInfo</code> (may be
|
||||
* <code>null</code> if not specified)
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* Marshals the key info to XML.
|
||||
*
|
||||
* @param parent a mechanism-specific structure containing the parent node
|
||||
* that the marshalled key info will be appended to
|
||||
* @param context the <code>XMLCryptoContext</code> containing additional
|
||||
* context (may be null if not applicable)
|
||||
* @throws ClassCastException if the type of <code>parent</code> or
|
||||
* <code>context</code> is not compatible with this key info
|
||||
* @throws MarshalException if the key info cannot be marshalled
|
||||
* @throws NullPointerException if <code>parent</code> is <code>null</code>
|
||||
*/
|
||||
void marshal(XMLStructure parent, XMLCryptoContext context)
|
||||
throws MarshalException;
|
||||
}
|
||||
528
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
Normal file
528
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
Normal file
@@ -0,0 +1,528 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* $Id: KeyInfoFactory.java,v 1.12 2005/05/10 16:35:35 mullan Exp $
|
||||
*/
|
||||
package javax.xml.crypto.dsig.keyinfo;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.KeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.NoSuchProviderException;
|
||||
import java.security.Provider;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Security;
|
||||
import java.security.cert.X509CRL;
|
||||
import java.util.List;
|
||||
import javax.xml.crypto.MarshalException;
|
||||
import javax.xml.crypto.NoSuchMechanismException;
|
||||
import javax.xml.crypto.URIDereferencer;
|
||||
import javax.xml.crypto.XMLStructure;
|
||||
import javax.xml.crypto.dom.DOMStructure;
|
||||
import javax.xml.crypto.dsig.*;
|
||||
|
||||
import sun.security.jca.*;
|
||||
import sun.security.jca.GetInstance.Instance;
|
||||
|
||||
/**
|
||||
* A factory for creating {@link KeyInfo} objects from scratch or for
|
||||
* unmarshalling a <code>KeyInfo</code> object from a corresponding XML
|
||||
* representation.
|
||||
*
|
||||
* <p>Each instance of <code>KeyInfoFactory</code> supports a specific
|
||||
* XML mechanism type. To create a <code>KeyInfoFactory</code>, call one of the
|
||||
* static {@link #getInstance getInstance} methods, passing in the XML
|
||||
* mechanism type desired, for example:
|
||||
*
|
||||
* <blockquote><code>
|
||||
* KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
|
||||
* </code></blockquote>
|
||||
*
|
||||
* <p>The objects that this factory produces will be based
|
||||
* on DOM and abide by the DOM interoperability requirements as defined in the
|
||||
* <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#DOM Mechanism Requirements">
|
||||
* DOM Mechanism Requirements</a> section of the API overview. See the
|
||||
* <a href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
|
||||
* Service Providers</a> section of the API overview for a list of standard
|
||||
* mechanism types.
|
||||
*
|
||||
* <p><code>KeyInfoFactory</code> implementations are registered and loaded
|
||||
* using the {@link java.security.Provider} mechanism.
|
||||
* For example, a service provider that supports the
|
||||
* DOM mechanism would be specified in the <code>Provider</code> subclass as:
|
||||
* <pre>
|
||||
* put("KeyInfoFactory.DOM", "org.example.DOMKeyInfoFactory");
|
||||
* </pre>
|
||||
*
|
||||
* <p>Also, the <code>XMLStructure</code>s that are created by this factory
|
||||
* may contain state specific to the <code>KeyInfo</code> and are not
|
||||
* intended to be reusable.
|
||||
*
|
||||
* <p>An implementation MUST minimally support the default mechanism type: DOM.
|
||||
*
|
||||
* <p>Note that a caller must use the same <code>KeyInfoFactory</code>
|
||||
* instance to create the <code>XMLStructure</code>s of a particular
|
||||
* <code>KeyInfo</code> object. The behavior is undefined if
|
||||
* <code>XMLStructure</code>s from different providers or different mechanism
|
||||
* types are used together.
|
||||
*
|
||||
* <p><b>Concurrent Access</b>
|
||||
* <p>The static methods of this class are guaranteed to be thread-safe.
|
||||
* Multiple threads may concurrently invoke the static methods defined in this
|
||||
* class with no ill effects.
|
||||
*
|
||||
* <p>However, this is not true for the non-static methods defined by this
|
||||
* class. Unless otherwise documented by a specific provider, threads that
|
||||
* need to access a single <code>KeyInfoFactory</code> instance concurrently
|
||||
* should synchronize amongst themselves and provide the necessary locking.
|
||||
* Multiple threads each manipulating a different <code>KeyInfoFactory</code>
|
||||
* instance need not synchronize.
|
||||
*
|
||||
* @author Sean Mullan
|
||||
* @author JSR 105 Expert Group
|
||||
* @since 1.6
|
||||
*/
|
||||
public abstract class KeyInfoFactory {
|
||||
|
||||
private String mechanismType;
|
||||
private Provider provider;
|
||||
|
||||
/**
|
||||
* Default constructor, for invocation by subclasses.
|
||||
*/
|
||||
protected KeyInfoFactory() {}
|
||||
|
||||
/**
|
||||
* Returns a <code>KeyInfoFactory</code> that supports the
|
||||
* specified XML processing mechanism and representation type (ex: "DOM").
|
||||
*
|
||||
* <p>This method uses the standard JCA provider lookup mechanism to
|
||||
* locate and instantiate a <code>KeyInfoFactory</code> implementation of
|
||||
* the desired mechanism type. It traverses the list of registered security
|
||||
* <code>Provider</code>s, starting with the most preferred
|
||||
* <code>Provider</code>. A new <code>KeyInfoFactory</code> object
|
||||
* from the first <code>Provider</code> that supports the specified
|
||||
* mechanism is returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
*
|
||||
* @param mechanismType the type of the XML processing mechanism and
|
||||
* representation. See the <a
|
||||
* href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
|
||||
* Service Providers</a> section of the API overview for a list of
|
||||
* standard mechanism types.
|
||||
* @return a new <code>KeyInfoFactory</code>
|
||||
* @throws NullPointerException if <code>mechanismType</code> is
|
||||
* <code>null</code>
|
||||
* @throws NoSuchMechanismException if no <code>Provider</code> supports a
|
||||
* <code>KeyInfoFactory</code> implementation for the specified mechanism
|
||||
* @see Provider
|
||||
*/
|
||||
public static KeyInfoFactory getInstance(String mechanismType) {
|
||||
if (mechanismType == null) {
|
||||
throw new NullPointerException("mechanismType cannot be null");
|
||||
}
|
||||
Instance instance;
|
||||
try {
|
||||
instance = GetInstance.getInstance
|
||||
("KeyInfoFactory", null, mechanismType);
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
throw new NoSuchMechanismException(nsae);
|
||||
}
|
||||
KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
|
||||
factory.mechanismType = mechanismType;
|
||||
factory.provider = instance.provider;
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a <code>KeyInfoFactory</code> that supports the
|
||||
* requested XML processing mechanism and representation type (ex: "DOM"),
|
||||
* as supplied by the specified provider. Note that the specified
|
||||
* <code>Provider</code> object does not have to be registered in the
|
||||
* provider list.
|
||||
*
|
||||
* @param mechanismType the type of the XML processing mechanism and
|
||||
* representation. See the <a
|
||||
* href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
|
||||
* Service Providers</a> section of the API overview for a list of
|
||||
* standard mechanism types.
|
||||
* @param provider the <code>Provider</code> object
|
||||
* @return a new <code>KeyInfoFactory</code>
|
||||
* @throws NullPointerException if <code>mechanismType</code> or
|
||||
* <code>provider</code> are <code>null</code>
|
||||
* @throws NoSuchMechanismException if a <code>KeyInfoFactory</code>
|
||||
* implementation for the specified mechanism is not available from the
|
||||
* specified <code>Provider</code> object
|
||||
* @see Provider
|
||||
*/
|
||||
public static KeyInfoFactory getInstance(String mechanismType,
|
||||
Provider provider) {
|
||||
if (mechanismType == null) {
|
||||
throw new NullPointerException("mechanismType cannot be null");
|
||||
} else if (provider == null) {
|
||||
throw new NullPointerException("provider cannot be null");
|
||||
}
|
||||
|
||||
Instance instance;
|
||||
try {
|
||||
instance = GetInstance.getInstance
|
||||
("KeyInfoFactory", null, mechanismType, provider);
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
throw new NoSuchMechanismException(nsae);
|
||||
}
|
||||
KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
|
||||
factory.mechanismType = mechanismType;
|
||||
factory.provider = instance.provider;
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a <code>KeyInfoFactory</code> that supports the
|
||||
* requested XML processing mechanism and representation type (ex: "DOM"),
|
||||
* as supplied by the specified provider. The specified provider must be
|
||||
* registered in the security provider list.
|
||||
*
|
||||
* <p>Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
*
|
||||
* @param mechanismType the type of the XML processing mechanism and
|
||||
* representation. See the <a
|
||||
* href="../../../../../../technotes/guides/security/xmldsig/overview.html#Service Provider">
|
||||
* Service Providers</a> section of the API overview for a list of
|
||||
* standard mechanism types.
|
||||
* @param provider the string name of the provider
|
||||
* @return a new <code>KeyInfoFactory</code>
|
||||
* @throws NoSuchProviderException if the specified provider is not
|
||||
* registered in the security provider list
|
||||
* @throws NullPointerException if <code>mechanismType</code> or
|
||||
* <code>provider</code> are <code>null</code>
|
||||
* @throws NoSuchMechanismException if a <code>KeyInfoFactory</code>
|
||||
* implementation for the specified mechanism is not available from the
|
||||
* specified provider
|
||||
* @see Provider
|
||||
*/
|
||||
public static KeyInfoFactory getInstance(String mechanismType,
|
||||
String provider) throws NoSuchProviderException {
|
||||
if (mechanismType == null) {
|
||||
throw new NullPointerException("mechanismType cannot be null");
|
||||
} else if (provider == null) {
|
||||
throw new NullPointerException("provider cannot be null");
|
||||
} else if (provider.length() == 0) {
|
||||
throw new NoSuchProviderException();
|
||||
}
|
||||
|
||||
Instance instance;
|
||||
try {
|
||||
instance = GetInstance.getInstance
|
||||
("KeyInfoFactory", null, mechanismType, provider);
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
throw new NoSuchMechanismException(nsae);
|
||||
}
|
||||
KeyInfoFactory factory = (KeyInfoFactory) instance.impl;
|
||||
factory.mechanismType = mechanismType;
|
||||
factory.provider = instance.provider;
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a <code>KeyInfoFactory</code> that supports the
|
||||
* default XML processing mechanism and representation type ("DOM").
|
||||
*
|
||||
* <p>This method uses the standard JCA provider lookup mechanism to
|
||||
* locate and instantiate a <code>KeyInfoFactory</code> implementation of
|
||||
* the default mechanism type. It traverses the list of registered security
|
||||
* <code>Provider</code>s, starting with the most preferred
|
||||
* <code>Provider</code>. A new <code>KeyInfoFactory</code> object
|
||||
* from the first <code>Provider</code> that supports the DOM mechanism is
|
||||
* returned.
|
||||
*
|
||||
* <p> Note that the list of registered providers may be retrieved via
|
||||
* the {@link Security#getProviders() Security.getProviders()} method.
|
||||
*
|
||||
* @return a new <code>KeyInfoFactory</code>
|
||||
* @throws NoSuchMechanismException if no <code>Provider</code> supports a
|
||||
* <code>KeyInfoFactory</code> implementation for the DOM mechanism
|
||||
* @see Provider
|
||||
*/
|
||||
public static KeyInfoFactory getInstance() {
|
||||
return getInstance("DOM");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the XML processing mechanism and representation
|
||||
* supported by this <code>KeyInfoFactory</code> (ex: "DOM")
|
||||
*
|
||||
* @return the XML processing mechanism type supported by this
|
||||
* <code>KeyInfoFactory</code>
|
||||
*/
|
||||
public final String getMechanismType() {
|
||||
return mechanismType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the provider of this <code>KeyInfoFactory</code>.
|
||||
*
|
||||
* @return the provider of this <code>KeyInfoFactory</code>
|
||||
*/
|
||||
public final Provider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <code>KeyInfo</code> containing the specified list of
|
||||
* key information types.
|
||||
*
|
||||
* @param content a list of one or more {@link XMLStructure}s representing
|
||||
* key information types. The list is defensively copied to protect
|
||||
* against subsequent modification.
|
||||
* @return a <code>KeyInfo</code>
|
||||
* @throws NullPointerException if <code>content</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>content</code> is empty
|
||||
* @throws ClassCastException if <code>content</code> contains any entries
|
||||
* that are not of type {@link XMLStructure}
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract KeyInfo newKeyInfo(List content);
|
||||
|
||||
/**
|
||||
* Creates a <code>KeyInfo</code> containing the specified list of key
|
||||
* information types and optional id. The
|
||||
* <code>id</code> parameter represents the value of an XML
|
||||
* <code>ID</code> attribute and is useful for referencing
|
||||
* the <code>KeyInfo</code> from other XML structures.
|
||||
*
|
||||
* @param content a list of one or more {@link XMLStructure}s representing
|
||||
* key information types. The list is defensively copied to protect
|
||||
* against subsequent modification.
|
||||
* @param id the value of an XML <code>ID</code> (may be <code>null</code>)
|
||||
* @return a <code>KeyInfo</code>
|
||||
* @throws NullPointerException if <code>content</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>content</code> is empty
|
||||
* @throws ClassCastException if <code>content</code> contains any entries
|
||||
* that are not of type {@link XMLStructure}
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract KeyInfo newKeyInfo(List content, String id);
|
||||
|
||||
/**
|
||||
* Creates a <code>KeyName</code> from the specified name.
|
||||
*
|
||||
* @param name the name that identifies the key
|
||||
* @return a <code>KeyName</code>
|
||||
* @throws NullPointerException if <code>name</code> is <code>null</code>
|
||||
*/
|
||||
public abstract KeyName newKeyName(String name);
|
||||
|
||||
/**
|
||||
* Creates a <code>KeyValue</code> from the specified public key.
|
||||
*
|
||||
* @param key the public key
|
||||
* @return a <code>KeyValue</code>
|
||||
* @throws KeyException if the <code>key</code>'s algorithm is not
|
||||
* recognized or supported by this <code>KeyInfoFactory</code>
|
||||
* @throws NullPointerException if <code>key</code> is <code>null</code>
|
||||
*/
|
||||
public abstract KeyValue newKeyValue(PublicKey key) throws KeyException;
|
||||
|
||||
/**
|
||||
* Creates a <code>PGPData</code> from the specified PGP public key
|
||||
* identifier.
|
||||
*
|
||||
* @param keyId a PGP public key identifier as defined in <a href=
|
||||
* "http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>, section 11.2.
|
||||
* The array is cloned to protect against subsequent modification.
|
||||
* @return a <code>PGPData</code>
|
||||
* @throws NullPointerException if <code>keyId</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if the key id is not in the correct
|
||||
* format
|
||||
*/
|
||||
public abstract PGPData newPGPData(byte[] keyId);
|
||||
|
||||
/**
|
||||
* Creates a <code>PGPData</code> from the specified PGP public key
|
||||
* identifier, and optional key material packet and list of external
|
||||
* elements.
|
||||
*
|
||||
* @param keyId a PGP public key identifier as defined in <a href=
|
||||
* "http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>, section 11.2.
|
||||
* The array is cloned to protect against subsequent modification.
|
||||
* @param keyPacket a PGP key material packet as defined in <a href=
|
||||
* "http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>, section 5.5.
|
||||
* The array is cloned to protect against subsequent modification. May
|
||||
* be <code>null</code>.
|
||||
* @param other a list of {@link XMLStructure}s representing elements from
|
||||
* an external namespace. The list is defensively copied to protect
|
||||
* against subsequent modification. May be <code>null</code> or empty.
|
||||
* @return a <code>PGPData</code>
|
||||
* @throws NullPointerException if <code>keyId</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if the <code>keyId</code> or
|
||||
* <code>keyPacket</code> is not in the correct format. For
|
||||
* <code>keyPacket</code>, the format of the packet header is
|
||||
* checked and the tag is verified that it is of type key material. The
|
||||
* contents and format of the packet body are not checked.
|
||||
* @throws ClassCastException if <code>other</code> contains any
|
||||
* entries that are not of type {@link XMLStructure}
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket,
|
||||
List other);
|
||||
|
||||
/**
|
||||
* Creates a <code>PGPData</code> from the specified PGP key material
|
||||
* packet and optional list of external elements.
|
||||
*
|
||||
* @param keyPacket a PGP key material packet as defined in <a href=
|
||||
* "http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>, section 5.5.
|
||||
* The array is cloned to protect against subsequent modification.
|
||||
* @param other a list of {@link XMLStructure}s representing elements from
|
||||
* an external namespace. The list is defensively copied to protect
|
||||
* against subsequent modification. May be <code>null</code> or empty.
|
||||
* @return a <code>PGPData</code>
|
||||
* @throws NullPointerException if <code>keyPacket</code> is
|
||||
* <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>keyPacket</code> is not in the
|
||||
* correct format. For <code>keyPacket</code>, the format of the packet
|
||||
* header is checked and the tag is verified that it is of type key
|
||||
* material. The contents and format of the packet body are not checked.
|
||||
* @throws ClassCastException if <code>other</code> contains any
|
||||
* entries that are not of type {@link XMLStructure}
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract PGPData newPGPData(byte[] keyPacket, List other);
|
||||
|
||||
/**
|
||||
* Creates a <code>RetrievalMethod</code> from the specified URI.
|
||||
*
|
||||
* @param uri the URI that identifies the <code>KeyInfo</code> information
|
||||
* to be retrieved
|
||||
* @return a <code>RetrievalMethod</code>
|
||||
* @throws NullPointerException if <code>uri</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
|
||||
* compliant
|
||||
*/
|
||||
public abstract RetrievalMethod newRetrievalMethod(String uri);
|
||||
|
||||
/**
|
||||
* Creates a <code>RetrievalMethod</code> from the specified parameters.
|
||||
*
|
||||
* @param uri the URI that identifies the <code>KeyInfo</code> information
|
||||
* to be retrieved
|
||||
* @param type a URI that identifies the type of <code>KeyInfo</code>
|
||||
* information to be retrieved (may be <code>null</code>)
|
||||
* @param transforms a list of {@link Transform}s. The list is defensively
|
||||
* copied to protect against subsequent modification. May be
|
||||
* <code>null</code> or empty.
|
||||
* @return a <code>RetrievalMethod</code>
|
||||
* @throws NullPointerException if <code>uri</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>uri</code> is not RFC 2396
|
||||
* compliant
|
||||
* @throws ClassCastException if <code>transforms</code> contains any
|
||||
* entries that are not of type {@link Transform}
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract RetrievalMethod newRetrievalMethod(String uri, String type,
|
||||
List transforms);
|
||||
|
||||
/**
|
||||
* Creates a <code>X509Data</code> containing the specified list of
|
||||
* X.509 content.
|
||||
*
|
||||
* @param content a list of one or more X.509 content types. Valid types are
|
||||
* {@link String} (subject names), <code>byte[]</code> (subject key ids),
|
||||
* {@link java.security.cert.X509Certificate}, {@link X509CRL},
|
||||
* or {@link XMLStructure} ({@link X509IssuerSerial}
|
||||
* objects or elements from an external namespace). Subject names are
|
||||
* distinguished names in RFC 2253 String format. Implementations MUST
|
||||
* support the attribute type keywords defined in RFC 2253 (CN, L, ST,
|
||||
* O, OU, C, STREET, DC and UID). Implementations MAY support additional
|
||||
* keywords. The list is defensively copied to protect against
|
||||
* subsequent modification.
|
||||
* @return a <code>X509Data</code>
|
||||
* @throws NullPointerException if <code>content</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>content</code> is empty, or
|
||||
* if a subject name is not RFC 2253 compliant or one of the attribute
|
||||
* type keywords is not recognized.
|
||||
* @throws ClassCastException if <code>content</code> contains any entries
|
||||
* that are not of one of the valid types mentioned above
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract X509Data newX509Data(List content);
|
||||
|
||||
/**
|
||||
* Creates an <code>X509IssuerSerial</code> from the specified X.500 issuer
|
||||
* distinguished name and serial number.
|
||||
*
|
||||
* @param issuerName the issuer's distinguished name in RFC 2253 String
|
||||
* format. Implementations MUST support the attribute type keywords
|
||||
* defined in RFC 2253 (CN, L, ST, O, OU, C, STREET, DC and UID).
|
||||
* Implementations MAY support additional keywords.
|
||||
* @param serialNumber the serial number
|
||||
* @return an <code>X509IssuerSerial</code>
|
||||
* @throws NullPointerException if <code>issuerName</code> or
|
||||
* <code>serialNumber</code> are <code>null</code>
|
||||
* @throws IllegalArgumentException if the issuer name is not RFC 2253
|
||||
* compliant or one of the attribute type keywords is not recognized.
|
||||
*/
|
||||
public abstract X509IssuerSerial newX509IssuerSerial
|
||||
(String issuerName, BigInteger serialNumber);
|
||||
|
||||
/**
|
||||
* Indicates whether a specified feature is supported.
|
||||
*
|
||||
* @param feature the feature name (as an absolute URI)
|
||||
* @return <code>true</code> if the specified feature is supported,
|
||||
* <code>false</code> otherwise
|
||||
* @throws NullPointerException if <code>feature</code> is <code>null</code>
|
||||
*/
|
||||
public abstract boolean isFeatureSupported(String feature);
|
||||
|
||||
/**
|
||||
* Returns a reference to the <code>URIDereferencer</code> that is used by
|
||||
* default to dereference URIs in {@link RetrievalMethod} objects.
|
||||
*
|
||||
* @return a reference to the default <code>URIDereferencer</code>
|
||||
*/
|
||||
public abstract URIDereferencer getURIDereferencer();
|
||||
|
||||
/**
|
||||
* Unmarshals a new <code>KeyInfo</code> instance from a
|
||||
* mechanism-specific <code>XMLStructure</code> (ex: {@link DOMStructure})
|
||||
* instance.
|
||||
*
|
||||
* @param xmlStructure a mechanism-specific XML structure from which to
|
||||
* unmarshal the keyinfo from
|
||||
* @return the <code>KeyInfo</code>
|
||||
* @throws NullPointerException if <code>xmlStructure</code> is
|
||||
* <code>null</code>
|
||||
* @throws ClassCastException if the type of <code>xmlStructure</code> is
|
||||
* inappropriate for this factory
|
||||
* @throws MarshalException if an unrecoverable exception occurs during
|
||||
* unmarshalling
|
||||
*/
|
||||
public abstract KeyInfo unmarshalKeyInfo(XMLStructure xmlStructure)
|
||||
throws MarshalException;
|
||||
}
|
||||
67
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/KeyName.java
Normal file
67
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/KeyName.java
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* $Id: KeyName.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
|
||||
*/
|
||||
package javax.xml.crypto.dsig.keyinfo;
|
||||
|
||||
import javax.xml.crypto.XMLStructure;
|
||||
|
||||
/**
|
||||
* A representation of the XML <code>KeyName</code> element as
|
||||
* defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
|
||||
* W3C Recommendation for XML-Signature Syntax and Processing</a>.
|
||||
* A <code>KeyName</code> object contains a string value which may be used
|
||||
* by the signer to communicate a key identifier to the recipient. The
|
||||
* XML Schema Definition is defined as:
|
||||
*
|
||||
* <pre>
|
||||
* <element name="KeyName" type="string"/>
|
||||
* </pre>
|
||||
*
|
||||
* A <code>KeyName</code> instance may be created by invoking the
|
||||
* {@link KeyInfoFactory#newKeyName newKeyName} method of the
|
||||
* {@link KeyInfoFactory} class, and passing it a <code>String</code>
|
||||
* representing the name of the key; for example:
|
||||
* <pre>
|
||||
* KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
|
||||
* KeyName keyName = factory.newKeyName("Alice");
|
||||
* </pre>
|
||||
*
|
||||
* @author Sean Mullan
|
||||
* @author JSR 105 Expert Group
|
||||
* @since 1.6
|
||||
* @see KeyInfoFactory#newKeyName(String)
|
||||
*/
|
||||
public interface KeyName extends XMLStructure {
|
||||
|
||||
/**
|
||||
* Returns the name of this <code>KeyName</code>.
|
||||
*
|
||||
* @return the name of this <code>KeyName</code> (never
|
||||
* <code>null</code>)
|
||||
*/
|
||||
String getName();
|
||||
}
|
||||
134
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/KeyValue.java
Normal file
134
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/KeyValue.java
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* $Id: KeyValue.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
|
||||
*/
|
||||
package javax.xml.crypto.dsig.keyinfo;
|
||||
|
||||
import java.security.KeyException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.PublicKey;
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import javax.xml.crypto.XMLStructure;
|
||||
|
||||
/**
|
||||
* A representation of the XML <code>KeyValue</code> element as defined
|
||||
* in the <a href="http://www.w3.org/TR/xmldsig-core/">
|
||||
* W3C Recommendation for XML-Signature Syntax and Processing</a>. A
|
||||
* <code>KeyValue</code> object contains a single public key that may be
|
||||
* useful in validating the signature. The XML schema definition is defined as:
|
||||
*
|
||||
* <pre>
|
||||
* <element name="KeyValue" type="ds:KeyValueType"/>
|
||||
* <complexType name="KeyValueType" mixed="true">
|
||||
* <choice>
|
||||
* <element ref="ds:DSAKeyValue"/>
|
||||
* <element ref="ds:RSAKeyValue"/>
|
||||
* <any namespace="##other" processContents="lax"/>
|
||||
* </choice>
|
||||
* </complexType>
|
||||
*
|
||||
* <element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
|
||||
* <complexType name="DSAKeyValueType">
|
||||
* <sequence>
|
||||
* <sequence minOccurs="0">
|
||||
* <element name="P" type="ds:CryptoBinary"/>
|
||||
* <element name="Q" type="ds:CryptoBinary"/>
|
||||
* </sequence>
|
||||
* <element name="G" type="ds:CryptoBinary" minOccurs="0"/>
|
||||
* <element name="Y" type="ds:CryptoBinary"/>
|
||||
* <element name="J" type="ds:CryptoBinary" minOccurs="0"/>
|
||||
* <sequence minOccurs="0">
|
||||
* <element name="Seed" type="ds:CryptoBinary"/>
|
||||
* <element name="PgenCounter" type="ds:CryptoBinary"/>
|
||||
* </sequence>
|
||||
* </sequence>
|
||||
* </complexType>
|
||||
*
|
||||
* <element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
|
||||
* <complexType name="RSAKeyValueType">
|
||||
* <sequence>
|
||||
* <element name="Modulus" type="ds:CryptoBinary"/>
|
||||
* <element name="Exponent" type="ds:CryptoBinary"/>
|
||||
* </sequence>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
* A <code>KeyValue</code> instance may be created by invoking the
|
||||
* {@link KeyInfoFactory#newKeyValue newKeyValue} method of the
|
||||
* {@link KeyInfoFactory} class, and passing it a {@link
|
||||
* java.security.PublicKey} representing the value of the public key. Here is
|
||||
* an example of creating a <code>KeyValue</code> from a {@link DSAPublicKey}
|
||||
* of a {@link java.security.cert.Certificate} stored in a
|
||||
* {@link java.security.KeyStore}:
|
||||
* <pre>
|
||||
* KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
* PublicKey dsaPublicKey = keyStore.getCertificate("myDSASigningCert").getPublicKey();
|
||||
* KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
|
||||
* KeyValue keyValue = factory.newKeyValue(dsaPublicKey);
|
||||
* </pre>
|
||||
*
|
||||
* This class returns the <code>DSAKeyValue</code> and
|
||||
* <code>RSAKeyValue</code> elements as objects of type
|
||||
* {@link DSAPublicKey} and {@link RSAPublicKey}, respectively. Note that not
|
||||
* all of the fields in the schema are accessible as parameters of these
|
||||
* types.
|
||||
*
|
||||
* @author Sean Mullan
|
||||
* @author JSR 105 Expert Group
|
||||
* @since 1.6
|
||||
* @see KeyInfoFactory#newKeyValue(PublicKey)
|
||||
*/
|
||||
public interface KeyValue extends XMLStructure {
|
||||
|
||||
/**
|
||||
* URI identifying the DSA KeyValue KeyInfo type:
|
||||
* http://www.w3.org/2000/09/xmldsig#DSAKeyValue. This can be specified as
|
||||
* the value of the <code>type</code> parameter of the
|
||||
* {@link RetrievalMethod} class to describe a remote
|
||||
* <code>DSAKeyValue</code> structure.
|
||||
*/
|
||||
final static String DSA_TYPE =
|
||||
"http://www.w3.org/2000/09/xmldsig#DSAKeyValue";
|
||||
|
||||
/**
|
||||
* URI identifying the RSA KeyValue KeyInfo type:
|
||||
* http://www.w3.org/2000/09/xmldsig#RSAKeyValue. This can be specified as
|
||||
* the value of the <code>type</code> parameter of the
|
||||
* {@link RetrievalMethod} class to describe a remote
|
||||
* <code>RSAKeyValue</code> structure.
|
||||
*/
|
||||
final static String RSA_TYPE =
|
||||
"http://www.w3.org/2000/09/xmldsig#RSAKeyValue";
|
||||
|
||||
/**
|
||||
* Returns the public key of this <code>KeyValue</code>.
|
||||
*
|
||||
* @return the public key of this <code>KeyValue</code>
|
||||
* @throws KeyException if this <code>KeyValue</code> cannot be converted
|
||||
* to a <code>PublicKey</code>
|
||||
*/
|
||||
PublicKey getPublicKey() throws KeyException;
|
||||
}
|
||||
117
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/PGPData.java
Normal file
117
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/PGPData.java
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* $Id: PGPData.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
|
||||
*/
|
||||
package javax.xml.crypto.dsig.keyinfo;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.xml.crypto.XMLStructure;
|
||||
|
||||
/**
|
||||
* A representation of the XML <code>PGPData</code> element as defined in
|
||||
* the <a href="http://www.w3.org/TR/xmldsig-core/">
|
||||
* W3C Recommendation for XML-Signature Syntax and Processing</a>. A
|
||||
* <code>PGPData</code> object is used to convey information related to
|
||||
* PGP public key pairs and signatures on such keys. The XML Schema Definition
|
||||
* is defined as:
|
||||
*
|
||||
* <pre>
|
||||
* <element name="PGPData" type="ds:PGPDataType"/>
|
||||
* <complexType name="PGPDataType">
|
||||
* <choice>
|
||||
* <sequence>
|
||||
* <element name="PGPKeyID" type="base64Binary"/>
|
||||
* <element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/>
|
||||
* <any namespace="##other" processContents="lax" minOccurs="0"
|
||||
* maxOccurs="unbounded"/>
|
||||
* </sequence>
|
||||
* <sequence>
|
||||
* <element name="PGPKeyPacket" type="base64Binary"/>
|
||||
* <any namespace="##other" processContents="lax" minOccurs="0"
|
||||
* maxOccurs="unbounded"/>
|
||||
* </sequence>
|
||||
* </choice>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
* A <code>PGPData</code> instance may be created by invoking one of the
|
||||
* {@link KeyInfoFactory#newPGPData newPGPData} methods of the {@link
|
||||
* KeyInfoFactory} class, and passing it
|
||||
* <code>byte</code> arrays representing the contents of the PGP public key
|
||||
* identifier and/or PGP key material packet, and an optional list of
|
||||
* elements from an external namespace.
|
||||
*
|
||||
* @author Sean Mullan
|
||||
* @author JSR 105 Expert Group
|
||||
* @since 1.6
|
||||
* @see KeyInfoFactory#newPGPData(byte[])
|
||||
* @see KeyInfoFactory#newPGPData(byte[], byte[], List)
|
||||
* @see KeyInfoFactory#newPGPData(byte[], List)
|
||||
*/
|
||||
public interface PGPData extends XMLStructure {
|
||||
|
||||
/**
|
||||
* URI identifying the PGPData KeyInfo type:
|
||||
* http://www.w3.org/2000/09/xmldsig#PGPData. This can be specified as the
|
||||
* value of the <code>type</code> parameter of the {@link RetrievalMethod}
|
||||
* class to describe a remote <code>PGPData</code> structure.
|
||||
*/
|
||||
final static String TYPE = "http://www.w3.org/2000/09/xmldsig#PGPData";
|
||||
|
||||
/**
|
||||
* Returns the PGP public key identifier of this <code>PGPData</code> as
|
||||
* defined in <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>,
|
||||
* section 11.2.
|
||||
*
|
||||
* @return the PGP public key identifier (may be <code>null</code> if
|
||||
* not specified). Each invocation of this method returns a new clone
|
||||
* to protect against subsequent modification.
|
||||
*/
|
||||
byte[] getKeyId();
|
||||
|
||||
/**
|
||||
* Returns the PGP key material packet of this <code>PGPData</code> as
|
||||
* defined in <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>,
|
||||
* section 5.5.
|
||||
*
|
||||
* @return the PGP key material packet (may be <code>null</code> if not
|
||||
* specified). Each invocation of this method returns a new clone to
|
||||
* protect against subsequent modification.
|
||||
*/
|
||||
byte[] getKeyPacket();
|
||||
|
||||
/**
|
||||
* Returns an {@link Collections#unmodifiableList unmodifiable list}
|
||||
* of {@link XMLStructure}s representing elements from an external
|
||||
* namespace.
|
||||
*
|
||||
* @return an unmodifiable list of <code>XMLStructure</code>s (may be
|
||||
* empty, but never <code>null</code>)
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
List getExternalElements();
|
||||
}
|
||||
113
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java
Normal file
113
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* $Id: RetrievalMethod.java,v 1.8 2005/05/10 16:35:35 mullan Exp $
|
||||
*/
|
||||
package javax.xml.crypto.dsig.keyinfo;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
import javax.xml.crypto.URIReference;
|
||||
import javax.xml.crypto.URIReferenceException;
|
||||
import javax.xml.crypto.XMLCryptoContext;
|
||||
import javax.xml.crypto.XMLStructure;
|
||||
import javax.xml.crypto.dsig.Transform;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A representation of the XML <code>RetrievalMethod</code> element as
|
||||
* defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
|
||||
* W3C Recommendation for XML-Signature Syntax and Processing</a>.
|
||||
* A <code>RetrievalMethod</code> object is used to convey a reference to
|
||||
* <code>KeyInfo</code> information that is stored at another location.
|
||||
* The XML schema definition is defined as:
|
||||
*
|
||||
* <pre>
|
||||
* <element name="RetrievalMethod" type="ds:RetrievalMethodType"/>
|
||||
* <complexType name="RetrievalMethodType">
|
||||
* <sequence>
|
||||
* <element name="Transforms" type="ds:TransformsType" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <attribute name="URI" type="anyURI"/>
|
||||
* <attribute name="Type" type="anyURI" use="optional"/>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
* A <code>RetrievalMethod</code> instance may be created by invoking one of the
|
||||
* {@link KeyInfoFactory#newRetrievalMethod newRetrievalMethod} methods
|
||||
* of the {@link KeyInfoFactory} class, and passing it the URI
|
||||
* identifying the location of the KeyInfo, an optional type URI identifying
|
||||
* the type of KeyInfo, and an optional list of {@link Transform}s; for example:
|
||||
* <pre>
|
||||
* KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
|
||||
* RetrievalMethod rm = factory.newRetrievalMethod
|
||||
* ("#KeyValue-1", KeyValue.DSA_TYPE, Collections.singletonList(Transform.BASE64));
|
||||
* </pre>
|
||||
*
|
||||
* @author Sean Mullan
|
||||
* @author JSR 105 Expert Group
|
||||
* @since 1.6
|
||||
* @see KeyInfoFactory#newRetrievalMethod(String)
|
||||
* @see KeyInfoFactory#newRetrievalMethod(String, String, List)
|
||||
*/
|
||||
public interface RetrievalMethod extends URIReference, XMLStructure {
|
||||
|
||||
/**
|
||||
* Returns an {@link java.util.Collections#unmodifiableList unmodifiable
|
||||
* list} of {@link Transform}s of this <code>RetrievalMethod</code>.
|
||||
*
|
||||
* @return an unmodifiable list of <code>Transform</code> objects (may be
|
||||
* empty but never <code>null</code>).
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
List getTransforms();
|
||||
|
||||
/**
|
||||
* Returns the URI of the referenced <code>KeyInfo</code> information.
|
||||
*
|
||||
* @return the URI of the referenced <code>KeyInfo</code> information in
|
||||
* RFC 2396 format (never <code>null</code>)
|
||||
*/
|
||||
String getURI();
|
||||
|
||||
/**
|
||||
* Dereferences the <code>KeyInfo</code> information referenced by this
|
||||
* <code>RetrievalMethod</code> and applies the specified
|
||||
* <code>Transform</code>s.
|
||||
*
|
||||
* @param context an <code>XMLCryptoContext</code> that may contain
|
||||
* additional useful information for dereferencing the URI. The
|
||||
* context's <code>baseURI</code> and <code>dereferencer</code>
|
||||
* parameters (if specified) are used to resolve and dereference this
|
||||
* <code>RetrievalMethod</code>
|
||||
* @return a <code>Data</code> object representing the raw contents of the
|
||||
* <code>KeyInfo</code> information referenced by this
|
||||
* <code>RetrievalMethod</code>. It is the caller's responsibility to
|
||||
* convert the returned data to an appropriate
|
||||
* <code>KeyInfo</code> object.
|
||||
* @throws NullPointerException if <code>context</code> is <code>null</code>
|
||||
* @throws URIReferenceException if there is an error while dereferencing
|
||||
*/
|
||||
Data dereference(XMLCryptoContext context) throws URIReferenceException;
|
||||
}
|
||||
114
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/X509Data.java
Normal file
114
jdkSrc/jdk8/javax/xml/crypto/dsig/keyinfo/X509Data.java
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* $Id: X509Data.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
|
||||
*/
|
||||
package javax.xml.crypto.dsig.keyinfo;
|
||||
|
||||
import javax.xml.crypto.XMLStructure;
|
||||
import java.security.cert.X509CRL;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A representation of the XML <code>X509Data</code> element as defined in
|
||||
* the <a href="http://www.w3.org/TR/xmldsig-core/">
|
||||
* W3C Recommendation for XML-Signature Syntax and Processing</a>. An
|
||||
* <code>X509Data</code> object contains one or more identifers of keys
|
||||
* or X.509 certificates (or certificates' identifiers or a revocation list).
|
||||
* The XML Schema Definition is defined as:
|
||||
*
|
||||
* <pre>
|
||||
* <element name="X509Data" type="ds:X509DataType"/>
|
||||
* <complexType name="X509DataType">
|
||||
* <sequence maxOccurs="unbounded">
|
||||
* <choice>
|
||||
* <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
|
||||
* <element name="X509SKI" type="base64Binary"/>
|
||||
* <element name="X509SubjectName" type="string"/>
|
||||
* <element name="X509Certificate" type="base64Binary"/>
|
||||
* <element name="X509CRL" type="base64Binary"/>
|
||||
* <any namespace="##other" processContents="lax"/>
|
||||
* </choice>
|
||||
* </sequence>
|
||||
* </complexType>
|
||||
*
|
||||
* <complexType name="X509IssuerSerialType">
|
||||
* <sequence>
|
||||
* <element name="X509IssuerName" type="string"/>
|
||||
* <element name="X509SerialNumber" type="integer"/>
|
||||
* </sequence>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
* An <code>X509Data</code> instance may be created by invoking the
|
||||
* {@link KeyInfoFactory#newX509Data newX509Data} methods of the
|
||||
* {@link KeyInfoFactory} class and passing it a list of one or more
|
||||
* {@link XMLStructure}s representing X.509 content; for example:
|
||||
* <pre>
|
||||
* KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
|
||||
* X509Data x509Data = factory.newX509Data
|
||||
* (Collections.singletonList("cn=Alice"));
|
||||
* </pre>
|
||||
*
|
||||
* @author Sean Mullan
|
||||
* @author JSR 105 Expert Group
|
||||
* @since 1.6
|
||||
* @see KeyInfoFactory#newX509Data(List)
|
||||
*/
|
||||
//@@@ check for illegal combinations of data violating MUSTs in W3c spec
|
||||
public interface X509Data extends XMLStructure {
|
||||
|
||||
/**
|
||||
* URI identifying the X509Data KeyInfo type:
|
||||
* http://www.w3.org/2000/09/xmldsig#X509Data. This can be specified as
|
||||
* the value of the <code>type</code> parameter of the
|
||||
* {@link RetrievalMethod} class to describe a remote
|
||||
* <code>X509Data</code> structure.
|
||||
*/
|
||||
final static String TYPE = "http://www.w3.org/2000/09/xmldsig#X509Data";
|
||||
|
||||
/**
|
||||
* URI identifying the binary (ASN.1 DER) X.509 Certificate KeyInfo type:
|
||||
* http://www.w3.org/2000/09/xmldsig#rawX509Certificate. This can be
|
||||
* specified as the value of the <code>type</code> parameter of the
|
||||
* {@link RetrievalMethod} class to describe a remote X509 Certificate.
|
||||
*/
|
||||
final static String RAW_X509_CERTIFICATE_TYPE =
|
||||
"http://www.w3.org/2000/09/xmldsig#rawX509Certificate";
|
||||
|
||||
/**
|
||||
* Returns an {@link java.util.Collections#unmodifiableList unmodifiable
|
||||
* list} of the content in this <code>X509Data</code>. Valid types are
|
||||
* {@link String} (subject names), <code>byte[]</code> (subject key ids),
|
||||
* {@link java.security.cert.X509Certificate}, {@link X509CRL},
|
||||
* or {@link XMLStructure} ({@link X509IssuerSerial}
|
||||
* objects or elements from an external namespace).
|
||||
*
|
||||
* @return an unmodifiable list of the content in this <code>X509Data</code>
|
||||
* (never <code>null</code> or empty)
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
List getContent();
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
/*
|
||||
* $Id: X509IssuerSerial.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
|
||||
*/
|
||||
package javax.xml.crypto.dsig.keyinfo;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.xml.crypto.XMLStructure;
|
||||
|
||||
/**
|
||||
* A representation of the XML <code>X509IssuerSerial</code> element as
|
||||
* defined in the <a href="http://www.w3.org/TR/xmldsig-core/">
|
||||
* W3C Recommendation for XML-Signature Syntax and Processing</a>.
|
||||
* An <code>X509IssuerSerial</code> object contains an X.509 issuer
|
||||
* distinguished name (DN) and serial number pair. The XML schema definition is
|
||||
* defined as:
|
||||
*
|
||||
* <pre>
|
||||
* <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
|
||||
* <complexType name="X509IssuerSerialType">
|
||||
* <sequence>
|
||||
* <element name="X509IssuerName" type="string"/>
|
||||
* <element name="X509SerialNumber" type="integer"/>
|
||||
* </sequence>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
* An <code>X509IssuerSerial</code> instance may be created by invoking the
|
||||
* {@link KeyInfoFactory#newX509IssuerSerial newX509IssuerSerial} method
|
||||
* of the {@link KeyInfoFactory} class, and passing it a
|
||||
* <code>String</code> and <code>BigInteger</code> representing the X.500
|
||||
* DN and serial number. Here is an example of creating an
|
||||
* <code>X509IssuerSerial</code> from the issuer DN and serial number of an
|
||||
* existing {@link X509Certificate}:
|
||||
* <pre>
|
||||
* KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
|
||||
* X509IssuerSerial issuer = factory.newX509IssuerSerial
|
||||
* (cert.getIssuerX500Principal().getName(), cert.getSerialNumber());
|
||||
* </pre>
|
||||
*
|
||||
* @author Sean Mullan
|
||||
* @author JSR 105 Expert Group
|
||||
* @since 1.6
|
||||
* @see X509Data#getContent
|
||||
* @see KeyInfoFactory#newX509IssuerSerial(String, BigInteger)
|
||||
*/
|
||||
public interface X509IssuerSerial extends XMLStructure {
|
||||
|
||||
/**
|
||||
* Returns the X.500 distinguished name of this
|
||||
* <code>X509IssuerSerial</code> in
|
||||
* <a href="http://www.ietf.org/rfc/rfc2253.txt">RFC 2253</a> String format.
|
||||
*
|
||||
* @return the X.500 distinguished name in RFC 2253 String format (never
|
||||
* <code>null</code>)
|
||||
*/
|
||||
String getIssuerName();
|
||||
|
||||
/**
|
||||
* Returns the serial number of this <code>X509IssuerSerial</code>.
|
||||
*
|
||||
* @return the serial number (never <code>null</code>)
|
||||
*/
|
||||
BigInteger getSerialNumber();
|
||||
}
|
||||
Reference in New Issue
Block a user