- java.lang.Object
-
- io.github.mmm.crypto.algorithm.AbstractSecurityAlgorithm
-
- io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
-
- io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithRandom
-
- io.github.mmm.crypto.crypt.CryptorFactoryImpl
-
- All Implemented Interfaces:
AbstractCryptoFactory
,CryptoAlgorithm
,CryptorFactory
- Direct Known Subclasses:
AsymmetricCryptorFactoryImpl
,SymmetricCryptorFactoryImpl
public abstract class CryptorFactoryImpl extends AbstractCryptoAlgorithmWithRandom implements CryptorFactory
The implementation ofCryptorFactory
based onCipher
.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Field Summary
-
Fields inherited from class io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
provider
-
-
Constructor Summary
Constructors Constructor Description CryptorFactoryImpl(SecurityProvider provider, RandomFactory randomFactory)
The constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
getAlgorithm()
abstract CryptorConfig
getConfig()
Decryptor
newDecryptorUnsafe(Key decryptionKey)
Please use typesafenewEncryptor
method instead to avoid mistakes (passing wrongKey
).Encryptor
newEncryptorUnsafe(Key encryptionKey)
Please use typesafenewDecryptor
method instead to avoid mistakes (passing wrongKey
).-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithRandom
createSecureRandom, getRandomFactory
-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractCryptoAlgorithmWithProvider
getProvider
-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractSecurityAlgorithm
creationFailedException, creationFailedException, creationFailedException, creationFailedException, getAlgorithm, toString
-
-
-
-
Constructor Detail
-
CryptorFactoryImpl
public CryptorFactoryImpl(SecurityProvider provider, RandomFactory randomFactory)
The constructor.- Parameters:
provider
- the securitySecurityProvider
.randomFactory
- theRandomFactory
.
-
-
Method Detail
-
getConfig
public abstract CryptorConfig getConfig()
- Returns:
- the
CryptorConfig
.
-
getAlgorithm
public String getAlgorithm()
- Specified by:
getAlgorithm
in interfaceCryptoAlgorithm
- Returns:
- the name of the underlying algorithm (e.g. "RSA", "NONEwithECDSA", etc.).
- See Also:
Key.getAlgorithm()
,Signature.getAlgorithm()
,MessageDigest.getAlgorithm()
,SecureRandom.getAlgorithm()
,Cipher.getAlgorithm()
-
newEncryptorUnsafe
public Encryptor newEncryptorUnsafe(Key encryptionKey)
Description copied from interface:CryptorFactory
Please use typesafenewDecryptor
method instead to avoid mistakes (passing wrongKey
).- Specified by:
newEncryptorUnsafe
in interfaceCryptorFactory
- Parameters:
encryptionKey
- theKey
to use for encryption.- Returns:
- the
Encryptor
for encryption.
-
newDecryptorUnsafe
public Decryptor newDecryptorUnsafe(Key decryptionKey)
Description copied from interface:CryptorFactory
Please use typesafenewEncryptor
method instead to avoid mistakes (passing wrongKey
).- Specified by:
newDecryptorUnsafe
in interfaceCryptorFactory
- Parameters:
decryptionKey
- theKey
to use for decryption.- Returns:
- the
Decryptor
for decryption.
-
-