public class AuthenticatedSymmetricCipherImpl
extends javacardx.crypto.AEADCipher
ALG_AES_CCM, ALG_AES_GCM, CIPHER_AES_CCM, CIPHER_AES_GCMALG_AES_BLOCK_128_CBC_NOPAD, ALG_AES_BLOCK_128_ECB_NOPAD, ALG_AES_BLOCK_192_CBC_NOPAD, ALG_AES_BLOCK_192_ECB_NOPAD, ALG_AES_BLOCK_256_CBC_NOPAD, ALG_AES_BLOCK_256_ECB_NOPAD, ALG_AES_CBC_ISO9797_M1, ALG_AES_CBC_ISO9797_M2, ALG_AES_CBC_PKCS5, ALG_AES_CTR, ALG_AES_ECB_ISO9797_M1, ALG_AES_ECB_ISO9797_M2, ALG_AES_ECB_PKCS5, ALG_DES_CBC_ISO9797_M1, ALG_DES_CBC_ISO9797_M2, ALG_DES_CBC_NOPAD, ALG_DES_CBC_PKCS5, ALG_DES_ECB_ISO9797_M1, ALG_DES_ECB_ISO9797_M2, ALG_DES_ECB_NOPAD, ALG_DES_ECB_PKCS5, ALG_KOREAN_SEED_CBC_NOPAD, ALG_KOREAN_SEED_ECB_NOPAD, ALG_RSA_ISO14888, ALG_RSA_ISO9796, ALG_RSA_NOPAD, ALG_RSA_PKCS1, ALG_RSA_PKCS1_OAEP, CIPHER_AES_CBC, CIPHER_AES_ECB, CIPHER_DES_CBC, CIPHER_DES_ECB, CIPHER_KOREAN_SEED_CBC, CIPHER_KOREAN_SEED_ECB, CIPHER_RSA, MODE_DECRYPT, MODE_ENCRYPT, PAD_ISO9796, PAD_ISO9796_MR, PAD_ISO9797_1_M1_ALG3, PAD_ISO9797_1_M2_ALG3, PAD_ISO9797_M1, PAD_ISO9797_M2, PAD_NOPAD, PAD_NULL, PAD_PKCS1, PAD_PKCS1_OAEP, PAD_PKCS1_OAEP_SHA224, PAD_PKCS1_OAEP_SHA256, PAD_PKCS1_OAEP_SHA3_224, PAD_PKCS1_OAEP_SHA3_256, PAD_PKCS1_OAEP_SHA3_384, PAD_PKCS1_OAEP_SHA3_512, PAD_PKCS1_OAEP_SHA384, PAD_PKCS1_OAEP_SHA512, PAD_PKCS1_PSS, PAD_PKCS5, PAD_RFC2409| Constructor and Description |
|---|
AuthenticatedSymmetricCipherImpl(byte algorithm) |
| Modifier and Type | Method and Description |
|---|---|
short |
doFinal(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
Generates encrypted/decrypted output from all/last input data.
|
byte |
getAlgorithm()
Gets the Cipher algorithm.
|
byte |
getCipherAlgorithm()
Gets the raw cipher algorithm.
|
byte |
getPaddingAlgorithm()
Gets the padding algorithm.
|
void |
init(javacard.security.Key theKey,
byte theMode)
Initializes the Cipher object with the appropriate Key.
|
void |
init(javacard.security.Key theKey,
byte theMode,
byte[] bArray,
short bOff,
short bLen)
Initializes the Cipher object with the appropriate Key and algorithm specific parameters.
|
void |
init(javacard.security.Key theKey,
byte theMode,
byte[] nonceBuf,
short nonceOff,
short nonceLen,
short adataLen,
short messageLen,
short tagSize)
Initializes this Cipher instance to encrypt or decrypt a with the given key, nonce, AAD size and message size.
|
short |
retrieveTag(byte[] tagBuf,
short tagOff,
short tagLen)
Retrieves tagLen bytes from the calculated authentication tag.
|
short |
update(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
Generates encrypted/decrypted output from input data.
|
void |
updateAAD(byte[] aadBuf,
short aadOff,
short aadLen)
Continues a multi-part update of the Additional Associated Data (AAD) that will be verified by the authentication tag.
|
boolean |
verifyTag(byte[] receivedTagBuf,
short receivedTagOff,
short receivedTagLen,
short requiredTagLen)
Verifies the authentication tag using the number of bits set in requiredTagLen bits.
|
public AuthenticatedSymmetricCipherImpl(byte algorithm)
public byte getAlgorithm()
getAlgorithm in class javacardx.crypto.Cipherpublic byte getCipherAlgorithm()
getCipherAlgorithm in class javacardx.crypto.Cipherpublic byte getPaddingAlgorithm()
getPaddingAlgorithm in class javacardx.crypto.Cipherpublic void init(javacard.security.Key theKey,
byte theMode)
throws javacard.security.CryptoException
init in class javacardx.crypto.AEADCiphertheKey - the key object to use for encrypting or decryptingtheMode - one of MODE_DECRYPT or MODE_ENCRYPTjavacard.security.CryptoException - with the following reason codes:
public void init(javacard.security.Key theKey,
byte theMode,
byte[] bArray,
short bOff,
short bLen)
throws javacard.security.CryptoException
init in class javacardx.crypto.AEADCiphertheKey - the key object to use for encrypting or decrypting.theMode - one of MODE_DECRYPT or MODE_ENCRYPTbArray - byte array containing algorithm specific initialization infobOff - offset within bArray where the algorithm specific data beginsbLen - byte length of algorithm specific parameter datajavacard.security.CryptoException - with the following reason codes: public void init(javacard.security.Key theKey,
byte theMode,
byte[] nonceBuf,
short nonceOff,
short nonceLen,
short adataLen,
short messageLen,
short tagSize)
throws javacard.security.CryptoException
init in class javacardx.crypto.AEADCiphertheKey - the key object to use for encrypting or decryptingtheMode - one of MODE_DECRYPT or MODE_ENCRYPTnonceBuf - a buffer holding the noncenonceOff - the offset in the buffer of the noncenonceLen - the length in the buffer of the nonceadataLen - the length of the authenticated data as presented in the updateAAD methodmessageLen - the length of the message as presented in the update and doFinal methodstagSize - the size in bytes of the authentication tagjavacard.security.CryptoException - with the following reason codes:
AEADCipher.init(Key, byte, byte[], short, short, short, short, short)public void updateAAD(byte[] aadBuf,
short aadOff,
short aadLen)
throws javacard.security.CryptoException
updateAAD in class javacardx.crypto.AEADCipheraadBuf - the buffer containing the AAD dataaadOff - the offset of the AAD data in the bufferaadLen - the length in bytes of the AAD data in the bufferjavacard.security.CryptoException - with the following reason codes: public short update(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
throws javacard.security.CryptoException
update in class javacardx.crypto.AEADCipherinBuff - the input buffer of data to be encrypted/decryptedinOffset - the offset into the input buffer at which to begin encryption/decryptioninLength - the byte length to be encrypted/decryptedoutBuff - the output buffer, may be the same as the input bufferoutOffset - the offset into the output buffer where the resulting ciphertext/plaintext beginsjavacard.security.CryptoException - with the following reason codes: public short doFinal(byte[] inBuff,
short inOffset,
short inLength,
byte[] outBuff,
short outOffset)
throws javacard.security.CryptoException
doFinal in class javacardx.crypto.AEADCipherinBuff - the input buffer of data to be encrypted/decryptedinOffset - the offset into the input buffer at which to begin encryption/decryptioninLength - the byte length to be encrypted/decryptedoutBuff - the output buffer, may be the same as the input bufferoutOffset - the offset into the output buffer where the resulting output data beginsjavacard.security.CryptoException - with the following reason codes:
public short retrieveTag(byte[] tagBuf,
short tagOff,
short tagLen)
throws javacard.security.CryptoException
retrieveTag in class javacardx.crypto.AEADCiphertagBuf - the buffer that will contain the authentication tagtagOff - the offset of the authentication tag in the buffertagLen - the length in bytes of the authentication tag in the bufferjavacard.security.CryptoException - with the following reason codes public boolean verifyTag(byte[] receivedTagBuf,
short receivedTagOff,
short receivedTagLen,
short requiredTagLen)
throws javacard.security.CryptoException
verifyTag in class javacardx.crypto.AEADCipherreceivedTagBuf - the buffer that will contain the received authentication tagreceivedTagOff - the offset of the received authentication tag in the bufferreceivedTagLen - the length in bytes of the received authentication tag in the bufferrequiredTagLen - the required length in bytes of the received authentication tag, usually a constant valuejavacard.security.CryptoException - with the following reason codes: