Package com.unboundid.util.ssl
Class KeyStoreKeyManager
java.lang.Object
javax.net.ssl.X509ExtendedKeyManager
com.unboundid.util.ssl.WrapperKeyManager
com.unboundid.util.ssl.KeyStoreKeyManager
- All Implemented Interfaces:
Serializable,KeyManager,X509KeyManager
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class KeyStoreKeyManager
extends WrapperKeyManager
implements Serializable
This class provides an SSL key manager that may be used to retrieve
certificates from a key store file. By default it will use the default key
store format for the JVM (e.g., "JKS" for Sun-provided Java implementations),
but alternate formats like PKCS12 may be used.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKeyStoreKeyManager(KeyStoreKeyManagerProperties properties) Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.KeyStoreKeyManager(File keyStoreFile, char[] keyStorePIN) Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.KeyStoreKeyManager(File keyStoreFile, char[] keyStorePIN, String keyStoreFormat, String certificateAlias) Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.KeyStoreKeyManager(File keyStoreFile, char[] keyStorePIN, String keyStoreFormat, String certificateAlias, boolean validateKeyStore) Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.KeyStoreKeyManager(String keyStoreFile, char[] keyStorePIN) Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.KeyStoreKeyManager(String keyStoreFile, char[] keyStorePIN, String keyStoreFormat, String certificateAlias) Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.KeyStoreKeyManager(String keyStoreFile, char[] keyStorePIN, String keyStoreFormat, String certificateAlias, boolean validateKeyStore) Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the path to the key store file to use.Retrieves the name of the key store file format.Methods inherited from class com.unboundid.util.ssl.WrapperKeyManager
chooseClientAlias, chooseEngineClientAlias, chooseEngineServerAlias, chooseServerAlias, getCertificateAlias, getCertificateChain, getClientAliases, getPrivateKey, getServerAliases
-
Constructor Details
-
KeyStoreKeyManager
public KeyStoreKeyManager(@NotNull File keyStoreFile, @Nullable char[] keyStorePIN) throws KeyStoreException Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file. It will use the default key store format.- Parameters:
keyStoreFile- The path to the key store file to use. It must not benull.keyStorePIN- The PIN to use to access the contents of the key store. It may benullif no PIN is required.- Throws:
KeyStoreException- If a problem occurs while initializing this key manager.
-
KeyStoreKeyManager
public KeyStoreKeyManager(@NotNull String keyStoreFile, @Nullable char[] keyStorePIN) throws KeyStoreException Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file. It will use the default key store format.- Parameters:
keyStoreFile- The path to the key store file to use. It must not benull.keyStorePIN- The PIN to use to access the contents of the key store. It may benullif no PIN is required.- Throws:
KeyStoreException- If a problem occurs while initializing this key manager.
-
KeyStoreKeyManager
public KeyStoreKeyManager(@NotNull File keyStoreFile, @Nullable char[] keyStorePIN, @Nullable String keyStoreFormat, @Nullable String certificateAlias) throws KeyStoreException Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.- Parameters:
keyStoreFile- The path to the key store file to use. It must not benull.keyStorePIN- The PIN to use to access the contents of the key store. It may benullif no PIN is required.keyStoreFormat- The format to use for the key store. It may benullif the default format should be used.certificateAlias- The nickname of the certificate that should be selected. It may benullif any acceptable certificate found in the keystore may be used.- Throws:
KeyStoreException- If a problem occurs while initializing this key manager.
-
KeyStoreKeyManager
public KeyStoreKeyManager(@NotNull String keyStoreFile, @Nullable char[] keyStorePIN, @Nullable String keyStoreFormat, @Nullable String certificateAlias) throws KeyStoreException Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.- Parameters:
keyStoreFile- The path to the key store file to use. It must not benull.keyStorePIN- The PIN to use to access the contents of the key store. It may benullif no PIN is required.keyStoreFormat- The format to use for the key store. It may benullif the default format should be used.certificateAlias- The nickname of the certificate that should be selected. It may benullif any acceptable certificate found in the keystore may be used.- Throws:
KeyStoreException- If a problem occurs while initializing this key manager.
-
KeyStoreKeyManager
public KeyStoreKeyManager(@NotNull File keyStoreFile, @Nullable char[] keyStorePIN, @Nullable String keyStoreFormat, @Nullable String certificateAlias, boolean validateKeyStore) throws KeyStoreException Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.- Parameters:
keyStoreFile- The path to the key store file to use. It must not benull.keyStorePIN- The PIN to use to access the contents of the key store. It may benullif no PIN is required.keyStoreFormat- The format to use for the key store. It may benullif the default format should be used.certificateAlias- The nickname of the certificate that should be selected. It may benullif any acceptable certificate found in the keystore may be used.validateKeyStore- Indicates whether to validate that the provided key store is acceptable and can actually be used to obtain a valid certificate. If a certificate alias was specified, then this will ensure that the key store contains a valid private key entry with that alias. If no certificate alias was specified, then this will ensure that the key store contains at least one valid private key entry.- Throws:
KeyStoreException- If a problem occurs while initializing this key manager, or if validation fails.
-
KeyStoreKeyManager
public KeyStoreKeyManager(@NotNull String keyStoreFile, @Nullable char[] keyStorePIN, @Nullable String keyStoreFormat, @Nullable String certificateAlias, boolean validateKeyStore) throws KeyStoreException Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.- Parameters:
keyStoreFile- The path to the key store file to use. It must not benull.keyStorePIN- The PIN to use to access the contents of the key store. It may benullif no PIN is required.keyStoreFormat- The format to use for the key store. It may benullif the default format should be used.certificateAlias- The nickname of the certificate that should be selected. It may benullif any acceptable certificate found in the keystore may be used.validateKeyStore- Indicates whether to validate that the provided key store is acceptable and can actually be used to obtain a valid certificate. If a certificate alias was specified, then this will ensure that the key store contains a valid private key entry with that alias. If no certificate alias was specified, then this will ensure that the key store contains at least one valid private key entry.- Throws:
KeyStoreException- If a problem occurs while initializing this key manager, or if validation fails.
-
KeyStoreKeyManager
public KeyStoreKeyManager(@NotNull KeyStoreKeyManagerProperties properties) throws KeyStoreException Creates a new instance of this key store key manager that provides the ability to retrieve certificates from the specified key store file.- Parameters:
properties- The properties to use to create this key manager. It must not benull.- Throws:
KeyStoreException- If a problem occurs while initializing this key manager, or if validation fails.
-
-
Method Details
-
getKeyStoreFile
Retrieves the path to the key store file to use.- Returns:
- The path to the key store file to use.
-
getKeyStoreFormat
Retrieves the name of the key store file format.- Returns:
- The name of the key store file format.
-