summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-02-02 10:02:27 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-02-02 10:02:27 +0700
commitff9da799550851125944ea41e88dd6878ba52d7d (patch)
tree755fb8aa72c958f9a8a78d2f29c3be5d60e07e1b
parentRefactoring in Crypto.Paddings (diff)
downloadBouncyCastle.NET-ed25519-ff9da799550851125944ea41e88dd6878ba52d7d.tar.xz
Refactoring in Tls.Tests
-rw-r--r--crypto/test/src/tls/test/PskTls13ClientTest.cs2
-rw-r--r--crypto/test/src/tls/test/PskTlsClientTest.cs2
-rw-r--r--crypto/test/src/tls/test/TlsClientRawKeysTest.cs2
-rw-r--r--crypto/test/src/tls/test/TlsClientTest.cs2
-rw-r--r--crypto/test/src/tls/test/TlsTestUtilities.cs9
5 files changed, 6 insertions, 11 deletions
diff --git a/crypto/test/src/tls/test/PskTls13ClientTest.cs b/crypto/test/src/tls/test/PskTls13ClientTest.cs

index 0850fca7d..07778f5d0 100644 --- a/crypto/test/src/tls/test/PskTls13ClientTest.cs +++ b/crypto/test/src/tls/test/PskTls13ClientTest.cs
@@ -50,7 +50,7 @@ namespace Org.BouncyCastle.Tls.Tests { Console.WriteLine("<<< " + line); - string upperLine = TlsTestUtilities.ToUpperInvariant(line); + string upperLine = line.ToUpperInvariant(); // TEST CODE ONLY. This is not a robust way of parsing the result! foreach (string end in ends) diff --git a/crypto/test/src/tls/test/PskTlsClientTest.cs b/crypto/test/src/tls/test/PskTlsClientTest.cs
index d3c13ccee..35c4a7aa5 100644 --- a/crypto/test/src/tls/test/PskTlsClientTest.cs +++ b/crypto/test/src/tls/test/PskTlsClientTest.cs
@@ -78,7 +78,7 @@ namespace Org.BouncyCastle.Tls.Tests { Console.WriteLine("<<< " + line); - string upperLine = TlsTestUtilities.ToUpperInvariant(line); + string upperLine = line.ToUpperInvariant(); // TEST CODE ONLY. This is not a robust way of parsing the result! foreach (string end in ends) diff --git a/crypto/test/src/tls/test/TlsClientRawKeysTest.cs b/crypto/test/src/tls/test/TlsClientRawKeysTest.cs
index 510213fc7..f607dba04 100644 --- a/crypto/test/src/tls/test/TlsClientRawKeysTest.cs +++ b/crypto/test/src/tls/test/TlsClientRawKeysTest.cs
@@ -64,7 +64,7 @@ namespace Org.BouncyCastle.Tls.Tests { Console.WriteLine("<<< " + line); - string upperLine = TlsTestUtilities.ToUpperInvariant(line); + string upperLine = line.ToUpperInvariant(); // TEST CODE ONLY. This is not a robust way of parsing the result! foreach (string end in ends) diff --git a/crypto/test/src/tls/test/TlsClientTest.cs b/crypto/test/src/tls/test/TlsClientTest.cs
index 65adc5dd7..eaf2ad8e2 100644 --- a/crypto/test/src/tls/test/TlsClientTest.cs +++ b/crypto/test/src/tls/test/TlsClientTest.cs
@@ -62,7 +62,7 @@ namespace Org.BouncyCastle.Tls.Tests { Console.WriteLine("<<< " + line); - string upperLine = TlsTestUtilities.ToUpperInvariant(line); + string upperLine = line.ToUpperInvariant(); // TEST CODE ONLY. This is not a robust way of parsing the result! foreach (string end in ends) diff --git a/crypto/test/src/tls/test/TlsTestUtilities.cs b/crypto/test/src/tls/test/TlsTestUtilities.cs
index 3baf233c7..789a5b513 100644 --- a/crypto/test/src/tls/test/TlsTestUtilities.cs +++ b/crypto/test/src/tls/test/TlsTestUtilities.cs
@@ -46,12 +46,7 @@ namespace Org.BouncyCastle.Tls.Tests internal static bool EqualsIgnoreCase(string a, string b) { - return ToUpperInvariant(a) == ToUpperInvariant(b); - } - - internal static string ToUpperInvariant(string s) - { - return s.ToUpper(CultureInfo.InvariantCulture); + return string.Equals(a, b, StringComparison.InvariantCultureIgnoreCase); } internal static string Fingerprint(X509CertificateStructure c) @@ -59,7 +54,7 @@ namespace Org.BouncyCastle.Tls.Tests byte[] der = c.GetEncoded(); byte[] hash = Sha256DigestOf(der); byte[] hexBytes = Hex.Encode(hash); - string hex = ToUpperInvariant(Encoding.ASCII.GetString(hexBytes)); + string hex = Encoding.ASCII.GetString(hexBytes).ToUpperInvariant(); StringBuilder fp = new StringBuilder(); int i = 0;