K - type of SecretKey.public abstract class SymmetricAccess<K extends SecretKey> extends CryptoAccess implements SymmetricKeyCreatorFactory<SymmetricKeyCreator<K>>, SymmetricCryptorFactory<K>, AbstractGetKeyLength
key management and
encryption/decryption based on
symmetric cryptography.| Modifier and Type | Field and Description |
|---|---|
private CryptorConfig |
cryptorConfig |
private SymmetricKeyConfig |
keyConfig |
private SymmetricKeyCreator<K> |
keyCreator |
private RandomFactory |
randomFactory |
| Constructor and Description |
|---|
SymmetricAccess(SymmetricKeyConfig keyConfig,
CryptorConfig cryptorConfig)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
CryptorConfig |
getCryptorConfig() |
SymmetricKeyConfig |
getKeyConfig() |
private SymmetricKeyCreator<K> |
getKeyCreatorInternal() |
int |
getKeyLength() |
Decryptor |
newDecryptor(K decryptionKey) |
Decryptor |
newDecryptorUnsafe(Key decryptionKey)
Please use typesafe
newEncryptor method instead to avoid mistakes (passing wrong Key). |
Encryptor |
newEncryptor(K encryptionKey) |
Encryptor |
newEncryptorUnsafe(Key encryptionKey)
Please use typesafe
newDecryptor method instead to avoid mistakes (passing wrong Key). |
SymmetricKeyCreator<K> |
newKeyCreator() |
private final SymmetricKeyConfig keyConfig
private final CryptorConfig cryptorConfig
private RandomFactory randomFactory
private SymmetricKeyCreator<K extends SecretKey> keyCreator
public SymmetricAccess(SymmetricKeyConfig keyConfig, CryptorConfig cryptorConfig)
keyConfig - the SymmetricKeyConfig.cryptorConfig - the CryptorConfig.public SymmetricKeyCreator<K> newKeyCreator()
newKeyCreator in interface KeyCreatorFactorynewKeyCreator in interface SymmetricKeyCreatorFactory<SymmetricKeyCreator<K extends SecretKey>>KeyCreator. May be reused but is not guaranteed to be thread-safe.private SymmetricKeyCreator<K> getKeyCreatorInternal()
public SymmetricKeyConfig getKeyConfig()
SymmetricKeyConfig.public CryptorConfig getCryptorConfig()
CryptorConfig.public int getKeyLength()
getKeyLength in interface AbstractGetKeyLengthalgorithm: A recent value for
RSA is 4096 bits while for PBKDF2 256 is sufficient. However, recommended and secure values change over
time as computing power is increasing. Therefore you should research the web to find an accurate value.public Decryptor newDecryptor(K decryptionKey)
newDecryptor in interface SymmetricCryptorFactory<K extends SecretKey>decryptionKey - the SecretKey to use for decryption.Decryptor for decryption.public Encryptor newEncryptor(K encryptionKey)
newEncryptor in interface SymmetricCryptorFactory<K extends SecretKey>encryptionKey - the SecretKey to use for encryption.Encryptor for encryption.public Encryptor newEncryptorUnsafe(Key encryptionKey)
CryptorFactorynewDecryptor method instead to avoid mistakes (passing wrong Key).newEncryptorUnsafe in interface CryptorFactoryencryptionKey - the Key to use for encryption.Encryptor for encryption.public Decryptor newDecryptorUnsafe(Key decryptionKey)
CryptorFactorynewEncryptor method instead to avoid mistakes (passing wrong Key).newDecryptorUnsafe in interface CryptorFactorydecryptionKey - the Key to use for decryption.Decryptor for decryption.Copyright © 2001–2019 mmm-Team. All rights reserved.