public class PKCS12KeyRetriever extends KeyRetriever
Note: StorageAuthenticators used with this class must override the StorageAuthenticator.getPassword() method.
| Constructor and Description | 
|---|
PKCS12KeyRetriever(java.io.InputStream p12Stream)
Creates a new  
PKCS12KeyRetriever instance. | 
PKCS12KeyRetriever(oracle.security.crypto.cert.PKCS12 pkcs12)
Creates a new  
PKCS12KeyRetriever instance. | 
| Modifier and Type | Method and Description | 
|---|---|
java.security.cert.X509Certificate | 
retrieveCertificate(KeyInfoData keyInfo)
Finds a certificate in the PKCS#12 by matching information in the given  
KeyInfoData's KeyName or X509Data elements. | 
java.security.PrivateKey | 
retrievePrivateKey(KeyInfoData keyInfo)
Finds a private key in the PKCS#12 by matching information in the given  
KeyInfoData's KeyName element. | 
java.security.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. | 
addKeyRetriever, getAuthenticator, getCertificate, getCertificate, getPrivateKey, getPrivateKey, getPublicKey, getPublicKey, getSymmetricKey, getSymmetricKey, removeKeyRetriever, retrieveCertificate, retrievePrivateKey, retrievePublicKey, retrieveSymmetricKey, retrieveSymmetricKey, setAuthenticator, setCertificateValidator, validateCertificate, validateCertificate, validateCertificate
public PKCS12KeyRetriever(java.io.InputStream p12Stream)
                   throws java.io.IOException
PKCS12KeyRetriever instance.p12Stream - An input stream containing the PKCS #12.java.io.IOException
public PKCS12KeyRetriever(oracle.security.crypto.cert.PKCS12 pkcs12)
                   throws java.io.IOException
PKCS12KeyRetriever instance.pkcs12 - The PKCS #12 object.java.io.IOExceptionpublic java.security.PublicKey retrievePublicKey(KeyInfoData keyInfo) throws KeyRetrievalException
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:
retrievePublicKey in class KeyRetrieverkeyInfo - A KeyInfoData to be used to locate the public key.PublicKey, or null if none could be located.StorageAuthenticationException - If an error occurs authenticating to the key source.KeyRetrievalExceptionKeyName, X509Datapublic java.security.cert.X509Certificate retrieveCertificate(KeyInfoData keyInfo) throws KeyRetrievalException
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:
retrieveCertificate in class KeyRetrieverkeyInfo - A KeyInfoData to be used to locate the certificate.X509Certificate, or null if none could be located.StorageAuthenticationException - If an error occurs authenticating to the key source.KeyRetrievalExceptionKeyName, X509Datapublic java.security.PrivateKey retrievePrivateKey(KeyInfoData keyInfo) throws KeyRetrievalException
KeyInfoData's KeyName element.
For a KeyName element, any of the following values may be used:
retrievePrivateKey in class KeyRetrieverkeyInfo - A KeyInfoData to be used to locate the private key.PrivateKey, or null if none could be located.StorageAuthenticationException - If an error occurs authenticating to the key source.KeyRetrievalExceptionKeyName