Bug 2048582

Summary: Support PKCS#12 keystores in FIPS mode [rhel-8, openjdk-17]
Product: Red Hat Enterprise Linux 8 Reporter: Martin Balao <mbalao>
Component: java-17-openjdkAssignee: Martin Balao <mbalao>
Status: CLOSED ERRATA QA Contact: OpenJDK QA <java-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 8.6CC: ableisch, ahughes, anli, fferrari, ggrzybek, jandrlik, jscholz, jvanek, mmillson, sfroberg, sgehwolf, zzambers
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: java-17-openjdk-17.0.4.1.1-3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2123568 2123569 (view as bug list) Environment:
Last Closed: 2022-11-08 09:30:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2023467    
Bug Blocks: 2123568, 2123569, 2130351    

Description Martin Balao 2022-01-31 14:48:33 UTC
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/

Comment 16 errata-xmlrpc 2022-11-08 09:30:31 UTC
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