You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2022/06/11 21:03:20 UTC

[cxf] branch master updated: Fixing CryptoUtilsTest & CryptoUtils: RSA key size change from 2048 to 3072 bits in JDK-19

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f092abe0c Fixing CryptoUtilsTest & CryptoUtils: RSA key size change from 2048 to 3072 bits in JDK-19
6f092abe0c is described below

commit 6f092abe0c542b54864754446410ed7402ba574f
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sat Jun 11 17:03:03 2022 -0400

    Fixing CryptoUtilsTest & CryptoUtils: RSA key size change from 2048 to 3072 bits in JDK-19
---
 .../src/main/java/org/apache/cxf/rt/security/crypto/CryptoUtils.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rt/security/src/main/java/org/apache/cxf/rt/security/crypto/CryptoUtils.java b/rt/security/src/main/java/org/apache/cxf/rt/security/crypto/CryptoUtils.java
index 8b135bb2d8..847200bcda 100644
--- a/rt/security/src/main/java/org/apache/cxf/rt/security/crypto/CryptoUtils.java
+++ b/rt/security/src/main/java/org/apache/cxf/rt/security/crypto/CryptoUtils.java
@@ -558,9 +558,12 @@ public final class CryptoUtils {
                 if (blockSize == -1) {
                     if (JavaUtils.isJava8Before161()) {
                         blockSize = secretKey instanceof PublicKey ? 117 : 128;
-                    } else {
+                    } else if (JavaUtils.getJavaMajorVersion() < 19) {
                         //the default block size is 256 when use private key under java9
                         blockSize = secretKey instanceof PublicKey ? 117 : 256;
+                    } else {
+                        //the default block size is 384 when use private key after java19
+                        blockSize = secretKey instanceof PublicKey ? 117 : 384;
                     }
                 }
                 boolean updateRequired = keyProps != null && keyProps.getAdditionalData() != null;