@ThreadSafe public class LegacyAESGCM extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
AUTH_TAG_BIT_LENGTH
The standard authentication tag length (128 bits).
|
| Modifier and Type | Method and Description |
|---|---|
static org.bouncycastle.crypto.engines.AESEngine |
createAESCipher(SecretKey secretKey,
boolean forEncryption)
Creates a new AES cipher.
|
static byte[] |
decrypt(SecretKey secretKey,
byte[] iv,
byte[] cipherText,
byte[] authData,
byte[] authTag)
Decrypts the specified cipher text using AES/GCM/NoPadding.
|
static AuthenticatedCipherText |
encrypt(SecretKey secretKey,
byte[] iv,
byte[] plainText,
byte[] authData)
Encrypts the specified plain text using AES/GCM/NoPadding.
|
public static final int AUTH_TAG_BIT_LENGTH
public static org.bouncycastle.crypto.engines.AESEngine createAESCipher(SecretKey secretKey, boolean forEncryption)
secretKey - The AES key. Must not be null.forEncryption - If true creates an AES encryption
cipher, else creates an AES decryption
cipher.public static AuthenticatedCipherText encrypt(SecretKey secretKey, byte[] iv, byte[] plainText, byte[] authData) throws JOSEException
secretKey - The AES key. Must not be null.plainText - The plain text. Must not be null.iv - The initialisation vector (IV). Must not be
null.authData - The authenticated data. Must not be null.JOSEException - If encryption failed.public static byte[] decrypt(SecretKey secretKey, byte[] iv, byte[] cipherText, byte[] authData, byte[] authTag) throws JOSEException
secretKey - The AES key. Must not be null.iv - The initialisation vector (IV). Must not be
null.cipherText - The cipher text. Must not be null.authData - The authenticated data. Must not be null.authTag - The authentication tag. Must not be null.JOSEException - If decryption failed.Copyright © 2021 Connect2id Ltd.. All rights reserved.