KeyStoreManager¶
-
public class
KeyStoreManager
extends KeyStoreComponent¶ KeyStoreManager manages a key store and provides convenient methods such as method that retrieves an X509Certificate or retrieves a private key.
Author: Hugo Y. K. Lam
Constructors¶
KeyStoreManager¶
KeyStoreManager¶
-
public
KeyStoreManager
(KeyStore keyStore, String alias, String keyPass)¶ Creates a new instance of KeyStoreManager.
Parameters: - keyStore – the initialized keystore to be managed.
- alias – the alias name associating with the managed key.
- keyPass – the key password.
Throws: - KeyStoreManagementException – if the specified key store is null.
KeyStoreManager¶
KeyStoreManager¶
-
public
KeyStoreManager
(String location, String storePass, String alias, String keyPass)¶ Creates a new instance of KeyStoreManager.
Parameters: - location – the key store location.
- storePass – the key store password.
- alias – the alias name.
- keyPass – the key password.
Throws: - KeyStoreManagementException – if unable to initialize the key store with the given paramemeters.
KeyStoreManager¶
-
public
KeyStoreManager
(String location, String storePass, String storeType, Object provider)¶ Creates a new instance of KeyStoreManager.
Parameters: - location – the key store location.
- storePass – the key store password.
- storeType – the key store type.
- provider – the key store provider.
Throws: - KeyStoreManagementException – if unable to initialize the key store with the given paramemeters.
KeyStoreManager¶
-
public
KeyStoreManager
(String location, String storePass, String alias, String keyPass, String storeType, Object provider)¶ Creates a new instance of KeyStoreManager.
Parameters: - location – the key store location.
- storePass – the key store password.
- alias – the alias name.
- keyPass – the key password.
- storeType – the key store type.
- provider – the key store provider.
Throws: - KeyStoreManagementException – if unable to initialize the key store with the given paramemeters.
Methods¶
getAliases¶
getCertificate¶
-
public Certificate
getCertificate
()¶ Gets the managed certificate.
Returns: the managed certificate.
getCertificate¶
-
public Certificate
getCertificate
(String alias)¶ Gets the certificate asscoiated with the given alias name.
Parameters: - alias – the alias name.
Returns: the certificate.
getCertificateChain¶
-
public Certificate[]
getCertificateChain
()¶ Gets the managed certificate chain.
Returns: the managed certificate chain.
getCertificateChain¶
-
public Certificate[]
getCertificateChain
(String alias)¶ Gets the certificate chain asscoiated with the given alias name.
Parameters: - alias – the alias name.
Returns: the certificate chain.
getPrivateKey¶
-
public PrivateKey
getPrivateKey
()¶ Gets the managed private key.
Throws: - NoSuchAlgorithmException – if the algorithm for recovering the key cannot be found.
- UnrecoverableKeyException – if the key cannot be recovered (e.g., the given password is wrong).
Returns: the private key.
getX509Certificate¶
-
public X509Certificate
getX509Certificate
()¶ Gets the managed X509 certificate.
Throws: - ClassCastException – if the certificate is not of the X509 type.
Returns: the managed X509 certificate.
getX509Certificate¶
-
public X509Certificate
getX509Certificate
(String alias)¶ Gets the managed X509 certificate.
Parameters: - alias – the alias name.
Throws: - ClassCastException – if the certificate is not of the X509 type.
Returns: the managed X509 certificate.
getX509CertificateChain¶
-
public X509Certificate[]
getX509CertificateChain
()¶ Gets the managed X509 certificate chain.
Returns: the managed certificate chain.
getX509CertificateChain¶
-
public X509Certificate[]
getX509CertificateChain
(String alias)¶ Gets the X509 certificate chain asscoiated with the given alias name.
Parameters: - alias – the alias name.
Returns: the certificate chain.