|
For the latest news and information visit The GNU Crypto project |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgnu.crypto.mode.EAX
public class EAX
A conventional two-pass authenticated-encrypted mode, EAX. EAX is a Authenticated Encryption with Additional Data (AEAD) scheme, which provides protection and authentication for the message, and provides authentication of an (optional) header. EAX is composed of the counter mode (CTR) and the one-key CBC MAC (OMAC).
This class makes full use of the IAuthenticatedMode
interface,
that is, all methods of both IMode
and IMac
can be used
as specified in the IAuthenticatedMode
interface.
References:
Field Summary |
---|
Fields inherited from interface gnu.crypto.mode.IMode |
---|
DECRYPTION, ENCRYPTION, IV, MODE_BLOCK_SIZE, STATE |
Fields inherited from interface gnu.crypto.cipher.IBlockCipher |
---|
CIPHER_BLOCK_SIZE, KEY_MATERIAL |
Fields inherited from interface gnu.crypto.mac.IMac |
---|
MAC_KEY_MATERIAL, TRUNCATED_SIZE |
Constructor Summary | |
---|---|
EAX(IBlockCipher cipher,
int cipherBlockSize)
|
Method Summary | |
---|---|
Iterator |
blockSizes()
Returns an Iterator over the supported block sizes. |
Object |
clone()
Returns a clone of this instance. |
int |
currentBlockSize()
Returns the currently set block size for this instance. |
void |
decryptBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
Decrypts exactly one block of ciphertext. |
int |
defaultBlockSize()
Returns the default value, in bytes, of the algorithm's block size. |
int |
defaultKeySize()
Returns the default value, in bytes, of the algorithm's key size. |
byte[] |
digest()
Completes the MAC by performing final operations such as padding and resetting the instance. |
void |
digest(byte[] out,
int outOffset)
|
void |
encryptBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
Encrypts exactly one block of plaintext. |
void |
init(Map attrib)
Initialises the algorithm with designated attributes. |
Iterator |
keySizes()
Returns an Iterator over the supported key sizes. |
int |
macSize()
Returns the output length in bytes of this MAC algorithm. |
String |
name()
Returns the canonical name of this instance. |
void |
reset()
Resets the algorithm instance for re-initialisation and use with other characteristics. |
boolean |
selfTest()
A correctness test that consists of basic symmetric encryption / decryption test(s) for all supported block and key sizes, as well as one (1) variable key Known Answer Test (KAT). |
void |
update(byte b)
Continues a MAC operation using the input byte. |
void |
update(byte[] in,
int inOff,
byte[] out,
int outOff)
A convenience method. |
void |
update(byte[] buf,
int off,
int len)
Continues a MAC operation, by filling the buffer, processing data in the algorithm's MAC_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EAX(IBlockCipher cipher, int cipherBlockSize)
Method Detail |
---|
public Object clone()
IBlockCipher
Returns a clone of this instance.
clone
in interface IBlockCipher
clone
in interface IMac
clone
in class Object
public String name()
IBlockCipher
Returns the canonical name of this instance.
name
in interface IBlockCipher
name
in interface IMac
public int defaultBlockSize()
IBlockCipher
Returns the default value, in bytes, of the algorithm's block size.
defaultBlockSize
in interface IBlockCipher
public int defaultKeySize()
IBlockCipher
Returns the default value, in bytes, of the algorithm's key size.
defaultKeySize
in interface IBlockCipher
public Iterator blockSizes()
IBlockCipher
Returns an Iterator
over the supported block sizes. Each
element returned by this object is an Integer
.
blockSizes
in interface IBlockCipher
Iterator
over the supported block sizes.public Iterator keySizes()
IBlockCipher
Returns an Iterator
over the supported key sizes. Each element
returned by this object is an Integer
.
keySizes
in interface IBlockCipher
Iterator
over the supported key sizes.public void init(Map attrib) throws InvalidKeyException
IBlockCipher
Initialises the algorithm with designated attributes. Permissible names and values are described in the class documentation above.
init
in interface IBlockCipher
init
in interface IMac
attrib
- a set of name-value pairs that describes the desired
future behaviour of this instance.
InvalidKeyException
- if the key data is invalid.IBlockCipher.KEY_MATERIAL
,
IBlockCipher.CIPHER_BLOCK_SIZE
public int currentBlockSize()
IBlockCipher
Returns the currently set block size for this instance.
currentBlockSize
in interface IBlockCipher
public void encryptBlock(byte[] in, int inOff, byte[] out, int outOff)
IBlockCipher
Encrypts exactly one block of plaintext.
encryptBlock
in interface IBlockCipher
in
- the plaintext.inOff
- index of in
from which to start considering
data.out
- the ciphertext.outOff
- index of out
from which to store result.public void decryptBlock(byte[] in, int inOff, byte[] out, int outOff)
IBlockCipher
Decrypts exactly one block of ciphertext.
decryptBlock
in interface IBlockCipher
in
- the plaintext.inOff
- index of in
from which to start considering
data.out
- the ciphertext.outOff
- index of out
from which to store result.public void update(byte[] in, int inOff, byte[] out, int outOff)
IMode
A convenience method. Effectively invokes the encryptBlock()
or decryptBlock()
method depending on the operational state
of the instance.
update
in interface IMode
in
- the plaintext.inOff
- index of in
from which to start considering
data.out
- the ciphertext.outOff
- index of out
from which to store result.public void reset()
IBlockCipher
Resets the algorithm instance for re-initialisation and use with other characteristics. This method always succeeds.
reset
in interface IBlockCipher
reset
in interface IMac
public boolean selfTest()
IBlockCipher
A correctness test that consists of basic symmetric encryption / decryption test(s) for all supported block and key sizes, as well as one (1) variable key Known Answer Test (KAT).
selfTest
in interface IBlockCipher
selfTest
in interface IMac
true
if the implementation passes simple
correctness tests. Returns false
otherwise.public int macSize()
IMac
Returns the output length in bytes of this MAC algorithm.
macSize
in interface IMac
public byte[] digest()
IMac
Completes the MAC by performing final operations such as padding and resetting the instance.
digest
in interface IMac
public void digest(byte[] out, int outOffset)
public void update(byte b)
IMac
Continues a MAC operation using the input byte.
update
in interface IMac
b
- the input byte to digest.public void update(byte[] buf, int off, int len)
IMac
Continues a MAC operation, by filling the buffer, processing data in the algorithm's MAC_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation.
update
in interface IMac
buf
- the input block.off
- start of meaningful bytes in input block.len
- number of bytes, in input block, to consider.
|
For the latest news and information visit The GNU Crypto project |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |