public class KeyStoreWrapper extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
KeyStoreWrapper.AliasPasswordPair
used as data holder to hold the key-passwords for any alias
|
| Constructor and Description |
|---|
KeyStoreWrapper(byte[] keyStore,
KeyStoreSupporter.KeyStoreType keyStoreType,
String keystorePassword)
constructor to befill the entries for this class
it is expected that the keystore-password has already been entered into the keystore object therefore we wont need it anymore |
KeyStoreWrapper(byte[] keyStore,
KeyStoreSupporter.KeyStoreType keyStoreType,
String keystorePassword,
KeyStoreWrapper.AliasPasswordPair aliasPasswordPair,
KeyStoreWrapper.AliasPasswordPair... aliasPasswordPairs)
constructor to befill the entries for this class
|
KeyStoreWrapper(byte[] keyStore,
String keystorePassword)
constructor to befill the entries for this class
it is expected that the keystore-password has already been entered into the keystore object therefore we wont need it anymore The keystore is expected to be of type JKS |
KeyStoreWrapper(File keyStore,
String keystorePassword,
KeyStoreWrapper.AliasPasswordPair aliasPasswordPair,
KeyStoreWrapper.AliasPasswordPair... aliasPasswordPairs)
constructor to befill the entries for this class
|
KeyStoreWrapper(InputStream keyStore,
KeyStoreSupporter.KeyStoreType keyStoreType,
String keystorePassword)
constructor to befill the entries for this class
it is expected that the keystore-password has already been entered into the keystore object therefore we wont need it anymore |
KeyStoreWrapper(InputStream keyStore,
KeyStoreSupporter.KeyStoreType keyStoreType,
String keystorePassword,
KeyStoreWrapper.AliasPasswordPair aliasPasswordPair,
KeyStoreWrapper.AliasPasswordPair... aliasPasswordPairs)
constructor to befill the entries for this class
|
KeyStoreWrapper(InputStream keyStore,
String keystorePassword)
constructor to befill the entries for this class
it is expected that the keystore-password has already been entered into the keystore object therefore we wont need it anymore The keystore is expected to be of type JKS |
KeyStoreWrapper(KeyStore keyStore,
String privateKeyPassword)
constructor to befill the entries for this class
it is expected that the keystore-password has already been entered into the keystore object therefore we wont need it anymore for the keystore. |
KeyStoreWrapper(KeyStore keyStore,
String keystorePassword,
KeyStoreWrapper.AliasPasswordPair aliasPasswordPair,
KeyStoreWrapper.AliasPasswordPair... aliasPasswordPairs)
constructor to befill the entries for this class
it is expected that the keystore-password has already been entered into the keystore object therefore we wont need it anymore |
| Modifier and Type | Method and Description |
|---|---|
Enumeration<String> |
getAliases()
will return all aliases without having to handle the exception.
|
List<String> |
getAliasesAsList()
will return all aliases as list.
|
Optional<X509Certificate> |
getCertificate(String alias)
will read the certificate from the given alias
|
Optional<X509Certificate[]> |
getCertificateChain(String alias)
will read the certificate from the given alias
|
Optional<PrivateKey> |
getPrivateKey(String alias)
will extract the private key for the given alias
|
Optional<PrivateKey> |
getPrivateKey(String alias,
String password)
this method will extract a private key with the given alias and the given password
|
public KeyStoreWrapper(KeyStore keyStore, String privateKeyPassword)
keyStore - the keystore that should be accessibleprivateKeyPassword - the password used to access the private keys (the keystore is expected to contain
a single entry)public KeyStoreWrapper(byte[] keyStore,
String keystorePassword)
keyStore - the keystore that should be accessiblekeystorePassword - the keystore to open the keystorepublic KeyStoreWrapper(byte[] keyStore,
KeyStoreSupporter.KeyStoreType keyStoreType,
String keystorePassword)
keyStore - the keystore that should be accessiblekeyStoreType - the type of the keystorekeystorePassword - the keystore to open the keystorepublic KeyStoreWrapper(InputStream keyStore, String keystorePassword)
keyStore - the keystore that should be accessiblekeystorePassword - the keystore to open the keystorepublic KeyStoreWrapper(InputStream keyStore, KeyStoreSupporter.KeyStoreType keyStoreType, String keystorePassword)
keyStore - the keystore that should be accessiblekeyStoreType - the type of the keystorekeystorePassword - the keystore to open the keystorepublic KeyStoreWrapper(KeyStore keyStore, String keystorePassword, KeyStoreWrapper.AliasPasswordPair aliasPasswordPair, KeyStoreWrapper.AliasPasswordPair... aliasPasswordPairs)
keyStore - the keystore that should be accessiblekeystorePassword - the keystore to open the keystorealiasPasswordPair - a single alias key-password pair to access at least a single entry within the
keystorealiasPasswordPairs - a list of alias key-password pairs to access other entreies as wellpublic KeyStoreWrapper(byte[] keyStore,
KeyStoreSupporter.KeyStoreType keyStoreType,
String keystorePassword,
KeyStoreWrapper.AliasPasswordPair aliasPasswordPair,
KeyStoreWrapper.AliasPasswordPair... aliasPasswordPairs)
keyStore - the keystore that should be accessiblekeyStoreType - to resolve the given keystore into its appropriate typekeystorePassword - the password to access the keystore if necessaryaliasPasswordPair - a single alias key-password pair to access at least a single entry within the
keystorealiasPasswordPairs - a list of alias key-password pairs to access other entreies as wellpublic KeyStoreWrapper(InputStream keyStore, KeyStoreSupporter.KeyStoreType keyStoreType, String keystorePassword, KeyStoreWrapper.AliasPasswordPair aliasPasswordPair, KeyStoreWrapper.AliasPasswordPair... aliasPasswordPairs)
keyStore - the keystore that should be accessiblekeyStoreType - to resolve the given keystore into its appropriate typekeystorePassword - the password to access the keystore if necessaryaliasPasswordPair - a single alias key-password pair to access at least a single entry within the
keystorealiasPasswordPairs - a list of alias key-password pairs to access other entreies as wellpublic KeyStoreWrapper(File keyStore, String keystorePassword, KeyStoreWrapper.AliasPasswordPair aliasPasswordPair, KeyStoreWrapper.AliasPasswordPair... aliasPasswordPairs)
keyStore - the keystore that should be accessible. It is necessary for the keystore to have an
appropriate file ending like 'jks', 'jceks', 'p12' or 'pfx'!keystorePassword - the password to access the keystore if necessaryaliasPasswordPair - a single alias key-password pair to access at least a single entry within the
keystorealiasPasswordPairs - a list of alias key-password pairs to access other entreies as wellpublic Optional<PrivateKey> getPrivateKey(String alias)
alias - the keystore entry to get the private key frompublic Optional<PrivateKey> getPrivateKey(String alias, String password)
alias - the alias that holds the private keypassword - the password to access the private keypublic Optional<X509Certificate> getCertificate(String alias)
alias - the keystore entry to readpublic Optional<X509Certificate[]> getCertificateChain(String alias)
alias - the keystore entry to readpublic List<String> getAliasesAsList()
KeyStoreExceptionpublic Enumeration<String> getAliases()
KeyStoreExceptionCopyright © 2020. All rights reserved.