JDK-8272907 : Release Note: New SunPKCS11 Configuration Properties
  • Type: Sub-task
  • Component: security-libs
  • Sub-Component: javax.crypto:pkcs11
  • Affected Version:
    8u321,11.0.12.0.3-oracle,11.0.14-oracle,17 8u321,11.0.12.0.3-oracle,11.0.14-oracle,17
  • Priority: P4
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2021-08-24
  • Updated: 2022-06-24
  • Resolved: 2022-03-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 8
11.0.14-oracleResolved 17Resolved 8u321Resolved
Description
SunPKCS11 provider adds new provider configuration attributes to better control native resources usage. The SunPKCS11 provider consumes native resources in order to work with native PKCS11 libraries. To manage and better control the native resources, additional configuration attributes are added to control the frequency of clearing native references as well as whether to destroy the underlying PKCS11 Token after logout. 

The 3 new attributes for SunPKCS11 provider configuration file are: 
1) `destroyTokenAfterLogout` (boolean, defaults to false)
If set to true, when `java.security.AuthProvider.logout()` is called upon the SunPKCS11 provider instance, the underlying Token object will be destroyed and resources will be freed. This essentially renders the SunPKCS11 provider instance unusable after `logout()` calls. Note that a PKCS11 provider with this attribute set to `true` should not be added to the system provider list since the provider object is not usable after a `logout()` method call.

2) `cleaner.shortInterval` (integer, defaults to 2000, in milliseconds) 
This defines the frequency for clearing native references during busy period (such as, how often should the cleaner thread processes the no-longer-needed native references in the queue to free up native memory). Note that the cleaner thread will switch to the 'longInterval' frequency after 200 failed tries (such as, when no references are found in the queue).

3) `cleaner.longInterval` (integer, defaults to 60000, in milliseconds)
This defines the frequency for checking native reference during non-busy period (such as, how often should the cleaner thread check the queue for native references). Note that the cleaner thread will switch back to the 'shortInterval' value if native PKCS11 references for cleaning are detected.
Comments
I wonder if this may be a bit too much for release note. We should probably move most of these to the PKCS11 Provider Reference Guide and simply refer to the updated guide for the release note.
26-08-2021