Interface CryptoHandler
- All Known Subinterfaces:
MessageCryptoHandler
- All Known Implementing Classes:
DecryptionHandler
,EncryptionHandler
,LazyMessageCryptoHandler
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
Modifier and TypeMethodDescriptionint
doFinal(byte[] out, int outOff)
Finish processing of the bytes.int
Return the size of the output buffer required for a call todoFinal(byte[], int)
.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 ofinLen
bytes.int
estimatePartialOutputSize(int inLen)
Return the size of the output buffer required for a call toprocessBytes(byte[], int, int, byte[], int)
.boolean
For decrypt and parsing flows returnstrue
when this has handled as many bytes as it can.processBytes(byte[] in, int inOff, int inLen, byte[] out, int outOff)
Process a block of bytes fromin
putting the result intoout
.
-
Method Details
-
processBytes
Process a block of bytes fromin
putting the result intoout
.- Parameters:
in
- the input byte array.inOff
- the offset into thein
array 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
out
and 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 intoout
to 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 ofinLen
bytes.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 sizeinLen
bytes.
-
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 sizeinLen
bytes.
-
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 returnstrue
when 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.
-