Package com.sun.identity.saml.xmlsig
Interface KeyProvider
-
- All Known Implementing Classes:
AMKeyProvider,JKSKeyProvider
public interface KeyProviderThe classKeyProvideris an interface that is implemented to retrieve X509Certificates and Private Keys from user data store.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsKey(String alias)Whether the key alias exists in the keystore.CertificategetCertificate(PublicKey publicKey)Returns certificate corresponding to the specifiedPublicKey.StringgetCertificateAlias(Certificate cert)Get the alias name of the first keystore entry whose certificate matches the given certificate.KeyStoregetKeyStore()Returns the keystore instance.PrivateKeygetPrivateKey(String certAlias)Returnsjava.security.PrivateKeyfor the specifiedcertAlias.PrivateKeygetPrivateKey(String certAlias, String encryptedKeyPass)Return thePrivateKeyfor the specified certAlias and encrypted private key password.PublicKeygetPublicKey(String keyAlias)Returnsjava.security.PublicKeyfor the specifiedkeyAliasSecretKeygetSecretKey(String certAlias)Retrieves the secret key for the given certificate alias.X509CertificategetX509Certificate(String certAlias)Returnjava.security.cert.X509Certificatefor the specifiedcertAlias.voidsetKey(String storepass, String keypass)Set the key to access key store database.
-
-
-
Method Detail
-
setKey
void setKey(String storepass, String keypass)
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
X509Certificate getX509Certificate(String certAlias)
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
PublicKey getPublicKey(String keyAlias)
Returnsjava.security.PublicKeyfor the specifiedkeyAlias- Parameters:
keyAlias- Key alias name- Returns:
PublicKeywhich matches thekeyAlias, return null if thePublicKeycould not be found.
-
getPrivateKey
PrivateKey getPrivateKey(String certAlias)
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
SecretKey getSecretKey(String certAlias)
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
PrivateKey getPrivateKey(String certAlias, String encryptedKeyPass)
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
String getCertificateAlias(Certificate cert)
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
Certificate getCertificate(PublicKey publicKey)
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.
-
getKeyStore
KeyStore getKeyStore()
Returns the keystore instance.- Returns:
- the keystore instance.
-
containsKey
boolean containsKey(String alias)
Whether the key alias exists in the keystore.- Parameters:
alias- the key alias- Returns:
- whether the key alias exists
-
-