This is an automated email from the ASF dual-hosted git repository. sergeyb 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 1236b09 Hack to fix CryptoUtils test on 1.8.0_161 or later 1236b09 is described below commit 1236b09b624194304071063670580f14e49b6cc3 Author: Sergey Beryozkin <sberyoz...@gmail.com> AuthorDate: Thu Jan 25 18:05:51 2018 +0000 Hack to fix CryptoUtils test on 1.8.0_161 or later --- .../main/java/org/apache/cxf/rt/security/crypto/CryptoUtils.java | 8 +++++++- 1 file changed, 7 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 94f651f..5971128 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 @@ -544,10 +544,12 @@ public final class CryptoUtils { result = c.doFinal(bytes); } else { if (blockSize == -1) { - if (System.getProperty("java.version").startsWith("9")) { + String javaVersion = System.getProperty("java.version"); + if (javaVersion.startsWith("9") || isJava8Release161OrLater(javaVersion)) { //the default block size is 256 when use private key under java9 blockSize = secretKey instanceof PublicKey ? 117 : 256; } else { + blockSize = secretKey instanceof PublicKey ? 117 : 128; } } @@ -573,6 +575,10 @@ public final class CryptoUtils { } } + private static boolean isJava8Release161OrLater(String javaVersion) { + return javaVersion.startsWith("1.8.0_") && Integer.valueOf(javaVersion.substring(6)) >= 161; + } + public static Cipher initCipher(Key secretKey, KeyProperties keyProps, int mode) throws SecurityException { try { String algorithm = keyProps != null && keyProps.getKeyAlgo() != null -- To stop receiving notification emails like this one, please contact serg...@apache.org.