Package org.bouncycastle.tls.crypto.impl
Interface TlsBlockCipherImpl
- All Known Implementing Classes:
JceBlockCipherImpl
,JceBlockCipherWithCBCImplicitIVImpl
public interface TlsBlockCipherImpl
Interface for block cipher services.
-
Method Summary
Modifier and TypeMethodDescriptionint
doFinal
(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) Perform the cipher encryption/decryption returning the output in output.int
Return the blocksize (in bytes) of the underlying block cipher.void
init
(byte[] iv, int ivOff, int ivLen) Initialise the parameters for operator.void
setKey
(byte[] key, int keyOff, int keyLen) Set the key to be used by the block cipher implementation supporting this service.
-
Method Details
-
setKey
Set the key to be used by the block cipher implementation supporting this service.- Parameters:
key
- array holding the block cipher key.keyOff
- offset into the array the key starts at.keyLen
- length of the key in the array.- Throws:
IOException
-
init
Initialise the parameters for operator.- Parameters:
iv
- array holding the initialization vector (IV).ivOff
- offset into the array the IV starts at.ivLen
- length of the IV in the array.- Throws:
IOException
- if the parameters are inappropriate.
-
doFinal
int doFinal(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws IOException Perform the cipher encryption/decryption returning the output in output.Note: we have to use doFinal() here as it is the only way to guarantee output from the underlying cipher.
- Parameters:
input
- array holding input data to the cipher.inputOffset
- offset into input array data starts at.inputLength
- length of the input data in the array.output
- array to hold the cipher output.outputOffset
- offset into output array to start saving output.- Returns:
- the amount of data written to output.
- Throws:
IOException
- in case of failure.
-
getBlockSize
int getBlockSize()Return the blocksize (in bytes) of the underlying block cipher.- Returns:
- the cipher's blocksize.
-