com.sun.identity.saml.xmlsig
Interface KeyProvider


public interface KeyProvider

The class KeyProvider is an interface that is implemented to retrieve X509Certificates and Private Keys from user data store.


Method Summary
 java.security.cert.Certificate getCertificate(java.security.PublicKey publicKey)
          Returns certificate corresponding to the specified PublicKey.
 java.lang.String getCertificateAlias(java.security.cert.Certificate cert)
          Get the alias name of the first keystore entry whose certificate matches the given certificate.
 java.security.PrivateKey getPrivateKey(java.lang.String certAlias)
          Returns java.security.PrivateKey for the specified certAlias.
 java.security.PublicKey getPublicKey(java.lang.String keyAlias)
          Returns java.security.PublicKey for the specified keyAlias
 java.security.cert.X509Certificate getX509Certificate(java.lang.String certAlias)
          Return java.security.cert.X509Certificate for the specified certAlias.
 void setKey(java.lang.String storepass, java.lang.String keypass)
          Set the key to access key store database.
 

Method Detail

setKey

public void setKey(java.lang.String storepass,
                   java.lang.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 store
keypass - password for the certificate

getX509Certificate

public java.security.cert.X509Certificate getX509Certificate(java.lang.String certAlias)
Return java.security.cert.X509Certificate for the specified certAlias.
Parameters:
certAlias - Certificate alias name
Returns:
X509Certificate which matches the certAlias, return null if the certificate could not be found.

getPublicKey

public java.security.PublicKey getPublicKey(java.lang.String keyAlias)
Returns java.security.PublicKey for the specified keyAlias
Parameters:
keyAlias - Key alias name
Returns:
PublicKey which matches the keyAlias, return null if the PublicKey could not be found.

getPrivateKey

public java.security.PrivateKey getPrivateKey(java.lang.String certAlias)
Returns java.security.PrivateKey for the specified certAlias.
Parameters:
certAlias - Certificate alias name
Returns:
PrivateKey which matches the certAlias, return null if the private key could not be found.

getCertificateAlias

public java.lang.String getCertificateAlias(java.security.cert.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

public java.security.cert.Certificate getCertificate(java.security.PublicKey publicKey)
Returns certificate corresponding to the specified PublicKey.
Parameters:
publicKey - Certificate public key
Returns:
Certificate which matches the PublicKey, return null if the Certificate could not be found.