com.ibm.crypto.fips.provider
Class GCTR
- java.lang.Object
-
- com.ibm.crypto.fips.provider.GCTR
-
- All Implemented Interfaces:
- AESConstants, GCMConstants
public final class GCTR extends java.lang.Object implements AESConstants, GCMConstants
Implementation of the GCTR function from NIST SP 800-38D. http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf
-
-
Field Summary
-
Fields inherited from interface com.ibm.crypto.fips.provider.AESConstants
AES_BLOCK_SIZE, AES_KEYSIZES
-
Fields inherited from interface com.ibm.crypto.fips.provider.GCMConstants
DEFAULT_TAG_LENGTH, GCM_TAG_LENGTHS, GENERATED_IV_COUNTER_FIELD_LENGTH, GENERATED_IV_DEVICE_FIELD_LENGTH, GENERATED_IV_MAX_INVOCATIONS, GENERATED_IV_TOTAL_LENGTH
-
-
Constructor Summary
Constructors Constructor and Description GCTR()
-
Method Summary
Methods Modifier and Type Method and Description byte[]
gcm_ad(byte[] IV, byte[] C, byte[] A, byte[] T)
Performs an AES GCM decryption.byte[]
gcm_ae(byte[] IV, byte[] P, byte[] A, byte[] C_out)
Performs an AES GCM encryption.protected byte[]
gctr(int[] icb, byte[] X)
void
initKey(java.security.Key k)
Initializes the key.void
setT(int t)
Sets the length of the tag in bits.
-
-
-
Method Detail
-
initKey
public void initKey(java.security.Key k) throws java.security.InvalidKeyException
Initializes the key.- Parameters:
k
- the key- Throws:
java.security.InvalidKeyException
-
setT
public void setT(int t)
Sets the length of the tag in bits.- Parameters:
t
- the length of the tag in bits
-
gcm_ae
public byte[] gcm_ae(byte[] IV, byte[] P, byte[] A, byte[] C_out) throws javax.crypto.IllegalBlockSizeException
Performs an AES GCM encryption.- Parameters:
IV
- initialization vectorP
- plain textA
- additional authentication dataC_out
- cipher text- Returns:
- the tag
- Throws:
javax.crypto.IllegalBlockSizeException
-
gcm_ad
public byte[] gcm_ad(byte[] IV, byte[] C, byte[] A, byte[] T) throws javax.crypto.IllegalBlockSizeException, java.security.InvalidAlgorithmParameterException, javax.crypto.BadPaddingException
Performs an AES GCM decryption.- Parameters:
IV
- initialization vectorC
- cipher textA
- additional authentication dataT
- tag- Returns:
- the plain text
- Throws:
javax.crypto.IllegalBlockSizeException
java.security.InvalidAlgorithmParameterException
javax.crypto.BadPaddingException
-
gctr
protected byte[] gctr(int[] icb, byte[] X) throws javax.crypto.IllegalBlockSizeException
- Throws:
javax.crypto.IllegalBlockSizeException
-
-