Class SoftPkiCredentialContainer
java.lang.Object
se.swedenconnect.security.credential.container.AbstractPkiCredentialContainer
se.swedenconnect.security.credential.container.AbstractKeyStorePkiCredentialContainer
se.swedenconnect.security.credential.container.SoftPkiCredentialContainer
- All Implemented Interfaces:
PkiCredentialContainer
Implements a
PkiCredentialContainer
based on a KeyStore
that is held in memory (i.e. not using an HSM
device for key storage).
Also see InMemoryPkiCredentialContainer
that is an in-memory container that does not use key stores (and
thus, does not generate any certificates as part of the key generation process).
- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Field Summary
Fields inherited from class se.swedenconnect.security.credential.container.AbstractPkiCredentialContainer
DEFAULT_SUPPORTED_KEY_TYPES
-
Constructor Summary
ConstructorDescriptionSoftPkiCredentialContainer
(String providerName) Constructor loading the security provider identified byproviderName
.SoftPkiCredentialContainer
(String providerName, String password) Constructor loading the security provider identified byproviderName
.SoftPkiCredentialContainer
(Provider provider) Constructor.SoftPkiCredentialContainer
(Provider provider, String password) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected KeyStore
createKeyStore
(Provider provider, char[] password) Creates the key store used to store generated keys.getCredentialFromAlias
(String alias) Gets the credential for a specific alias from the credential container.Methods inherited from class se.swedenconnect.security.credential.container.AbstractKeyStorePkiCredentialContainer
deleteCredential, generateCredential, getAlgorithmName, getCredential, getExpiryTime, getKeyStore, getPassword, getX500Name, listCredentials
Methods inherited from class se.swedenconnect.security.credential.container.AbstractPkiCredentialContainer
cleanup, generateAlias, getKeyGeneratorFactory, getKeyValidity, getProvider, isExpired, setKeyValidity, setSupportedKeyTypes
-
Constructor Details
-
SoftPkiCredentialContainer
Constructor loading the security provider identified byproviderName
. No password is used for the generated key store.- Parameters:
providerName
- the name of the security provider- Throws:
KeyStoreException
- for errors creating the key store
-
SoftPkiCredentialContainer
Constructor. No password is used for the generated key store.- Parameters:
provider
- the security provider- Throws:
KeyStoreException
- for errors creating the key store
-
SoftPkiCredentialContainer
public SoftPkiCredentialContainer(@Nonnull String providerName, @Nullable String password) throws KeyStoreException Constructor loading the security provider identified byproviderName
.- Parameters:
providerName
- the name of the security providerpassword
- the store password that we should use for the generated key store (may be null)- Throws:
KeyStoreException
- for errors creating the key store
-
SoftPkiCredentialContainer
public SoftPkiCredentialContainer(@Nonnull Provider provider, @Nullable String password) throws KeyStoreException Constructor.- Parameters:
provider
- the security providerpassword
- the store password that we should use for the generated key store (may be null)- Throws:
KeyStoreException
- for errors creating the key store
-
-
Method Details
-
createKeyStore
@Nonnull protected KeyStore createKeyStore(@Nonnull Provider provider, @Nullable char[] password) throws KeyStoreException Creates the key store used to store generated keys.- Specified by:
createKeyStore
in classAbstractKeyStorePkiCredentialContainer
- Parameters:
provider
- the provider for the key storepassword
- the password for the key store- Returns:
- key store
- Throws:
KeyStoreException
- error creating the key store
-
getCredentialFromAlias
@Nonnull public PkiCredential getCredentialFromAlias(@Nonnull String alias) throws PkiCredentialContainerException Gets the credential for a specific alias from the credential container.- Specified by:
getCredentialFromAlias
in classAbstractKeyStorePkiCredentialContainer
- Parameters:
alias
- the alias of the credential to get- Returns:
- credential for the specified alias
- Throws:
PkiCredentialContainerException
- for errors obtaining the requested credential
-