Package com.google.crypto.tink.subtle
Class AesCtrJceCipher
- java.lang.Object
-
- com.google.crypto.tink.subtle.AesCtrJceCipher
-
- All Implemented Interfaces:
IndCpaCipher
public final class AesCtrJceCipher extends java.lang.Object implements IndCpaCipher
The primitive implements AES counter mode with random IVs, using JCE.Warning
It is safe against chosen-plaintext attacks, but does not provide ciphertext integrity, thus is unsafe against chosen-ciphertext attacks.
- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static TinkFipsUtil.AlgorithmFipsCompatibilityFIPS
-
Constructor Summary
Constructors Constructor Description AesCtrJceCipher(byte[] key, int ivSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decrypt(byte[] ciphertext)Decrypts the ciphertext with counter mode decryption.byte[]encrypt(byte[] plaintext)Encrypts the plaintext with counter mode encryption using randomly generated iv.
-
-
-
Field Detail
-
FIPS
public static final TinkFipsUtil.AlgorithmFipsCompatibility FIPS
-
-
Method Detail
-
encrypt
public byte[] encrypt(byte[] plaintext) throws java.security.GeneralSecurityExceptionEncrypts the plaintext with counter mode encryption using randomly generated iv. The output format is iv || raw ciphertext.- Specified by:
encryptin interfaceIndCpaCipher- Parameters:
plaintext- the plaintext to be encrypted.- Returns:
- the encryption of plaintext.
- Throws:
java.security.GeneralSecurityException
-
decrypt
public byte[] decrypt(byte[] ciphertext) throws java.security.GeneralSecurityExceptionDecrypts the ciphertext with counter mode decryption. The ciphertext format is iv || raw ciphertext.- Specified by:
decryptin interfaceIndCpaCipher- Parameters:
ciphertext- the ciphertext to be decrypted.- Returns:
- the decrypted plaintext.
- Throws:
java.security.GeneralSecurityException
-
-