|
Bouncy Castle Cryptography Library 1.77.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bouncycastle.crypto.modes.GCMSIVBlockCipher
GCM-SIV Mode.
It should be noted that the specified limit of 2 36 bytes is not supported. This is because all bytes are cached in a ByteArrayOutputStream object (which has a limit of a little less than 2 31 bytes), and are output on the doFinal() call (which can only process a maximum of 2 31 bytes).
The practical limit of 2 31 - 24 bytes is policed, and attempts to breach the limit will be rejected
In order to properly support the higher limit, an extended form of ByteArrayOutputStream would be needed which would use multiple arrays to store the data. In addition, a new doOutput method would be required (similar to that in XOF digests), which would allow the data to be output over multiple calls. Alternatively an extended form of ByteArrayInputStream could be used to deliver the data.
Constructor Summary | |
GCMSIVBlockCipher()
Constructor. |
|
GCMSIVBlockCipher(BlockCipher pCipher)
Constructor. |
|
GCMSIVBlockCipher(BlockCipher pCipher,
GCMMultiplier pMultiplier)
Constructor. |
Method Summary | |
int |
doFinal(byte[] pOutput,
int pOffset)
Finish the operation either appending or verifying the MAC at the end of the data. |
java.lang.String |
getAlgorithmName()
Return the name of the algorithm. |
byte[] |
getMac()
Return the value of the MAC associated with the last stream processed. |
int |
getOutputSize(int pLen)
return the size of the output buffer required for a processBytes plus a doFinal with an input of len bytes. |
BlockCipher |
getUnderlyingCipher()
return the BlockCipher this object wraps. |
int |
getUpdateOutputSize(int pLen)
return the size of the output buffer required for a processBytes an input of len bytes. |
void |
init(boolean pEncrypt,
CipherParameters cipherParameters)
initialise the underlying cipher. |
void |
processAADByte(byte pByte)
Add a single byte to the associated data check. |
void |
processAADBytes(byte[] pData,
int pOffset,
int pLen)
Add a sequence of bytes to the associated data check. |
int |
processByte(byte pByte,
byte[] pOutput,
int pOutOffset)
encrypt/decrypt a single byte. |
int |
processBytes(byte[] pData,
int pOffset,
int pLen,
byte[] pOutput,
int pOutOffset)
process a block of bytes from in putting the result into out. |
void |
reset()
Reset the cipher. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public GCMSIVBlockCipher()
public GCMSIVBlockCipher(BlockCipher pCipher)
pCipher
- the underlying cipherpublic GCMSIVBlockCipher(BlockCipher pCipher, GCMMultiplier pMultiplier)
pCipher
- the underlying cipherpMultiplier
- the multiplierMethod Detail |
public BlockCipher getUnderlyingCipher()
AEADBlockCipher
BlockCipher
this object wraps.getUnderlyingCipher
in interface AEADBlockCipher
org.bouncycastle.crypto.modes.AEADBlockCipher
BlockCipher
this object wraps.public void init(boolean pEncrypt, CipherParameters cipherParameters) throws java.lang.IllegalArgumentException
AEADCipher
init
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
forEncryption
- true if we are setting up for encryption, false otherwise.params
- the necessary parameters for the underlying cipher to be initialised.java.lang.IllegalArgumentException
- if the params argument is inappropriate.public java.lang.String getAlgorithmName()
AEADCipher
getAlgorithmName
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
public void processAADByte(byte pByte)
AEADCipher
processAADByte
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
in
- the byte to be processed.public void processAADBytes(byte[] pData, int pOffset, int pLen)
AEADCipher
processAADBytes
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
in
- the input byte array.inOff
- the offset into the in array where the data to be processed starts.len
- the number of bytes to be processed.public int processByte(byte pByte, byte[] pOutput, int pOutOffset) throws DataLengthException
AEADCipher
processByte
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
in
- the byte to be processed.out
- the output buffer the processed byte goes into.outOff
- the offset into the output byte array the processed data starts at.DataLengthException
- if the output buffer is too small.public int processBytes(byte[] pData, int pOffset, int pLen, byte[] pOutput, int pOutOffset) throws DataLengthException
AEADCipher
processBytes
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
in
- the input byte array.inOff
- the offset into the in array where the data to be processed starts.len
- 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.DataLengthException
- if the output buffer is too small.public int doFinal(byte[] pOutput, int pOffset) throws java.lang.IllegalStateException, InvalidCipherTextException
AEADCipher
doFinal
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
out
- space for any resulting output data.outOff
- offset into out to start copying the data at.java.lang.IllegalStateException
- if the cipher is in an inappropriate state.InvalidCipherTextException
- if the MAC fails to match.public byte[] getMac()
AEADCipher
getMac
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
public int getUpdateOutputSize(int pLen)
AEADCipher
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.
getUpdateOutputSize
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
len
- the length of the input.public int getOutputSize(int pLen)
AEADCipher
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 AEADCipher.doFinal(byte[], int)
.
getOutputSize
in interface AEADCipher
org.bouncycastle.crypto.modes.AEADCipher
len
- the length of the input.public void reset()
AEADCipher
reset
in interface AEADCipher
|
Bouncy Castle Cryptography Library 1.77.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |