byte[] iv = Base64Url.decode(encodedIv);
byte[] cipherText = Base64Url.decode(encodedCipherText);
byte[] authTag = Base64Url.decode(encodedAuthTag);
// Decrypt the cipher text according to the JWE enc
EncryptionMethod enc = readOnlyJWEHeader.getEncryptionMethod();
byte[] plainText;
if (enc.equals(EncryptionMethod.A128CBC_HS256) || enc.equals(EncryptionMethod.A256CBC_HS512))
{
plainText = AESCBC.decryptAuthenticated(key, iv, cipherText, aad, authTag);
}
else if (enc.equals(EncryptionMethod.A128GCM) || enc.equals(EncryptionMethod.A256GCM))
{
plainText = AESGCM.decrypt(key, iv, cipherText, aad, authTag);
}