Package com.google.crypto.tink.subtle
Class AesEaxJce
- java.lang.Object
-
- com.google.crypto.tink.subtle.AesEaxJce
-
- All Implemented Interfaces:
Aead
public final class AesEaxJce extends java.lang.Object implements Aead
This class implements the EAX mode using AES.EAX is an encryption mode proposed by Bellare, Rogaway and Wagner (http://web.cs.ucdavis.edu/~rogaway/papers/eax.pdf). The encryption mode is an alternative to CCM and has been proposed as a NIST standard: http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/eax/eax-spec.pdf
The parameter choices have been restricted to a small set of options:
- The tag size is always 16 bytes
- Nonces are chosen by the implementation at random. Their size is 12 or 16 bytes.
-
-
Field Summary
Fields Modifier and Type Field Description static TinkFipsUtil.AlgorithmFipsCompatibilityFIPS
-
Constructor Summary
Constructors Constructor Description AesEaxJce(byte[] key, int ivSizeInBytes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Aeadcreate(AesEaxKey key)byte[]decrypt(byte[] ciphertext, byte[] associatedData)DecryptsciphertextwithassociatedDataas associated authenticated data.byte[]encrypt(byte[] plaintext, byte[] associatedData)EncryptsplaintextwithassociatedDataas associated authenticated data.
-
-
-
Field Detail
-
FIPS
public static final TinkFipsUtil.AlgorithmFipsCompatibility FIPS
-
-
Method Detail
-
create
public static Aead create(AesEaxKey key) throws java.security.GeneralSecurityException
- Throws:
java.security.GeneralSecurityException
-
encrypt
public byte[] encrypt(byte[] plaintext, byte[] associatedData) throws java.security.GeneralSecurityExceptionDescription copied from interface:AeadEncryptsplaintextwithassociatedDataas associated authenticated data. The resulting ciphertext allows for checking authenticity and integrity of associated data (associatedData), but does not guarantee its secrecy.- Specified by:
encryptin interfaceAead- Parameters:
plaintext- the plaintext to be encrypted. It must be non-null, but can also be an empty (zero-length) byte arrayassociatedData- associated data to be authenticated, but not encrypted. Associated data is optional, so this parameter can be null. In this case the null value is equivalent to an empty (zero-length) byte array. For successful decryption the same associatedData must be provided along with the ciphertext.- Returns:
- resulting ciphertext
- Throws:
java.security.GeneralSecurityException
-
decrypt
public byte[] decrypt(byte[] ciphertext, byte[] associatedData) throws java.security.GeneralSecurityExceptionDescription copied from interface:AeadDecryptsciphertextwithassociatedDataas associated authenticated data. The decryption verifies the authenticity and integrity of the associated data, but there are no guarantees wrt. secrecy of that data.- Specified by:
decryptin interfaceAead- Parameters:
ciphertext- the plaintext to be decrypted. It must be non-null.associatedData- associated data to be authenticated. For successful decryption it must be the same as associatedData used during encryption. Can be null, which is equivalent to an empty (zero-length) byte array.- Returns:
- resulting plaintext
- Throws:
java.security.GeneralSecurityException- if decryption fails. Decryption must fail ifciphertextis not correctly authenticated for the givenassociatedData.
-
-