|
Bouncy Castle Cryptography 1.50 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.bouncycastle.crypto.modes.OCBBlockCipher
public class OCBBlockCipher
An implementation of the "work in progress" Internet-Draft The OCB Authenticated-Encryption Algorithm, licensed per:
License for Open-Source Software Implementations of OCB (Jan 9, 2013) — “License 1”
Under this license, you are authorized to make, use, and distribute open-source software implementations of OCB. This license terminates for you if you sue someone over their open-source software implementation of OCB claiming that you have a patent covering their implementation. This is a non-binding summary of a legal document (the link above). The parameters of the license are specified in the license document and that document is controlling.
| Constructor Summary | |
|---|---|
OCBBlockCipher(BlockCipher hashCipher,
BlockCipher mainCipher)
|
|
| Method Summary | |
|---|---|
protected void |
clear(byte[] bs)
|
int |
doFinal(byte[] output,
int outOff)
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. |
protected byte[] |
getLSub(int n)
|
byte[] |
getMac()
Return the value of the MAC associated with the last stream processed. |
int |
getOutputSize(int len)
return the size of the output buffer required for a processBytes plus a doFinal with an input of len bytes. |
BlockCipher |
getUnderlyingCipher()
return the cipher this object wraps. |
int |
getUpdateOutputSize(int len)
return the size of the output buffer required for a processBytes an input of len bytes. |
void |
init(boolean forEncryption,
CipherParameters parameters)
initialise the underlying cipher. |
protected static byte[] |
OCB_double(byte[] block)
|
protected static void |
OCB_extend(byte[] block,
int pos)
|
protected static int |
OCB_ntz(long x)
|
void |
processAADByte(byte input)
Add a single byte to the associated data check. |
void |
processAADBytes(byte[] input,
int off,
int len)
Add a sequence of bytes to the associated data check. |
int |
processByte(byte input,
byte[] output,
int outOff)
encrypt/decrypt a single byte. |
int |
processBytes(byte[] input,
int inOff,
int len,
byte[] output,
int outOff)
process a block of bytes from in putting the result into out. |
protected void |
processHashBlock()
|
protected void |
processMainBlock(byte[] output,
int outOff)
|
void |
reset()
Reset the cipher. |
protected void |
reset(boolean clearMac)
|
protected static int |
shiftLeft(byte[] block,
byte[] output)
|
protected void |
updateHASH(byte[] LSub)
|
protected static void |
xor(byte[] block,
byte[] val)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OCBBlockCipher(BlockCipher hashCipher,
BlockCipher mainCipher)
| Method Detail |
|---|
public BlockCipher getUnderlyingCipher()
AEADBlockCipher
getUnderlyingCipher in interface AEADBlockCipherpublic java.lang.String getAlgorithmName()
AEADBlockCipher
getAlgorithmName in interface AEADBlockCipher
public void init(boolean forEncryption,
CipherParameters parameters)
throws java.lang.IllegalArgumentException
AEADBlockCipher
init in interface AEADBlockCipherforEncryption - true if we are setting up for encryption, false otherwise.parameters - the necessary parameters for the underlying cipher to be initialised.
java.lang.IllegalArgumentException - if the params argument is inappropriate.public byte[] getMac()
AEADBlockCipher
getMac in interface AEADBlockCipherpublic int getOutputSize(int len)
AEADBlockCipher
getOutputSize in interface AEADBlockCipherlen - the length of the input.
public int getUpdateOutputSize(int len)
AEADBlockCipher
getUpdateOutputSize in interface AEADBlockCipherlen - the length of the input.
public void processAADByte(byte input)
AEADBlockCipher
processAADByte in interface AEADBlockCipherinput - the byte to be processed.
public void processAADBytes(byte[] input,
int off,
int len)
AEADBlockCipher
processAADBytes in interface AEADBlockCipherinput - the input byte array.off - 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 input,
byte[] output,
int outOff)
throws DataLengthException
AEADBlockCipher
processByte in interface AEADBlockCipherinput - the byte to be processed.output - 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[] input,
int inOff,
int len,
byte[] output,
int outOff)
throws DataLengthException
AEADBlockCipher
processBytes in interface AEADBlockCipherinput - 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.output - 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[] output,
int outOff)
throws java.lang.IllegalStateException,
InvalidCipherTextException
AEADBlockCipher
doFinal in interface AEADBlockCipheroutput - 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 void reset()
AEADBlockCipher
reset in interface AEADBlockCipherprotected void clear(byte[] bs)
protected byte[] getLSub(int n)
protected void processHashBlock()
protected void processMainBlock(byte[] output,
int outOff)
protected void reset(boolean clearMac)
protected void updateHASH(byte[] LSub)
protected static byte[] OCB_double(byte[] block)
protected static void OCB_extend(byte[] block,
int pos)
protected static int OCB_ntz(long x)
protected static int shiftLeft(byte[] block,
byte[] output)
protected static void xor(byte[] block,
byte[] val)
|
Bouncy Castle Cryptography 1.50 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||