-
- All Superinterfaces:
AbstractGetNonceSize,CryptoAlgorithm,CryptoProcessor
- All Known Subinterfaces:
AbstractDecryptor,AbstractEncryptor,Decryptor,Encryptor
- All Known Implementing Classes:
CryptorImplCipher,CryptorImplCombined,DecryptorImplCipher,DecryptorImplCombined,EncryptorImplCiper,EncryptorImplCombined
public interface Cryptor extends CryptoProcessor, AbstractGetNonceSize
The abstract interface for an encryption or decryption function of an cryptographic algorithm. It supports bothsymmetricas well asasymmetricencryption. Implementations are typically just wrappers ofCipher. However this API is much more flexible, safe, and avoids many pitfalls. E.g. multipleCiphers can be combined without the need to change the code using theCryptor.- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
- See Also:
Decryptor,Encryptor,CryptorFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default byte[]crypt(byte[] input, boolean complete)byte[]crypt(byte[] input, int offset, int length, boolean complete)default byte[]crypt(CryptoBinary input, boolean complete)default byte[]doFinal()default byte[]process(byte[] input, int offset, int length, boolean complete)Generic method to process and transform data.-
Methods inherited from interface io.github.mmm.crypto.crypt.AbstractGetNonceSize
getNonceSize
-
Methods inherited from interface io.github.mmm.crypto.algorithm.CryptoAlgorithm
getAlgorithm
-
Methods inherited from interface io.github.mmm.crypto.CryptoProcessor
process, process, process, reset
-
-
-
-
Method Detail
-
doFinal
default byte[] doFinal()
- Returns:
- the encrypted (or decrypted) data. May be empty or
null. - See Also:
Cipher.doFinal()
-
crypt
default byte[] crypt(byte[] input, boolean complete)- Parameters:
input- the next chunk of data to encrypt or decrypt.complete- -trueto complete the encryption or decryption in case this is the last chunk of data,falseotherwise.- Returns:
- the encrypted or decrypted data.
- See Also:
Cipher.update(byte[]),Cipher.doFinal(byte[])
-
crypt
default byte[] crypt(CryptoBinary input, boolean complete)
- Parameters:
input- the next chunk of data to encrypt or decrypt.complete- -trueto complete the encryption or decryption in case this is the last chunk of data,falseotherwise.- Returns:
- the encrypted or decrypted data.
- See Also:
Cipher.update(byte[]),Cipher.doFinal(byte[])
-
crypt
byte[] crypt(byte[] input, int offset, int length, boolean complete)- 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)
-
process
default byte[] process(byte[] input, int offset, int length, boolean complete)Description copied from interface:CryptoProcessorGeneric method to process and transform data.CryptoProcessorEquivalent of process(input, offset, length, complete)HashCreatorupdate(input, offset, length); returnhash(complete);Cryptorreturncrypt(input, offset, length, true);SignatureSignerupdate(input, offset, length); returnsignAfterUpdate(complete);SignatureVerifierthrow newUnsupportedOperationException();- Specified by:
processin interfaceCryptoProcessor- Parameters:
input- the data to process.offset- the index where to start reading data frominput.length- the number of bytes to read frominput.complete- -trueto complete/reset this processor after processing the giveninput,falseotherwise.- Returns:
- the transformed
inputdata.
-
-