RFR: 8356087: Problematic KeyInfo check using key algorithm in P11SecretKeyFactory class

Valerie Peng valeriep at openjdk.org
Wed May 7 22:29:03 UTC 2025


In the PR for JDK-8348732 "SunJCE and SunPKCS11 have different PBE key encodings", the `P11SecretKeyFactory.convertKey(...)` method is refactored to call `getKeyInfo(keyAlgo)` and check that it's not `null`. However, this leads to problems for the `P11Mac` object when it's initialized with a key whose algorithm is not recognized by SunPKCS11 provider. It fails with an unexpected `InvalidKeyException`. Thus, reverting back to the pre-JDK8348732 code and calls `getKeyInfo(keyAlgo)` only when needed.

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

Commit messages:
 - reuse si if keyAlgo == svcAlgo
 - 8356087: Problematic KeyInfo check using key algorithm in P11SecretKeyFactory class

Changes: https://git.openjdk.org/jdk/pull/25108/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25108&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8356087
  Stats: 83 lines in 2 files changed: 67 ins; 8 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/25108.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25108/head:pull/25108

PR: https://git.openjdk.org/jdk/pull/25108


More information about the security-dev mailing list