Skip to content

Commit c80bb72

Browse files
committed
8325254: CKA_TOKEN private and secret keys are not necessarily sensitive
Backport-of: 0f5f3c9b9718c610406088327401210486447462
1 parent e69b611 commit c80bb72

File tree

1 file changed

+3
-2
lines changed
  • src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11

1 file changed

+3
-2
lines changed

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,9 @@ static PrivateKey privateKey(Session session, long keyID, String algorithm,
401401
new CK_ATTRIBUTE(CKA_EXTRACTABLE),
402402
});
403403

404-
boolean keySensitive = (attrs[0].getBoolean() ||
405-
attrs[1].getBoolean() || !attrs[2].getBoolean());
404+
boolean keySensitive =
405+
(attrs[0].getBoolean() && P11Util.isNSS(session.token)) ||
406+
attrs[1].getBoolean() || !attrs[2].getBoolean();
406407

407408
return switch (algorithm) {
408409
case "RSA" -> P11RSAPrivateKeyInternal.of(session, keyID, algorithm,

0 commit comments

Comments
 (0)