-
Bug
-
Resolution: Fixed
-
P3
-
7, 8, 11, 17
-
b28
-
solaris
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8269043 | 18 | Valerie Peng | P3 | Resolved | Fixed | b03 |
JDK-8270581 | 17.0.1 | Valerie Peng | P3 | Resolved | Fixed | b03 |
Looks like the Cipher init methods throw InvalidAlgorithmParameterException instead of UnsupportedOperationException when an unsupported mode is encountered. The SunPKCS11 provider is the example here:
The SunPKCS11 provider's implementation of Cipher.init() method does not seem to align with the spec. According to the spec:
"
UnsupportedOperationException - if opmode is WRAP_MODE or UNWRAP_MODE but the mode is not implemented by the underlying CipherSpi.
"
However, the attached code throws the following exception:
-----------------------------------------------------
java.security.InvalidAlgorithmParameterException: Unsupported mode: 3
at jdk.crypto.cryptoki/sun.security.pkcs11.P11Cipher.implInit(P11Cipher.java:359)
at jdk.crypto.cryptoki/sun.security.pkcs11.P11Cipher.engineInit(P11Cipher.java:320)
at java.base/javax.crypto.Cipher.init(Cipher.java:1431)
at java.base/javax.crypto.Cipher.init(Cipher.java:1364)
at KeywrapTest.main(KeywrapTest.java:20)
-----------------------------------------------------
It seems like an InvalidAlgorithmParameterException is thrown instead of the UnsupportedOperationException?
The SunPKCS11 provider's implementation of Cipher.init() method does not seem to align with the spec. According to the spec:
"
UnsupportedOperationException - if opmode is WRAP_MODE or UNWRAP_MODE but the mode is not implemented by the underlying CipherSpi.
"
However, the attached code throws the following exception:
-----------------------------------------------------
java.security.InvalidAlgorithmParameterException: Unsupported mode: 3
at jdk.crypto.cryptoki/sun.security.pkcs11.P11Cipher.implInit(P11Cipher.java:359)
at jdk.crypto.cryptoki/sun.security.pkcs11.P11Cipher.engineInit(P11Cipher.java:320)
at java.base/javax.crypto.Cipher.init(Cipher.java:1431)
at java.base/javax.crypto.Cipher.init(Cipher.java:1364)
at KeywrapTest.main(KeywrapTest.java:20)
-----------------------------------------------------
It seems like an InvalidAlgorithmParameterException is thrown instead of the UnsupportedOperationException?
- backported by
-
JDK-8269043 Some impls of javax.crypto.Cipher.init() do not throw UnsupportedOperationExc for unsupported modes
- Resolved
-
JDK-8270581 Some impls of javax.crypto.Cipher.init() do not throw UnsupportedOperationExc for unsupported modes
- Resolved