public class KeyInfoHelper extends Object
| 修飾子 | コンストラクタと説明 |
|---|---|
protected |
KeyInfoHelper()
Constructor.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
static void |
addCertificate(KeyInfo keyInfo,
X509Certificate cert)
Converts a native Java
X509Certificate into the corresponding
XMLObject and stores it in a KeyInfo in the first X509Data element. |
static void |
addCRL(KeyInfo keyInfo,
X509CRL crl)
|
static void |
addKeyName(KeyInfo keyInfo,
String keyNameValue)
Add a new
KeyName value to a KeyInfo. |
static void |
addPublicKey(KeyInfo keyInfo,
PublicKey pk)
|
static DSAKeyValue |
buildDSAKeyValue(DSAPublicKey dsaPubKey)
Builds a
DSAKeyValue XMLObject from the Java security DSA public key type. |
protected static PublicKey |
buildKey(KeySpec keySpec,
String keyAlgorithm)
Generates a public key from the given key spec.
|
static RSAKeyValue |
buildRSAKeyValue(RSAPublicKey rsaPubKey)
Builds an
RSAKeyValue XMLObject from the Java security RSA public key type. |
static X509Certificate |
buildX509Certificate(X509Certificate cert)
Builds an
X509Certificate XMLObject from a native
Java X509Certificate. |
static X509CRL |
buildX509CRL(X509CRL crl)
|
static X509IssuerSerial |
buildX509IssuerSerial(String issuerName,
BigInteger serialNumber)
Build an
X509IssuerSerial containing a given issuer name and serial number. |
static X509SKI |
buildX509SKI(X509Certificate javaCert)
Build an
X509SKI containing the subject key identifier extension value contained within
a certificate. |
static X509SubjectName |
buildX509SubjectName(String subjectName)
Build an
X509SubjectName containing a given subject name. |
static BigInteger |
decodeBigIntegerFromCryptoBinary(String base64Value)
Decode a base64-encoded ds:CryptoBinary value to a native Java BigInteger type.
|
static String |
encodeCryptoBinaryFromBigInteger(BigInteger bigInt)
Encode a native Java BigInteger type to a base64-encoded ds:CryptoBinary value.
|
static X509Certificate |
getCertificate(X509Certificate xmlCert)
Convert an
X509Certificate into a native Java representation. |
static List<X509Certificate> |
getCertificates(KeyInfo keyInfo)
Get a list of the Java
X509Certificate within the given KeyInfo. |
static List<X509Certificate> |
getCertificates(X509Data x509Data)
Get a list of the Java
X509Certificate within the given X509Data. |
static X509CRL |
getCRL(X509CRL xmlCRL)
Convert an
X509CRL into a native Java representation. |
static List<X509CRL> |
getCRLs(KeyInfo keyInfo)
|
static List<X509CRL> |
getCRLs(X509Data x509Data)
|
static PublicKey |
getDSAKey(DSAKeyValue keyDescriptor)
Builds an DSA key from a
DSAKeyValue element. |
static PublicKey |
getDSAKey(DSAKeyValue keyDescriptor,
DSAParams dsaParams)
Builds a DSA key from an
DSAKeyValue element and the supplied Java DSAParams,
which supplies key material from a shared key family. |
static PublicKey |
getKey(KeyValue keyValue)
Extracts the DSA or RSA public key within the
KeyValue. |
static List<String> |
getKeyNames(KeyInfo keyInfo)
Get the set of key names inside the specified
KeyInfo as a list of strings. |
static List<PublicKey> |
getPublicKeys(KeyInfo keyInfo)
|
static PublicKey |
getRSAKey(RSAKeyValue keyDescriptor)
Builds an RSA key from an
RSAKeyValue element. |
protected static CertificateFactory |
getX509CertFactory()
Get the Java certificate factory singleton.
|
static boolean |
hasCompleteDSAParams(DSAKeyValue keyDescriptor)
Check whether the specified
DSAKeyValue element has the all optional DSA
values which can be shared amongst many keys in a DSA "key family", and
are presumed to be known from context. |
public static List<String> getKeyNames(KeyInfo keyInfo)
KeyInfo as a list of strings.keyInfo - KeyInfo to retrieve key names frompublic static void addKeyName(KeyInfo keyInfo, String keyNameValue)
KeyName value to a KeyInfo.keyInfo - the KeyInfo to which to add the new valuekeyNameValue - the new key name value to addpublic static List<X509Certificate> getCertificates(KeyInfo keyInfo) throws CertificateException
X509Certificate within the given KeyInfo.keyInfo - key info to extract the certificates fromX509CertificatesCertificateException - thrown if there is a problem converting the
X509 data into X509Certificates.public static List<X509Certificate> getCertificates(X509Data x509Data) throws CertificateException
X509Certificate within the given X509Data.x509Data - X509Data from which to extract the certificateX509CertificatesCertificateException - thrown if there is a problem converting the
X509 data into X509Certificates.public static X509Certificate getCertificate(X509Certificate xmlCert) throws CertificateException
X509Certificate into a native Java representation.xmlCert - an X509CertificateX509CertificateCertificateException - thrown if there is a problem converting the
X509 data into X509Certificates.public static List<X509CRL> getCRLs(KeyInfo keyInfo) throws CRLException
keyInfo - the KeyInfo to extract the CRL's fromX509CRLsCRLException - thrown if there is a problem converting the
CRL data into X509CRLspublic static List<X509CRL> getCRLs(X509Data x509Data) throws CRLException
x509Data - X509Data to extract the CRLs fromX509CRLsCRLException - thrown if there is a problem converting the
CRL data into X509CRLspublic static X509CRL getCRL(X509CRL xmlCRL) throws CRLException
X509CRL into a native Java representation.xmlCRL - object to extract the CRL fromX509CRL objectCRLException - thrown if there is a problem converting the
CRL data into X509CRLspublic static void addCertificate(KeyInfo keyInfo, X509Certificate cert) throws CertificateEncodingException
X509Certificate into the corresponding
XMLObject and stores it in a KeyInfo in the first X509Data element.
The X509Data element will be created if necessary.keyInfo - the KeyInfo object into which to add the certificatecert - the Java X509Certificate to addCertificateEncodingException - thrown when there is an error converting the Java
certificate representation to the XMLObject representationpublic static void addCRL(KeyInfo keyInfo, X509CRL crl) throws CRLException
X509CRL into the corresponding XMLObject and stores it
in a KeyInfo in the first X509Data element. The X509Data element
will be created if necessary.keyInfo - the KeyInfo object into which to add the CRLcrl - the Java X509CRL to addCRLException - thrown when there is an error converting the Java
CRL representation to the XMLObject representationpublic static X509Certificate buildX509Certificate(X509Certificate cert) throws CertificateEncodingException
X509Certificate XMLObject from a native
Java X509Certificate.cert - the Java X509Certificate to convertX509Certificate XMLObjectCertificateEncodingException - thrown when there is an error converting the Java
certificate representation to the XMLObject representationpublic static X509CRL buildX509CRL(X509CRL crl) throws CRLException
crl - the Java X509CRL to convertX509CRL XMLObjectCRLException - thrown when there is an error converting the Java
CRL representation to the XMLObject representationpublic static X509SubjectName buildX509SubjectName(String subjectName)
X509SubjectName containing a given subject name.subjectName - the name contentpublic static X509IssuerSerial buildX509IssuerSerial(String issuerName, BigInteger serialNumber)
X509IssuerSerial containing a given issuer name and serial number.issuerName - the name contentserialNumber - the serial number contentpublic static X509SKI buildX509SKI(X509Certificate javaCert)
X509SKI containing the subject key identifier extension value contained within
a certificate.javaCert - the Java X509Certificate from which to extract the subject key identifier value.public static void addPublicKey(KeyInfo keyInfo, PublicKey pk) throws IllegalArgumentException
KeyInfo in a new KeyValue element.
As input, only supports PublicKeys which are instances of either
DSAPublicKey or
RSAPublicKeykeyInfo - the KeyInfo element to which to add the keypk - the native Java PublicKey to addIllegalArgumentException - thrown if an unsupported public key
type is passedpublic static RSAKeyValue buildRSAKeyValue(RSAPublicKey rsaPubKey)
RSAKeyValue XMLObject from the Java security RSA public key type.rsaPubKey - a native Java RSAPublicKeyRSAKeyValue XMLObjectpublic static DSAKeyValue buildDSAKeyValue(DSAPublicKey dsaPubKey)
DSAKeyValue XMLObject from the Java security DSA public key type.dsaPubKey - a native Java DSAPublicKeyDSAKeyValue XMLObjectpublic static List<PublicKey> getPublicKeys(KeyInfo keyInfo) throws KeyException
KeyInfo's KeyValues. This method only
supports DSA and RSA key types.keyInfo - KeyInfo to extract the keys out ofPublicKey objectsKeyException - thrown if the given key data can not be converted into PublicKeypublic static PublicKey getKey(KeyValue keyValue) throws KeyException
KeyValue.keyValue - the KeyValue to extract the key fromKey objectKeyException - thrown if the given key data can not be converted into PublicKeypublic static PublicKey getDSAKey(DSAKeyValue keyDescriptor) throws KeyException
DSAKeyValue element. The element must contain values
for all required DSA public key parameters, including values for shared key family
values P, Q and G.keyDescriptor - the DSAKeyValue key descriptorDSAPublicKey instance of PublicKeyKeyException - thrown if the key algorithm is not supported by the JCE or the key spec does not
contain valid informationpublic static PublicKey getDSAKey(DSAKeyValue keyDescriptor, DSAParams dsaParams) throws KeyException
DSAKeyValue element and the supplied Java DSAParams,
which supplies key material from a shared key family.keyDescriptor - the DSAKeyValue key descriptordsaParams - the DSAParams DSA key family parametersDSAPublicKey instance of PublicKeyKeyException - thrown if the key algorithm is not supported by the JCE or the key spec does not
contain valid informationpublic static boolean hasCompleteDSAParams(DSAKeyValue keyDescriptor)
DSAKeyValue element has the all optional DSA
values which can be shared amongst many keys in a DSA "key family", and
are presumed to be known from context.keyDescriptor - the DSAKeyValue element to checkpublic static PublicKey getRSAKey(RSAKeyValue keyDescriptor) throws KeyException
RSAKeyValue element.keyDescriptor - the RSAKeyValue key descriptorRSAPublicKey instance of PublicKeyKeyException - thrown if the key algorithm is not supported by the JCE or the key spec does not
contain valid informationpublic static final BigInteger decodeBigIntegerFromCryptoBinary(String base64Value)
base64Value - base64-encoded CryptoBinary valuepublic static final String encodeCryptoBinaryFromBigInteger(BigInteger bigInt)
bigInt - the BigInteger valueprotected static PublicKey buildKey(KeySpec keySpec, String keyAlgorithm) throws KeyException
keySpec - KeySpec specification for the keykeyAlgorithm - key generation algorithm, only DSA and RSA supportedPublicKeyKeyException - thrown if the key algorithm is not supported by the JCE or the key spec does not
contain valid informationprotected static CertificateFactory getX509CertFactory() throws CertificateException
CertificateFactory the factory used to create X509 certificate objectsCertificateException - thrown if the factory can not be createdCopyright © 2012. All Rights Reserved.