Interface CryptoHandler
-
- All Known Subinterfaces:
MessageCryptoHandler
- All Known Implementing Classes:
DecryptionHandler,EncryptionHandler,LazyMessageCryptoHandler
public interface CryptoHandlerThis interface defines the contract for the implementation of encryption and decryption handlers in this library.The implementations of this interface provided in this package currently process bytes in a single block mode (where all input data is processed in entirety, or in a framing mode (where data is processed incrementally in chunks).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intdoFinal(byte[] out, int outOff)Finish processing of the bytes.intestimateFinalOutputSize()Return the size of the output buffer required for a call todoFinal(byte[], int).intestimateOutputSize(int inLen)Return the size of the output buffer required for aprocessBytes(byte[], int, int, byte[], int)plus adoFinal(byte[], int)call with an input ofinLenbytes.intestimatePartialOutputSize(int inLen)Return the size of the output buffer required for a call toprocessBytes(byte[], int, int, byte[], int).booleanisComplete()For decrypt and parsing flows returnstruewhen this has handled as many bytes as it can.ProcessingSummaryprocessBytes(byte[] in, int inOff, int inLen, byte[] out, int outOff)Process a block of bytes frominputting the result intoout.
-
-
-
Method Detail
-
processBytes
ProcessingSummary processBytes(byte[] in, int inOff, int inLen, byte[] out, int outOff)
Process a block of bytes frominputting the result intoout.- Parameters:
in- the input byte array.inOff- the offset into theinarray where the data to be processed starts.inLen- the number of bytes to be processed.out- the output buffer the processed bytes go into.outOff- the offset into the output byte array the processed data starts at.- Returns:
- the number of bytes written to
outand the number of bytes parsed.
-
doFinal
int doFinal(byte[] out, int outOff)Finish processing of the bytes.- Parameters:
out- the output buffer for copying any remaining output data.outOff- offset intooutto start copying the output data.- Returns:
- number of bytes written into
out.
-
estimateOutputSize
int estimateOutputSize(int inLen)
Return the size of the output buffer required for aprocessBytes(byte[], int, int, byte[], int)plus adoFinal(byte[], int)call with an input ofinLenbytes.Note this method is allowed to return an estimation of the output size that is greater than the actual size of the output. Returning an estimate that is lesser than the actual size of the output will result in underflow exceptions.
- Parameters:
inLen- the length of the input.- Returns:
- the space required to accommodate a call to processBytes and
doFinal(byte[], int)with an input of sizeinLenbytes.
-
estimatePartialOutputSize
int estimatePartialOutputSize(int inLen)
Return the size of the output buffer required for a call toprocessBytes(byte[], int, int, byte[], int).Note this method is allowed to return an estimation of the output size that is greater than the actual size of the output. Returning an estimate that is lesser than the actual size of the output will result in underflow exceptions.
- Parameters:
inLen- the length of the input.- Returns:
- the space required to accommodate a call to
processBytes(byte[], int, int, byte[], int)with an input of sizeinLenbytes.
-
estimateFinalOutputSize
int estimateFinalOutputSize()
Return the size of the output buffer required for a call todoFinal(byte[], int).Note this method is allowed to return an estimation of the output size that is greater than the actual size of the output. Returning an estimate that is lesser than the actual size of the output will result in underflow exceptions.
- Returns:
- the space required to accomodate a call to
doFinal(byte[], int)
-
isComplete
boolean isComplete()
For decrypt and parsing flows returnstruewhen this has handled as many bytes as it can. This usually means that it has reached the end of an object, file, or other delimited stream.
-
-