The goal of this enhancement is to support PKCS#12 keystores in FIPS mode. In order to accomplish that, we need to extend the SunPKCS11 security provider to implement Password-Based encryption algorithms (PBE). These algorithms enable key derivation (from a human-readable password) for data encryption and authentication.
We aim to leverage on defined PKCS#11 PBE mechanisms as much as possible, instead of calling low-level crypto primitives (such as hash functions) directly. We might use low-level crypto primitives if there is no other way around. In any case, it's required that the NSS Software Token (SunPKCS11 back-end for FIPS) implements the mechanisms chosen. Depending on the case and needs, we might consider NSS Software Token custom mechanisms that are not part of the PKCS#11 standard -this type of mechanisms is used already in OpenJDK-.
The version of the PKCS#11 standard in which we will based this work is v3.0. However, we will analyze potential backward-compatibility issues and see if older NSS libraries (available in RHEL versions supported) could be affected.
To prioritize which PBE mechanisms to implement, we will focus on those required for PKCS#12 keystores that are current. As an example, we will prioritize OpenJDK-defined 'PBEWithHmacSHA256AndAES_256' and 'HmacPBESHA256' which are Keytool defaults for encryption and authentication respectively when dealing with PKCS#12 keystores. Legacy mechanisms might be implemented on a best-effort basis. The rationale for that is that legacy algorithms are discouraged, they might not be FIPS-compliant and keystore migration should be feasible at a reasonable cost.
It is worth noticing that the code to handle the PKCS#12 format is already implemented in the SunJCE security provider. This code gets cryptographic services by means of the Java Cryptographic Architecture (JCA), to which SunPKCS12 will now provide implementations. Using SunJCE for PKCS#12 handling should be fine under FIPS mode because no crypto transformations are applied there: it's ASN.1 binary-format parsing. However, this implies that we need to install the SunJCE security provider in FIPS mode with enough granularity to disable all other non-PKCS#12 services.
Even when the FIPS configuration is Red Hat downstream only, the extension of the SunPKCS11 security provider will be proposed to OpenJDK upstream.
Useful pointers:
* PKCS #12: Personal Information Exchange Syntax v1.1 (RFC 7292)
* https://datatracker.ietf.org/doc/html/rfc7292
* PKCS #5: Password-Based Cryptography Specification v2.1 (RFC 8018)
* https://datatracker.ietf.org/doc/html/rfc8018
* PKCS #11 standard (v3.0)
* https://docs.oasis-open.org/pkcs11/pkcs11-curr/v3.0/
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (java-17-openjdk bug fix and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2022:6691