8325254: CKA_TOKEN private and secret keys are not necessarily sensitive

Backport-of: 0f5f3c9b97
This commit is contained in:
Martin Balao
2024-02-23 07:43:47 +00:00
committed by Vitaly Provodin
parent d24c6f2a88
commit 6fe25eff11

View File

@@ -401,8 +401,9 @@ abstract class P11Key implements Key, Length {
new CK_ATTRIBUTE(CKA_EXTRACTABLE),
});
boolean keySensitive = (attrs[0].getBoolean() ||
attrs[1].getBoolean() || !attrs[2].getBoolean());
boolean keySensitive =
(attrs[0].getBoolean() && P11Util.isNSS(session.token)) ||
attrs[1].getBoolean() || !attrs[2].getBoolean();
return switch (algorithm) {
case "RSA" -> P11RSAPrivateKeyInternal.of(session, keyID, algorithm,