Package com.sun.identity.saml.xmlsig
Interface KeyProvider
The class
KeyProvider is an interface
that is implemented to retrieve X509Certificates and Private Keys from
user data store.-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String alias) Whether the key alias exists in the keystore.getCertificate(PublicKey publicKey) Returns certificate corresponding to the specifiedPublicKey.Get the alias name of the first keystore entry whose certificate matches the given certificate.getKeyPair(String certAlias) Returns the keystore instance.getPrivateKey(String certAlias) Returnsjava.security.PrivateKeyfor the specifiedcertAlias.getPrivateKey(String certAlias, String encryptedKeyPass) Return thePrivateKeyfor the specified certAlias and encrypted private key password.getPublicKey(String keyAlias) Returnsjava.security.PublicKeyfor the specifiedkeyAliasgetSecretKey(String certAlias) Retrieves the secret key for the given certificate alias.getX509Certificate(String certAlias) Returnjava.security.cert.X509Certificatefor the specifiedcertAlias.voidSet the key to access key store database.
-
Method Details
-
setKey
Set the key to access key store database. This method will only need to be called once if the key could not be obtained by other means.- Parameters:
storepass- password for the key storekeypass- password for the certificate
-
getX509Certificate
Returnjava.security.cert.X509Certificatefor the specifiedcertAlias.- Parameters:
certAlias- Certificate alias name- Returns:
X509Certificatewhich matches thecertAlias, return null if the certificate could not be found.
-
getPublicKey
Returnsjava.security.PublicKeyfor the specifiedkeyAlias- Parameters:
keyAlias- Key alias name- Returns:
PublicKeywhich matches thekeyAlias, return null if thePublicKeycould not be found.
-
getPrivateKey
Returnsjava.security.PrivateKeyfor the specifiedcertAlias.- Parameters:
certAlias- Certificate alias name- Returns:
PrivateKeywhich matches thecertAlias, return null if the private key could not be found.
-
getSecretKey
Retrieves the secret key for the given certificate alias.- Parameters:
certAlias- the certificate alieas- Returns:
- the secret key or returns null if the key does not exist or this key provider does not support secret keys
-
getPrivateKey
Return thePrivateKeyfor the specified certAlias and encrypted private key password.- Parameters:
certAlias- Certificate alias nameencryptedKeyPass- The encrypted keypass to use when getting the private certificate- Returns:
- PrivateKey which matches the certAlias, return null if the private key could not be found.
-
getCertificateAlias
Get the alias name of the first keystore entry whose certificate matches the given certificate.- Parameters:
cert- Certificate- Returns:
- the (alias) name of the first entry with matching certificate, or null if no such entry exists in this keystore. If the keystore has not been loaded properly, return null as well.
-
getCertificate
Returns certificate corresponding to the specifiedPublicKey.- Parameters:
publicKey- Certificate public key- Returns:
- Certificate which matches the
PublicKey, return null if the Certificate could not be found.
-
getKeyPair
- Parameters:
certAlias- Certificate alias name- Returns:
- KeyPair which matches the certAlias, return null if the PrivateKey or PublicKey could not be found.
-
getKeyStore
KeyStore getKeyStore()Returns the keystore instance.- Returns:
- the keystore instance.
-
containsKey
Whether the key alias exists in the keystore.- Parameters:
alias- the key alias- Returns:
- whether the key alias exists
-