@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class PKCS11KeyManager extends WrapperKeyManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_KEY_STORE_TYPE
The default key store type to use when accessing PKCS #11 tokens.
|
static java.lang.String |
DEFAULT_PROVIDER_CLASS
The fully-qualified name of the default provider class
(
sun.security.pkcs11.SunPKCS11 ) to use when accessing PKCS #11
tokens. |
Constructor and Description |
---|
PKCS11KeyManager(char[] keyStorePIN,
java.lang.String certificateAlias)
Creates a new instance of this PKCS #11 key manager with the provided
information.
|
PKCS11KeyManager(java.security.Provider provider,
java.lang.String keyStoreType,
char[] keyStorePIN,
java.lang.String certificateAlias)
Creates a new instance of this PKCS11 key manager with the provided
information.
|
PKCS11KeyManager(java.lang.String providerClassName,
java.io.File providerConfigFile,
java.lang.String keyStoreType,
char[] keyStorePIN,
java.lang.String certificateAlias)
Creates a new instance of this PKCS11 key manager with the provided
information.
|
Modifier and Type | Method and Description |
---|---|
static java.security.Provider |
getPKCS11JSSESProvider()
Retrieves an instance of a Java security provider that should be used when
performing JSSE-related operations in conjunction with PKCS #11 tokens.
|
static java.security.Provider |
getProvider(java.lang.String providerClassName,
java.io.File providerConfigFile,
java.lang.String keyStoreType,
boolean alwaysCreateNewInstance)
Retrieves an instance of a Java security provider that may be used to
interact with a PKCS #11 token.
|
chooseClientAlias, chooseEngineClientAlias, chooseEngineServerAlias, chooseServerAlias, getCertificateAlias, getCertificateChain, getClientAliases, getPrivateKey, getServerAliases
@NotNull public static final java.lang.String DEFAULT_KEY_STORE_TYPE
@NotNull public static final java.lang.String DEFAULT_PROVIDER_CLASS
sun.security.pkcs11.SunPKCS11
) to use when accessing PKCS #11
tokens.public PKCS11KeyManager(@Nullable char[] keyStorePIN, @Nullable java.lang.String certificateAlias) throws java.security.KeyStoreException
keyStorePIN
- The user PIN to use to access the PKCS #11
token. This may be null
if no PIN is
required.certificateAlias
- The nickname for the key entry to use in the
PKCS #11 token. It may be null
if any
acceptable entry may be used.java.security.KeyStoreException
- If a problem occurs while initializing this key
manager.public PKCS11KeyManager(@Nullable java.lang.String providerClassName, @Nullable java.io.File providerConfigFile, @Nullable java.lang.String keyStoreType, @Nullable char[] keyStorePIN, @Nullable java.lang.String certificateAlias) throws java.security.KeyStoreException
providerClassName
- The fully-qualified name of the Java class that
implements the provider to use to interact with
the PKCS #11 module. If this is null
,
then the key manager will attempt to
automatically identify the appropriate
provider.providerConfigFile
- A file that contains the configuration to use
for the provider. This may be null
if
no provider configuration is needed, or if the
provider is already properly instantiated.keyStoreType
- The name of the key store type to use when
interacting with the PKCS #11 token. If this
is null
, then a default key store type
of PKCS11
will be used.keyStorePIN
- The user PIN to use to access the PKCS #11
token. This may be null
if no PIN is
required.certificateAlias
- The nickname for the key entry to use in the
PKCS #11 token. It may be null
if any
acceptable entry may be used.java.security.KeyStoreException
- If a problem occurs while initializing this
key manager.public PKCS11KeyManager(@NotNull java.security.Provider provider, @Nullable java.lang.String keyStoreType, @Nullable char[] keyStorePIN, @Nullable java.lang.String certificateAlias) throws java.security.KeyStoreException
provider
- The Java security provider to use to access the
PKCS #11 token. It must not be null
.keyStoreType
- The name of the key store type to use when
interacting with the PKCS #11 token. If this
is null
, then a default key store type
of PKCS11
will be used.keyStorePIN
- The user PIN to use to access the PKCS #11
token. This may be null
if no PIN is
required.certificateAlias
- The nickname for the key entry to use in the
PKCS #11 token. It may be null
if any
acceptable entry may be used.java.security.KeyStoreException
- If a problem occurs while initializing this
key manager.@NotNull public static java.security.Provider getProvider(@Nullable java.lang.String providerClassName, @Nullable java.io.File providerConfigFile, @Nullable java.lang.String keyStoreType, boolean alwaysCreateNewInstance) throws java.security.KeyStoreException
providerClassName
- The fully-qualified name of the Java class
to use for the provider. If this is
null
, then an attempt will be made
to automatically identify the appropriate
provider class.providerConfigFile
- A file that contains the configuration to
use for the provider. This may be
null
if no provider configuration
is needed, or if the provider is already
properly instantiated.keyStoreType
- The name of the key store type to use when
interacting with the PKCS #11 token. If
this is null
, then a default key
store type of PKCS11
will be used.alwaysCreateNewInstance
- Indicates whether to always create a new
instance of the provider, evenjava.security.KeyStoreException
- If a problem occurs while retrieving the@Nullable public static java.security.Provider getPKCS11JSSESProvider()
null
if the best provider cannot be
determined.