diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-02-02 10:02:27 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-02-02 10:02:27 +0700 |
commit | ff9da799550851125944ea41e88dd6878ba52d7d (patch) | |
tree | 755fb8aa72c958f9a8a78d2f29c3be5d60e07e1b /crypto/test | |
parent | Refactoring in Crypto.Paddings (diff) | |
download | BouncyCastle.NET-ed25519-ff9da799550851125944ea41e88dd6878ba52d7d.tar.xz |
Refactoring in Tls.Tests
Diffstat (limited to 'crypto/test')
-rw-r--r-- | crypto/test/src/tls/test/PskTls13ClientTest.cs | 2 | ||||
-rw-r--r-- | crypto/test/src/tls/test/PskTlsClientTest.cs | 2 | ||||
-rw-r--r-- | crypto/test/src/tls/test/TlsClientRawKeysTest.cs | 2 | ||||
-rw-r--r-- | crypto/test/src/tls/test/TlsClientTest.cs | 2 | ||||
-rw-r--r-- | crypto/test/src/tls/test/TlsTestUtilities.cs | 9 |
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; |