Class SecretKeyRepositoryImpl
java.lang.Object
org.craftercms.commons.crypto.impl.SecretKeyRepositoryImpl
- All Implemented Interfaces:
SecretKeyRepository
,org.springframework.beans.factory.InitializingBean
public class SecretKeyRepositoryImpl
extends Object
implements SecretKeyRepository, org.springframework.beans.factory.InitializingBean
Default implementation of
SecretKeyRepository
, which uses JCE Key Store.- Author:
- avasquez
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
static final String
static final String
static final String
static final String
static final String
protected KeyStore
protected File
protected char[]
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Returns the secret key for the specified key nameprotected void
void
Saves the secret key in the repository, with the specified namevoid
setDefaultKeyAlgorithm
(String defaultKeyAlgorithm) void
setKeyStoreFile
(File keyStoreFile) void
setKeyStorePassword
(String keyStorePassword) protected void
-
Field Details
-
KEY_STORE_TYPE
- See Also:
-
LOG_KEY_KEY_FOUND
- See Also:
-
LOG_KEY_KEY_NOT_FOUND
- See Also:
-
LOG_KEY_KEY_CREATED
- See Also:
-
LOG_KEY_KEY_SAVED
- See Also:
-
LOG_KEY_KEY_STORE_LOADED
- See Also:
-
LOG_KEY_KEY_STORE_STORED
- See Also:
-
ERROR_KEY_KEY_STORE_LOAD_ERROR
- See Also:
-
ERROR_KEY_KEY_STORE_STORE_ERROR
- See Also:
-
ERROR_KEY_GET_KEY_ERROR
- See Also:
-
ERROR_KEY_SAVE_KEY_ERROR
- See Also:
-
keyStoreFile
-
keyStorePassword
protected char[] keyStorePassword -
defaultKeyAlgorithm
-
keyStore
-
-
Constructor Details
-
SecretKeyRepositoryImpl
public SecretKeyRepositoryImpl()
-
-
Method Details
-
setKeyStoreFile
-
setKeyStorePassword
-
setDefaultKeyAlgorithm
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
CryptoException
-
getKey
Description copied from interface:SecretKeyRepository
Returns the secret key for the specified key name- Specified by:
getKey
in interfaceSecretKeyRepository
- Parameters:
name
- the key's name in the repositorycreate
- true to create new key if there's no key with the specified name in the repository.- Returns:
- the key
- Throws:
CryptoException
-
saveKey
Description copied from interface:SecretKeyRepository
Saves the secret key in the repository, with the specified name- Specified by:
saveKey
in interfaceSecretKeyRepository
- Parameters:
name
- the key's name in the repositorykey
- the key to save- Throws:
CryptoException
-
loadKeyStore
- Throws:
CryptoException
-
storeKeyStore
- Throws:
CryptoException
-