{
cipher.init(Cipher.ENCRYPT_MODE, encryptionKey, new IvParameterSpec(iv));
}
catch (InvalidKeyException e)
{
throw new JoseException("Invalid key for " + getJavaAlgorithm(), e);
}
catch (InvalidAlgorithmParameterException e)
{
throw new JoseException(e.toString(), e);
}
byte[] cipherText;
try
{
cipherText = cipher.doFinal(plaintext);
}
catch (IllegalBlockSizeException | BadPaddingException e)
{
throw new JoseException(e.toString(), e);
}
Mac mac = MacUtil.getInitializedMac(getHmacJavaAlgorithm(), hmacKey);
byte[] al = getAdditionalAuthenticatedDataLengthBytes(aad);