- 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)StringgetAlgorithm()protected CryptorgetLastCryptor()intgetNonceSize()UnlikeCipherthis API is designed for ease of use.voidreset()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:
getAlgorithmin 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:AbstractGetNonceSizeUnlikeCipherthis 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 forcryptand forstreaming.- Specified by:
getNonceSizein interfaceAbstractGetNonceSize- Returns:
- the size of the nonce in bytes or
0for none. - See Also:
Cipher.getIV()
-
crypt
public byte[] crypt(byte[] input, int offset, int length, boolean complete)- Specified by:
cryptin interfaceCryptor- Parameters:
input- the next chunk of data to encrypt or decrypt.offset- the offset where to start in theinputarray.length- the number of bytes to read from theinputarray.complete- -trueto complete the encryption or decryption in case this is the last chunk of data,falseotherwise.- Returns:
- the number of bytes that have been written into the
outputarray. - See Also:
Cipher.update(byte[], int, int),Cipher.doFinal(byte[], int, int)
-
reset
public void reset()
Description copied from interface:CryptoProcessorWill reset the internal state of this object. Please note that complex algorithms especially forCryptormay not reusable. It is therefore preferable to always create a fresh instance for each cryptographic task.- Specified by:
resetin interfaceCryptoProcessor- See Also:
MessageDigest.reset()
-
-