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

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

commit e677408bc243a8494d711ff93be05a159f692144
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Thu Apr 19 10:21:43 2018 +0100

    Updating CryptoUtils to work with Java 10
---
 .../java/org/apache/cxf/rt/security/crypto/CryptoUtils.java    | 10 +++++++++-
 1 file changed, 9 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 e1e62cf..20475a9 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
@@ -545,7 +545,7 @@ public final class CryptoUtils {
             } else {
                 if (blockSize == -1) {
                     String javaVersion = System.getProperty("java.version");
-                    if (javaVersion.startsWith("9") || 
isJava8Release161OrLater(javaVersion)) {
+                    if (isJava9Compatible(javaVersion) || 
isJava8Release161OrLater(javaVersion)) {
                         //the default block size is 256 when use private key 
under java9
                         blockSize = secretKey instanceof PublicKey ? 117 : 256;
                     } else {
@@ -575,6 +575,14 @@ public final class CryptoUtils {
         }
     }
 
+    private static boolean isJava9Compatible(String javaVersion) {
+        if (javaVersion.indexOf(".") > 0) {
+            javaVersion = javaVersion.substring(0, javaVersion.indexOf("."));
+        }
+
+        return Integer.valueOf(javaVersion) >= 9;
+    }
+
     private static boolean isJava8Release161OrLater(String javaVersion) {
         return javaVersion.startsWith("1.8.0_") && 
Integer.parseInt(javaVersion.substring(6)) >= 161;
     }

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to