- java.lang.Object
-
- io.github.mmm.crypto.algorithm.AbstractSecurityAlgorithm
-
- io.github.mmm.crypto.crypt.CryptorImplCombined
-
- All Implemented Interfaces:
CryptoAlgorithm
,AbstractGetNonceSize
,Cryptor
,CryptoProcessor
- Direct Known Subclasses:
DecryptorImplCombined
,EncryptorImplCombined
public abstract class CryptorImplCombined extends AbstractSecurityAlgorithm implements Cryptor
- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Constructor Summary
Constructors Constructor Description CryptorImplCombined(Cryptor[] cryptors)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
crypt(byte[] input, int offset, int length, boolean complete)
String
getAlgorithm()
protected Cryptor
getLastCryptor()
int
getNonceSize()
UnlikeCipher
this API is designed for ease of use.void
reset()
Will reset the internal state of this object.-
Methods inherited from class io.github.mmm.crypto.algorithm.AbstractSecurityAlgorithm
creationFailedException, creationFailedException, creationFailedException, creationFailedException, getAlgorithm, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.crypto.CryptoProcessor
process, process, process
-
-
-
-
Method Detail
-
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()
-
getNonceSize
public int getNonceSize()
Description copied from interface:AbstractGetNonceSize
UnlikeCipher
this API is designed for ease of use. Some cryptographic algorithms require aninitialization vector
(IV) and others do not. With this API you do not have to care and cannot do things wrong. The nonce will be prepended automatically to the encrypted payload and reconstructed from there on decryption. This works both forcrypt
and forstreaming
.- Specified by:
getNonceSize
in interfaceAbstractGetNonceSize
- Returns:
- the size of the nonce in bytes or
0
for none. - See Also:
Cipher.getIV()
-
crypt
public byte[] crypt(byte[] input, int offset, int length, boolean complete)
- Specified by:
crypt
in interfaceCryptor
- Parameters:
input
- the next chunk of data to encrypt or decrypt.offset
- the offset where to start in theinput
array.length
- the number of bytes to read from theinput
array.complete
- -true
to complete the encryption or decryption in case this is the last chunk of data,false
otherwise.- Returns:
- the number of bytes that have been written into the
output
array. - See Also:
Cipher.update(byte[], int, int)
,Cipher.doFinal(byte[], int, int)
-
reset
public void reset()
Description copied from interface:CryptoProcessor
Will reset the internal state of this object. Please note that complex algorithms especially forCryptor
may not reusable. It is therefore preferable to always create a fresh instance for each cryptographic task.- Specified by:
reset
in interfaceCryptoProcessor
- See Also:
MessageDigest.reset()
-
-