[jdk17] RFR: 8265500: Some impls of javax.crypto.Cipher.init() do not throw UnsupportedOperationExc for unsupported modes

Xue-Lei Andrew Fan xuelei at openjdk.java.net
Wed Jun 16 17:49:52 UTC 2021


On Tue, 15 Jun 2021 22:37:29 GMT, Valerie Peng <valeriep at openjdk.org> wrote:

> Could someone please help review this trivial fix? The real changes are the two PKCS11 cipher impl classes under src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/. The rest of classes are just cleanups, e.g. dead code or unused code. The test/jdk/javax/crypto/Cipher/TestCipherMode.java is updated to cover more cipher impls for completeness sake. It passes without this fix, so I only add the bug id to the the other test, i.e. test/jdk/sun/security/pkcs11/Cipher/TestCipherMode.java, which verifies the PKCS#11 cipher impls.
> 
> Thanks,
> Valerie

Looks good to me.

Marked as reviewed by xuelei (Reviewer).

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11AEADCipher.java line 365:

> 363:             default:
> 364:                 // should never happen; checked by Cipher.init()
> 365:                 throw new AssertionError("Unknown mode: " + opmode);

This update looks good to me.  But there is a potential issues, maybe for all switch statements.  If the cipher modes is extended to support more items, we may have to look for and update all the switch uses and make sure there is no broken.  Anyway, for my personal understanding, there is nothing we could do right now.

-------------

PR: https://git.openjdk.java.net/jdk17/pull/69



More information about the security-dev mailing list