Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1882185

Summary: java-1.8.0-openjdk / rhel-8: system crypto policy fails to increase DH key size
Product: Red Hat Enterprise Linux 8 Reporter: zzambers
Component: java-1.8.0-openjdkAssignee: Andrew John Hughes <ahughes>
Status: CLOSED WONTFIX QA Contact: OpenJDK QA <java-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: ahughes, java-qa, jvanek
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1882168 Environment:
Last Closed: 2022-03-24 07:27:24 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: 1882168, 1882178, 1883312    
Bug Blocks:    

Description zzambers 2020-09-24 01:48:58 UTC
+++ This bug was initially created as a clone of Bug #1882168 +++

Problem:
System crypto policy fails to increase DH key size [1], based on crypto policy requirements [2].

Seems like crypto-policies are actually trying to increase DH key size using jdk.tls.ephemeralDHKeySize property:
cat /etc/crypto-policies/back-ends/java.config | grep DHKeySize
jdk.tls.ephemeralDHKeySize=2048

However this property is not applied since this property ends up in Security properties [3], but it needs to be in System properties [4] to be applied.

Issue was discovered wile running ssl-tests [5] in FIPS mode, where crypto policy fails to set bigger key size, but constrains on key size as enforced by nss (used by pkcs11 provider) are causing this exception:

Caused by: java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_ARGUMENTS_BAD
    at sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair(P11KeyPairGenerator.java:424)
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:697)
    at sun.security.ssl.DHKeyExchange$DHEPossession.generateDHKeyPair(DHKeyExchange.java:181)
    at sun.security.ssl.DHKeyExchange$DHEPossession.<init>(DHKeyExchange.java:139)
    at sun.security.ssl.DHKeyExchange$DHEPossessionGenerator.createPossession(DHKeyExchange.java:389
...
FAILED: SunJSSE/Default: TLSv1.2 + TLS_DHE_RSA_WITH_AES_256_CBC_SHA256

(This one was thrown on servers side, I am not sure if exception can also be thrown on client side.)


Workaround:
Set this property manually using command line argument, eg.:
java -Djdk.tls.ephemeralDHKeySize=2048 ...


[1] https://hg.openjdk.java.net/jdk-updates/jdk11u/file/e16ef8c081c6/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java#l318
[2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening
[3] https://docs.oracle.com/javase/8/docs/api/java/security/Security.html
[4] https://docs.oracle.com/javase/8/docs/api/java/lang/System.html
[5] https://github.com/zzambers/ssl-tests

--- Additional comment from  on 2020-09-24 03:01:15 CEST ---

But it seems there is also bug in LEGACY crypto policy (invalid key size of 1023):

cat /usr/share/crypto-policies/LEGACY/java.txt | grep DHKeySize
jdk.tls.ephemeralDHKeySize=1023

which would cause this exception, if it was actually used:

Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
	at sun.security.ssl.DHKeyExchange.<clinit>(DHKeyExchange.java:57)
	at sun.security.ssl.SSLKeyExchange$T12KeyAgreement.<clinit>(SSLKeyExchange.java:348)
	at sun.security.ssl.SSLKeyExchange$1.<clinit>(SSLKeyExchange.java:411)
	at sun.security.ssl.SSLKeyExchange.valueOf(SSLKeyExchange.java:203)
	at sun.security.ssl.ServerHello$T12ServerHelloProducer.chooseCipherSuite(ServerHello.java:421)
	at sun.security.ssl.ServerHello$T12ServerHelloProducer.produce(ServerHello.java:295)
	at sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:421)
	at sun.security.ssl.ClientHello$T12ClientHelloConsumer.consume(ClientHello.java:1020)
	at sun.security.ssl.ClientHello$ClientHelloConsumer.onClientHello(ClientHello.java:727)
	at sun.security.ssl.ClientHello$ClientHelloConsumer.consume(ClientHello.java:693)
	at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
	at sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
	at sun.security.ssl.SSLTransport.decode(SSLTransport.java:149)
	at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1143)
	at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1054)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:394)
	at sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:708)
	at sun.security.ssl.SSLSocketImpl.access$100(SSLSocketImpl.java:72)
	at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:791)
	at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:750)
	at SSLSocketServer.serverLoop(SSLSocketServer.java:132)
	at SSLSocketServer$1.run(SSLSocketServer.java:74)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Unsupported customized DH key size: 1023. The key size must be multiple of 64, and range from 1024 to 8192 (inclusive)
	at sun.security.ssl.DHKeyExchange$DHEPossessionGenerator.<clinit>(DHKeyExchange.java:280)
	... 25 more

[1] https://hg.openjdk.java.net/jdk-updates/jdk11u/file/e16ef8c081c6/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java#l280

Comment 1 Andrew John Hughes 2020-09-28 17:52:33 UTC
Same as with bug 1882168; we need a common dependent crypto-policies bug.

Comment 4 RHEL Program Management 2022-03-24 07:27:24 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.