Oracle Security Developer Tools XML Security Java API Reference
10g Release 2 (10.1.2.0.2)

B15571-01


oracle.security.xmlsec.keys.retrieval
Class PKCS12KeyRetriever

java.lang.Object
  extended byoracle.security.xmlsec.keys.retrieval.KeyRetriever
      extended byoracle.security.xmlsec.keys.retrieval.PKCS12KeyRetriever


public class PKCS12KeyRetriever
extends KeyRetriever

Class to retrieve keys and certificates from a PKCS #12 file.

Note: StorageAuthenticators used with this class must override the StorageAuthenticator.getPassword() method.

Since:
2.0

Constructor Summary
PKCS12KeyRetriever(java.io.InputStream p12Stream)
Creates a new PKCS12KeyRetriever instance.
PKCS12KeyRetriever(oracle.security.crypto.cert.PKCS12 pkcs12)
Creates a new PKCS12KeyRetriever instance.

Method Summary
oracle.security.crypto.cert.X509 retrieveCertificate(KeyInfoData keyInfo)
Finds a certificate in the PKCS#12 by matching information in the given KeyInfoData's KeyName or X509Data elements.
PrivateKey retrievePrivateKey(KeyInfoData keyInfo)
Finds a private key in the PKCS#12 by matching information in the given KeyInfoData's KeyName element.
PublicKey retrievePublicKey(KeyInfoData keyInfo)
Finds a public key in the PKCS#12 by retrieving the certificate that matches information in the given KeyInfoData's KeyName or X509Data elements.

Methods inherited from class oracle.security.xmlsec.keys.retrieval.KeyRetriever
addKeyRetriever, getAuthenticator, getCertificate, getCertificate, getPrivateKey, getPrivateKey, getPublicKey, getPublicKey, getSymmetricKey, getSymmetricKey, retrieveCertificate, retrievePrivateKey, retrievePublicKey, retrieveSymmetricKey, retrieveSymmetricKey, setAuthenticator

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

PKCS12KeyRetriever

public PKCS12KeyRetriever(java.io.InputStream p12Stream)
                   throws java.io.IOException
Creates a new PKCS12KeyRetriever instance.
Parameters:
p12Stream - An input stream containing the PKCS #12.

PKCS12KeyRetriever

public PKCS12KeyRetriever(oracle.security.crypto.cert.PKCS12 pkcs12)
                   throws java.io.IOException
Creates a new PKCS12KeyRetriever instance.
Parameters:
pkcs12 - The PKCS #12 object.

Method Detail

retrievePublicKey

public PublicKey retrievePublicKey(KeyInfoData keyInfo)
                            throws KeyRetrievalException
Finds a public key in the PKCS#12 by retrieving the certificate that matches information in the given KeyInfoData's KeyName or X509Data elements.

For a KeyName element, any of the following values may be used:

For a X509Data element, any of the following child element types may be used:

Overrides:
retrievePublicKey in class KeyRetriever
Parameters:
keyInfo - A KeyInfoData to be used to locate the public key.
Returns:
A PublicKey, or null if none could be located.
Throws:
KeyRetrievalException
See Also:
KeyName, X509Data

retrieveCertificate

public oracle.security.crypto.cert.X509 retrieveCertificate(KeyInfoData keyInfo)
                                                     throws KeyRetrievalException
Finds a certificate in the PKCS#12 by matching information in the given KeyInfoData's KeyName or X509Data elements.

For a KeyName element, any of the following values may be used:

For a X509Data element, any of the following child element types may be used:

Overrides:
retrieveCertificate in class KeyRetriever
Parameters:
keyInfo - A KeyInfoData to be used to locate the certificate.
Returns:
A X509, or null if none could be located.
Throws:
KeyRetrievalException
See Also:
KeyName, X509Data

retrievePrivateKey

public PrivateKey retrievePrivateKey(KeyInfoData keyInfo)
                              throws KeyRetrievalException
Finds a private key in the PKCS#12 by matching information in the given KeyInfoData's KeyName element.

For a KeyName element, any of the following values may be used:

Overrides:
retrievePrivateKey in class KeyRetriever
Parameters:
keyInfo - A KeyInfoData to be used to locate the private key.
Returns:
A PrivateKey, or null if none could be located.
Throws:
KeyRetrievalException
See Also:
KeyName

Oracle Security Developer Tools XML Security Java API Reference
10g Release 2 (10.1.2.0.2)

B15571-01


Copyright © 2005 , Oracle. All rights reserved.