com.ibm.crypto.fips.provider
Class AESGCMCipher
- java.lang.Object
-
- javax.crypto.CipherSpi
-
- com.ibm.crypto.fips.provider.AESGCMCipher
-
- All Implemented Interfaces:
- AESConstants, GCMConstants
public final class AESGCMCipher extends javax.crypto.CipherSpi implements AESConstants, GCMConstants
This is an implementation of AES GCM mode, which does not currently support Cipher.update.
-
-
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 AESGCMCipher()Constructs a new AESGCMCipher instance.
-
Method Summary
Methods Modifier and Type Method and Description protected byte[]engineDoFinal(byte[] input, int inputOffset, int inputLen)protected intengineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)protected intengineGetBlockSize()protected byte[]engineGetIV()protected intengineGetKeySize(java.security.Key key)Returns the key size of the given key object.protected intengineGetOutputSize(int inputLen)protected java.security.AlgorithmParametersengineGetParameters()protected voidengineInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)protected voidengineInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random)protected voidengineInit(int opmode, java.security.Key key, java.security.SecureRandom random)protected voidengineSetMode(java.lang.String mode)protected voidengineSetPadding(java.lang.String padding)protected byte[]engineUpdate(byte[] input, int inputOffset, int inputLen)protected intengineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)protected voidengineUpdateAAD(byte[] src, int offset, int len)protected voidengineUpdateAAD(java.nio.ByteBuffer src)protected byte[]internalDoFinal(byte[] input, int inputOffset, int inputLen)protected intinternalDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)protected intinternalGetBlockSize()protected byte[]internalGetIV()protected intinternalGetKeySize(java.security.Key key)protected intinternalGetOutputSize(int inputLen)protected java.security.AlgorithmParametersinternalGetParameters()protected voidinternalInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)protected voidinternalInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random)protected voidinternalInit(int opmode, java.security.Key key, java.security.SecureRandom random)protected voidinternalSetMode(java.lang.String mode)protected voidinternalSetPadding(java.lang.String padding)protected byte[]internalUpdate(byte[] input, int inputOffset, int inputLen)protected intinternalUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)protected voidinternalUpdateAAD(byte[] src, int offset, int len)protected voidinternalUpdateAAD(java.nio.ByteBuffer src)
-
-
-
Method Detail
-
engineDoFinal
protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) throws javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException- Specified by:
engineDoFinalin classjavax.crypto.CipherSpi- Throws:
javax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingException
-
internalDoFinal
protected byte[] internalDoFinal(byte[] input, int inputOffset, int inputLen) throws javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException- Throws:
javax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingException
-
engineDoFinal
protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws javax.crypto.ShortBufferException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException- Specified by:
engineDoFinalin classjavax.crypto.CipherSpi- Throws:
javax.crypto.ShortBufferExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingException
-
internalDoFinal
protected int internalDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws javax.crypto.ShortBufferException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.lang.IllegalStateException- Throws:
javax.crypto.ShortBufferExceptionjavax.crypto.IllegalBlockSizeExceptionjavax.crypto.BadPaddingExceptionjava.lang.IllegalStateException
-
engineGetBlockSize
protected int engineGetBlockSize()
- Specified by:
engineGetBlockSizein classjavax.crypto.CipherSpi
-
internalGetBlockSize
protected int internalGetBlockSize()
-
engineGetIV
protected byte[] engineGetIV()
- Specified by:
engineGetIVin classjavax.crypto.CipherSpi
-
internalGetIV
protected byte[] internalGetIV()
-
engineGetOutputSize
protected int engineGetOutputSize(int inputLen)
- Specified by:
engineGetOutputSizein classjavax.crypto.CipherSpi
-
internalGetOutputSize
protected int internalGetOutputSize(int inputLen)
-
engineGetParameters
protected java.security.AlgorithmParameters engineGetParameters()
- Specified by:
engineGetParametersin classjavax.crypto.CipherSpi
-
internalGetParameters
protected java.security.AlgorithmParameters internalGetParameters()
-
engineInit
protected void engineInit(int opmode, java.security.Key key, java.security.SecureRandom random) throws java.security.InvalidKeyException- Specified by:
engineInitin classjavax.crypto.CipherSpi- Throws:
java.security.InvalidKeyException
-
internalInit
protected void internalInit(int opmode, java.security.Key key, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.lang.IllegalStateException- Throws:
java.security.InvalidKeyExceptionjava.lang.IllegalStateException
-
engineInit
protected void engineInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Specified by:
engineInitin classjavax.crypto.CipherSpi- Throws:
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
internalInit
protected void internalInit(int opmode, java.security.Key key, java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Throws:
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
engineInit
protected void engineInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Specified by:
engineInitin classjavax.crypto.CipherSpi- Throws:
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
internalInit
protected void internalInit(int opmode, java.security.Key key, java.security.AlgorithmParameters params, java.security.SecureRandom random) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Throws:
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
engineSetMode
protected void engineSetMode(java.lang.String mode) throws java.security.NoSuchAlgorithmException- Specified by:
engineSetModein classjavax.crypto.CipherSpi- Throws:
java.security.NoSuchAlgorithmException
-
internalSetMode
protected void internalSetMode(java.lang.String mode) throws java.security.NoSuchAlgorithmException- Throws:
java.security.NoSuchAlgorithmException
-
engineSetPadding
protected void engineSetPadding(java.lang.String padding) throws javax.crypto.NoSuchPaddingException- Specified by:
engineSetPaddingin classjavax.crypto.CipherSpi- Throws:
javax.crypto.NoSuchPaddingException
-
internalSetPadding
protected void internalSetPadding(java.lang.String padding) throws javax.crypto.NoSuchPaddingException- Throws:
javax.crypto.NoSuchPaddingException
-
engineUpdate
protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen)- Specified by:
engineUpdatein classjavax.crypto.CipherSpi
-
internalUpdate
protected byte[] internalUpdate(byte[] input, int inputOffset, int inputLen)
-
engineUpdate
protected int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws javax.crypto.ShortBufferException- Specified by:
engineUpdatein classjavax.crypto.CipherSpi- Throws:
javax.crypto.ShortBufferException
-
internalUpdate
protected int internalUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws javax.crypto.ShortBufferException- Throws:
javax.crypto.ShortBufferException
-
engineUpdateAAD
protected void engineUpdateAAD(byte[] src, int offset, int len)- Overrides:
engineUpdateAADin classjavax.crypto.CipherSpi
-
internalUpdateAAD
protected void internalUpdateAAD(byte[] src, int offset, int len)
-
engineUpdateAAD
protected void engineUpdateAAD(java.nio.ByteBuffer src)
- Overrides:
engineUpdateAADin classjavax.crypto.CipherSpi
-
internalUpdateAAD
protected void internalUpdateAAD(java.nio.ByteBuffer src)
-
engineGetKeySize
protected int engineGetKeySize(java.security.Key key) throws java.security.InvalidKeyExceptionReturns the key size of the given key object.- Overrides:
engineGetKeySizein classjavax.crypto.CipherSpi- Parameters:
key- the key object.- Returns:
- the key size of the given key object.
- Throws:
java.security.InvalidKeyException- ifkeyis invalid.
-
internalGetKeySize
protected int internalGetKeySize(java.security.Key key) throws java.security.InvalidKeyException- Throws:
java.security.InvalidKeyException
-
-