diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java index 7ab89ed1e46..bb29773630e 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java @@ -324,6 +324,9 @@ final class P11AEADCipher extends CipherSpi { try { initialize(); } catch (PKCS11Exception e) { + if (e.getErrorCode() == CKR_MECHANISM_PARAM_INVALID) { + throw new InvalidAlgorithmParameterException("Bad params", e); + } throw new InvalidKeyException("Could not initialize cipher", e); } }