Note
this mode is a packet mode - it needs all the data up front.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private CCMBlockCipher. | |
| private int | |
| private BlockCipher | |
| private CCMBlockCipher. | |
| private boolean | |
| private byte[] | |
| private CipherParameters | |
| private byte[] | |
| private int | |
| private byte[] |
| Access | Constructor and Description |
|---|---|
| public | CCMBlockCipher(BlockCipher
the block cipher to be used. c)
Deprecated
use the CCMBlockCipher.newInstance() static method.
Basic constructor.
|
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public int | doFinal(byte[]
space for any resulting output data. out, int offset into out to start copying the data at. outOff)Implements org. |
| public String | getAlgorithmName()
Implements org. |
| private int | |
| public byte[] | Returns: the last mac calculated.Implements org. |
| private int | |
| public int | getOutputSize(int
the length of the input. len)Implements org. |
| public BlockCipher | Returns: the underlying block cipher that we are wrapping.Implements org. |
| public int | getUpdateOutputSize(int
the length of the input. len)Implements org. |
| private boolean | |
| public void | init(boolean
true if we are setting up for encryption, false otherwise. forEncryption, CipherParameters the necessary parameters for the underlying cipher to be initialised. params)Implements org. |
| public static CCMModeCipher | newInstance(BlockCipher
the base cipher for the CCM mode. cipher)Return a new CCM mode cipher based on the passed in base cipher |
| public void | processAADByte(byte
the byte to be processed. in)Implements org. |
| public void | processAADBytes(byte[]
the input byte array. in, int the offset into the in array where the data to be processed starts. inOff, int the number of bytes to be processed. len)Implements org. |
| public int | processByte(byte
the byte to be processed. in, byte[] the output buffer the processed byte goes into. out, int the offset into the output byte array the processed data starts at. outOff)Implements org. |
| public int | processBytes(byte[]
the input byte array. in, int the offset into the in array where the data to be processed starts. inOff, int the number of bytes to be processed. inLen, byte[] the output buffer the processed bytes go into. out, int the offset into the output byte array the processed data starts at. outOff)Implements org. |
| public byte[] | Returns: a byte array containing the processed input..data for processing. in, int offset at which data starts in the input array. inOff, int length of the data in the input array. inLen)Process a packet of data for either CCM decryption or encryption. |
| public int | Returns: the number of bytes added to output.data for processing. in, int offset at which data starts in the input array. inOff, int length of the data in the input array. inLen, byte[] output array. output, int offset into output array to start putting processed bytes. outOff)Process a packet of data for either CCM decryption or encryption. |
| public void |
| associatedText | back to summary |
|---|---|
| private CCMBlockCipher. | |
| blockSize | back to summary |
|---|---|
| private int blockSize | |
| cipher | back to summary |
|---|---|
| private BlockCipher cipher | |
| data | back to summary |
|---|---|
| private CCMBlockCipher. | |
| forEncryption | back to summary |
|---|---|
| private boolean forEncryption | |
| initialAssociatedText | back to summary |
|---|---|
| private byte[] initialAssociatedText | |
| keyParam | back to summary |
|---|---|
| private CipherParameters keyParam | |
| macBlock | back to summary |
|---|---|
| private byte[] macBlock | |
| macSize | back to summary |
|---|---|
| private int macSize | |
| nonce | back to summary |
|---|---|
| private byte[] nonce | |
| CCMBlockCipher | back to summary |
|---|---|
| public CCMBlockCipher(BlockCipher c)
Deprecated use the CCMBlockCipher.newInstance() static method. Basic constructor.
| |
| calculateMac | back to summary |
|---|---|
| private int calculateMac(byte[] data, int dataOff, int dataLen, byte[] macBlock) | |
| doFinal | back to summary |
|---|---|
| public int doFinal(byte[] out, int outOff) throws IllegalStateException, InvalidCipherTextException Implements org. Doc from org. Finish the operation either appending or verifying the MAC at the end of the data.
| |
| getAlgorithmName | back to summary |
|---|---|
| public String getAlgorithmName() Implements org. Doc from org. Return the name of the algorithm.
| |
| getAssociatedTextLength | back to summary |
|---|---|
| private int getAssociatedTextLength() | |
| getMac | back to summary |
|---|---|
| public byte[] getMac() Implements org. Returns a byte array containing the mac calculated as part of the last encrypt or decrypt operation.
| |
| getMacSize | back to summary |
|---|---|
| private int getMacSize(boolean forEncryption, int requestedMacBits) | |
| getOutputSize | back to summary |
|---|---|
| public int getOutputSize(int len) Implements org. Doc from org. return the size of the output buffer required for a processBytes plus a doFinal with an input of len bytes.
The returned size may be dependent on the initialisation of this cipher
and may not be accurate once subsequent input data is processed - this method
should be invoked immediately prior to a call to final processing of input data
and a call to
| |
| getUnderlyingCipher | back to summary |
|---|---|
| public BlockCipher getUnderlyingCipher() Implements org. return the underlying block cipher that we are wrapping.
| |
| getUpdateOutputSize | back to summary |
|---|---|
| public int getUpdateOutputSize(int len) Implements org. Doc from org. return the size of the output buffer required for a processBytes an input of len bytes. The returned size may be dependent on the initialisation of this cipher and may not be accurate once subsequent input data is processed - this method should be invoked immediately prior to input data being processed.
| |
| hasAssociatedText | back to summary |
|---|---|
| private boolean hasAssociatedText() | |
| init | back to summary |
|---|---|
| public void init(boolean forEncryption, CipherParameters params) throws IllegalArgumentException Implements org. Doc from org. initialise the underlying cipher. Parameter can either be an AEADParameters or a ParametersWithIV object.
| |
| newInstance | back to summary |
|---|---|
| public static CCMModeCipher newInstance(BlockCipher cipher) Return a new CCM mode cipher based on the passed in base cipher
| |
| processAADByte | back to summary |
|---|---|
| public void processAADByte(byte in) Implements org. Doc from org. Add a single byte to the associated data check.
| |
| processAADBytes | back to summary |
|---|---|
| public void processAADBytes(byte[] in, int inOff, int len) Implements org. Doc from org. Add a sequence of bytes to the associated data check.
| |
| processByte | back to summary |
|---|---|
| public int processByte(byte in, byte[] out, int outOff) throws DataLengthException, IllegalStateException Implements org. Doc from org. encrypt/decrypt a single byte.
| |
| processBytes | back to summary |
|---|---|
| public int processBytes(byte[] in, int inOff, int inLen, byte[] out, int outOff) throws DataLengthException, IllegalStateException Implements org. Doc from org. process a block of bytes from in putting the result into out.
| |
| processPacket | back to summary |
|---|---|
| public byte[] processPacket(byte[] in, int inOff, int inLen) throws IllegalStateException, InvalidCipherTextException Process a packet of data for either CCM decryption or encryption.
| |
| processPacket | back to summary |
|---|---|
| public int processPacket(byte[] in, int inOff, int inLen, byte[] output, int outOff) throws IllegalStateException, InvalidCipherTextException, DataLengthException Process a packet of data for either CCM decryption or encryption.
| |
| reset | back to summary |
|---|---|
| public void reset() Implements org. Doc from org. Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one). | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public byte[] |
| ExposedByteArrayOutputStream | back to summary |
|---|---|
| public ExposedByteArrayOutputStream() | |
| getBuffer | back to summary |
|---|---|
| public byte[] getBuffer() | |