changeset 42929:032d90a24440

6972386: issues with String.toLowerCase/toUpperCase Reviewed-by: weijun
author xuelei
date Thu, 22 Dec 2016 03:35:44 +0000
parents 6e6506080c2a
children b878b7b2788e
files jdk/src/java.base/share/classes/sun/security/provider/CtrDrbg.java jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java
diffstat 3 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.base/share/classes/sun/security/provider/CtrDrbg.java	Wed Dec 21 18:34:34 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/provider/CtrDrbg.java	Thu Dec 22 03:35:44 2016 +0000
@@ -80,7 +80,7 @@
     @Override
     protected void chooseAlgorithmAndStrength() {
         if (requestedAlgorithm != null) {
-            algorithm = requestedAlgorithm.toUpperCase();
+            algorithm = requestedAlgorithm.toUpperCase(Locale.ROOT);
             int supportedStrength = alg2strength(algorithm);
             if (requestedInstantiationSecurityStrength >= 0) {
                 int tryStrength = getStandardStrength(
--- a/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Wed Dec 21 18:34:34 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Thu Dec 22 03:35:44 2016 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1009,7 +1009,7 @@
      * @return the default alg, might be null if unsupported
      */
     public static String getDefaultSigAlgForKey(PrivateKey k) {
-        switch (k.getAlgorithm().toUpperCase()) {
+        switch (k.getAlgorithm().toUpperCase(Locale.ROOT)) {
             case "EC":
                 return ecStrength(KeyUtil.getKeySize(k))
                     + "withECDSA";
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java	Wed Dec 21 18:34:34 2016 -0800
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java	Thu Dec 22 03:35:44 2016 +0000
@@ -28,6 +28,7 @@
 import java.nio.ByteBuffer;
 import java.util.Set;
 import java.util.Arrays;
+import java.util.Locale;
 import java.util.concurrent.ConcurrentSkipListSet;
 import java.lang.ref.*;
 
@@ -262,7 +263,7 @@
         throws NoSuchAlgorithmException, NoSuchPaddingException {
         this.nc = nc;
         this.blockSize = nc.engineGetBlockSize();
-        if (paddingScheme.toUpperCase().equals("PKCS5PADDING")) {
+        if (paddingScheme.toUpperCase(Locale.ROOT).equals("PKCS5PADDING")) {
             padding = new PKCS5Padding(blockSize);
         } else {
             throw new NoSuchAlgorithmException("Unsupported padding scheme: " + paddingScheme);