8325254: CKA_TOKEN private and secret keys are not necessarily sensitive

Reviewed-by: valeriep
This commit is contained in:
Martin Balao 2024-02-06 19:49:30 +00:00
parent 4b1e367eda
commit 0f5f3c9b97

View File

@ -395,8 +395,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,