mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8282279: Interpret case-insensitive string locale independently
Reviewed-by: weijun
This commit is contained in:
parent
5035bf5e6c
commit
340a35d835
5 changed files with 18 additions and 13 deletions
|
@ -39,6 +39,7 @@ import java.security.spec.AlgorithmParameterSpec;
|
|||
import java.util.AbstractMap.SimpleImmutableEntry;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
|
@ -430,7 +431,8 @@ enum SSLCipher {
|
|||
for (String entry : propvalue) {
|
||||
int index;
|
||||
// If this is not a UsageLimit, goto to next entry.
|
||||
String[] values = entry.trim().toUpperCase().split(" ");
|
||||
String[] values =
|
||||
entry.trim().toUpperCase(Locale.ENGLISH).split(" ");
|
||||
|
||||
if (values[1].contains(tag[0])) {
|
||||
index = 0;
|
||||
|
@ -1865,10 +1867,10 @@ enum SSLCipher {
|
|||
this.random = random;
|
||||
|
||||
keyLimitCountdown = cipherLimits.getOrDefault(
|
||||
algorithm.toUpperCase() + ":" + tag[0], 0L);
|
||||
algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0], 0L);
|
||||
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
|
||||
SSLLogger.fine("KeyLimit read side: algorithm = " +
|
||||
algorithm.toUpperCase() + ":" + tag[0] +
|
||||
algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0] +
|
||||
"\ncountdown value = " + keyLimitCountdown);
|
||||
}
|
||||
if (keyLimitCountdown > 0) {
|
||||
|
@ -2019,10 +2021,10 @@ enum SSLCipher {
|
|||
this.random = random;
|
||||
|
||||
keyLimitCountdown = cipherLimits.getOrDefault(
|
||||
algorithm.toUpperCase() + ":" + tag[0], 0L);
|
||||
algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0], 0L);
|
||||
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
|
||||
SSLLogger.fine("KeyLimit write side: algorithm = "
|
||||
+ algorithm.toUpperCase() + ":" + tag[0] +
|
||||
+ algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0] +
|
||||
"\ncountdown value = " + keyLimitCountdown);
|
||||
}
|
||||
if (keyLimitCountdown > 0) {
|
||||
|
@ -2279,9 +2281,9 @@ enum SSLCipher {
|
|||
this.random = random;
|
||||
|
||||
keyLimitCountdown = cipherLimits.getOrDefault(
|
||||
algorithm.toUpperCase() + ":" + tag[0], 0L);
|
||||
algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0], 0L);
|
||||
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
|
||||
SSLLogger.fine("algorithm = " + algorithm.toUpperCase() +
|
||||
SSLLogger.fine("algorithm = " + algorithm.toUpperCase(Locale.ENGLISH) +
|
||||
":" + tag[0] + "\ncountdown value = " +
|
||||
keyLimitCountdown);
|
||||
}
|
||||
|
@ -2561,9 +2563,9 @@ enum SSLCipher {
|
|||
this.random = random;
|
||||
|
||||
keyLimitCountdown = cipherLimits.getOrDefault(
|
||||
algorithm.toUpperCase() + ":" + tag[0], 0L);
|
||||
algorithm.toUpperCase(Locale.ENGLISH) + ":" + tag[0], 0L);
|
||||
if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
|
||||
SSLLogger.fine("algorithm = " + algorithm.toUpperCase() +
|
||||
SSLLogger.fine("algorithm = " + algorithm.toUpperCase(Locale.ENGLISH) +
|
||||
":" + tag[0] + "\ncountdown value = " +
|
||||
keyLimitCountdown);
|
||||
}
|
||||
|
|
|
@ -783,7 +783,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
|
|||
for (String usage : usages) {
|
||||
|
||||
boolean match = false;
|
||||
switch (usage.toLowerCase()) {
|
||||
switch (usage.toLowerCase(Locale.ENGLISH)) {
|
||||
case "tlsserver":
|
||||
match = variant.equals(Validator.VAR_TLS_SERVER);
|
||||
break;
|
||||
|
|
|
@ -140,7 +140,8 @@ public final class SecurityProviderConstants {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
String algoName = algoAndValue[0].trim().toUpperCase();
|
||||
String algoName =
|
||||
algoAndValue[0].trim().toUpperCase(Locale.ENGLISH);
|
||||
int value = -1;
|
||||
try {
|
||||
value = Integer.parseInt(algoAndValue[1].trim());
|
||||
|
|
|
@ -386,7 +386,8 @@ public class SignatureFileVerifier {
|
|||
.jarConstraints().permits(algorithm, params, false);
|
||||
} catch (GeneralSecurityException e) {
|
||||
permittedAlgs.put(algorithm, Boolean.FALSE);
|
||||
permittedAlgs.put(key.toUpperCase(), Boolean.FALSE);
|
||||
permittedAlgs.put(key.toUpperCase(Locale.ENGLISH),
|
||||
Boolean.FALSE);
|
||||
if (debug != null) {
|
||||
if (e.getMessage() != null) {
|
||||
debug.println(key + ": " + e.getMessage());
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.security.cert.CertificateEncodingException;
|
|||
import java.security.cert.X509Certificate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This class implements the Channel Binding for TLS as defined in
|
||||
|
@ -101,7 +102,7 @@ public class TlsChannelBinding {
|
|||
final byte[] prefix =
|
||||
TlsChannelBindingType.TLS_SERVER_END_POINT.getName().concat(":").getBytes();
|
||||
String hashAlg = serverCertificate.getSigAlgName().
|
||||
replace("SHA", "SHA-").toUpperCase();
|
||||
replace("SHA", "SHA-").toUpperCase(Locale.ENGLISH);
|
||||
int ind = hashAlg.indexOf("WITH");
|
||||
if (ind > 0) {
|
||||
hashAlg = hashAlg.substring(0, ind);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue