public class JKSKeyProvider extends Object implements KeyProvider
JKSKeyProvider
is a class
that is implemented to retrieve X509Certificates and Private Keys from
user data store.
Constructor and Description |
---|
JKSKeyProvider()
Constructor
|
JKSKeyProvider(String keyStoreFilePropName,
String keyStorePassFilePropName,
String keyStoreTypePropName,
String privateKeyPassFilePropName)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(String alias)
Whether the key alias exists in the keystore.
|
Certificate |
getCertificate(PublicKey publicKey)
Return Certificate for the specified PublicKey.
|
Certificate |
getCertificate(String certAlias)
Get the Certificate named certAlias.
|
String |
getCertificateAlias(Certificate cert)
Get the alias name of the first keystore entry whose certificate matches
the given certificate.
|
KeyStore |
getKeyStore()
Get the keystore
|
PrivateKey |
getPrivateKey(String certAlias)
Return java.security.PrivateKey for the specified certAlias.
|
PrivateKey |
getPrivateKey(String certAlias,
String encryptedKeyPass)
Return the
PrivateKey for the specified certAlias and encrypted private key password. |
String |
getPrivateKeyPass()
Get the private key password
|
PublicKey |
getPublicKey(String keyAlias)
Return java.security.PublicKey for the specified keyAlias
|
SecretKey |
getSecretKey(String certAlias)
Retrieves the secret key for the given certificate alias.
|
X509Certificate |
getX509Certificate(String certAlias)
Return java.security.cert.X509Certificate for the specified certAlias.
|
void |
setCertificateEntry(String certAlias,
Certificate cert)
Set the Certificate with name certAlias in the leystore
|
void |
setKey(String storepass,
String keypass)
Set the key to access key store database.
|
void |
store()
Store the keystore changes
|
public void setKey(String storepass, String keypass)
setKey
in interface KeyProvider
storepass
- password for the key storekeypass
- password for the certificatepublic X509Certificate getX509Certificate(String certAlias)
getX509Certificate
in interface KeyProvider
certAlias
- Certificate alias namepublic PublicKey getPublicKey(String keyAlias)
getPublicKey
in interface KeyProvider
keyAlias
- Key alias namepublic PrivateKey getPrivateKey(String certAlias)
getPrivateKey
in interface KeyProvider
certAlias
- Certificate alias namepublic SecretKey getSecretKey(String certAlias)
KeyProvider
getSecretKey
in interface KeyProvider
certAlias
- the certificate alieaspublic PrivateKey getPrivateKey(String certAlias, String encryptedKeyPass)
PrivateKey
for the specified certAlias and encrypted private key password.getPrivateKey
in interface KeyProvider
certAlias
- Certificate alias nameencryptedKeyPass
- The encrypted keypass to use when getting the private certificatepublic String getCertificateAlias(Certificate cert)
getCertificateAlias
in interface KeyProvider
cert
- Certificatepublic String getPrivateKeyPass()
public KeyStore getKeyStore()
getKeyStore
in interface KeyProvider
public void setCertificateEntry(String certAlias, Certificate cert) throws SAMLException
certAlias
- Certificate's name Aliascert
- CertificateSAMLException
public Certificate getCertificate(String certAlias)
certAlias
- Certificate's name Aliaspublic void store() throws SAMLException
SAMLException
public Certificate getCertificate(PublicKey publicKey)
getCertificate
in interface KeyProvider
publicKey
- Certificate public keypublic boolean containsKey(String alias)
KeyProvider
containsKey
in interface KeyProvider
alias
- the key aliasCopyright © 2010–2025 Open Identity Platform Community. All rights reserved.