summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@gmail.com>2022-06-21 10:46:09 +0700
committerPeter Dettman <peter.dettman@gmail.com>2022-06-21 10:46:09 +0700
commit522deaf74c9c119d360ebf42ca9b803eab029434 (patch)
treedbd0274ae5151e9fdf2680560c6c16d9f08a9b2e
parentAlternative for GetExecutingAssembly (diff)
downloadBouncyCastle.NET-ed25519-522deaf74c9c119d360ebf42ca9b803eab029434.tar.xz
Update defines
-rw-r--r--crypto/src/util/Platform.cs6
-rw-r--r--crypto/test/src/crypto/tls/test/TlsTestUtilities.cs14
-rw-r--r--crypto/test/src/security/test/TestSignerUtil.cs6
-rw-r--r--crypto/test/src/test/BlockCipherTest.cs17
-rw-r--r--crypto/test/src/tls/test/TlsTestUtilities.cs6
5 files changed, 26 insertions, 23 deletions
diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs
index 040b0786e..547cef3fa 100644
--- a/crypto/src/util/Platform.cs
+++ b/crypto/src/util/Platform.cs
@@ -181,10 +181,10 @@ namespace Org.BouncyCastle.Utilities
 
         internal static string ToUpperInvariant(string s)
         {
-#if NET_1_1
-            return s.ToUpper(CultureInfo.InvariantCulture);
-#else
+#if PORTABLE
             return s.ToUpperInvariant();
+#else
+            return s.ToUpper(CultureInfo.InvariantCulture);
 #endif
         }
 
diff --git a/crypto/test/src/crypto/tls/test/TlsTestUtilities.cs b/crypto/test/src/crypto/tls/test/TlsTestUtilities.cs
index 709c720a8..27d7c913a 100644
--- a/crypto/test/src/crypto/tls/test/TlsTestUtilities.cs
+++ b/crypto/test/src/crypto/tls/test/TlsTestUtilities.cs
@@ -45,19 +45,21 @@ namespace Org.BouncyCastle.Crypto.Tls.Tests
             byte[] der = c.GetEncoded();
             byte[] sha1 = Sha256DigestOf(der);
             byte[] hexBytes = Hex.Encode(sha1);
-#if NET_1_1
-            string hex = Encoding.ASCII.GetString(hexBytes).ToUpper(CultureInfo.InvariantCulture);
+
+            string hex = Encoding.ASCII.GetString(hexBytes);
+#if PORTABLE
+            string upper = hex.ToUpperInvariant();
 #else
-            string hex = Encoding.ASCII.GetString(hexBytes).ToUpperInvariant();
+            string upper = hex.ToUpper(CultureInfo.InvariantCulture);
 #endif
 
             StringBuilder fp = new StringBuilder();
             int i = 0;
-            fp.Append(hex.Substring(i, 2));
-            while ((i += 2) < hex.Length)
+            fp.Append(upper.Substring(i, 2));
+            while ((i += 2) < upper.Length)
             {
                 fp.Append(':');
-                fp.Append(hex.Substring(i, 2));
+                fp.Append(upper.Substring(i, 2));
             }
             return fp.ToString();
         }
diff --git a/crypto/test/src/security/test/TestSignerUtil.cs b/crypto/test/src/security/test/TestSignerUtil.cs
index cc9cd2900..f075526b0 100644
--- a/crypto/test/src/security/test/TestSignerUtil.cs
+++ b/crypto/test/src/security/test/TestSignerUtil.cs
@@ -142,10 +142,10 @@ namespace Org.BouncyCastle.Security.Tests
             {
                 ISigner signer = SignerUtilities.GetSigner(algorithm);
 
-#if NET_1_1
-                string upper = algorithm.ToUpper(CultureInfo.InvariantCulture);
-#else
+#if PORTABLE
                 string upper = algorithm.ToUpperInvariant();
+#else
+                string upper = algorithm.ToUpper(CultureInfo.InvariantCulture);
 #endif
                 int withPos = upper.LastIndexOf("WITH");
 
diff --git a/crypto/test/src/test/BlockCipherTest.cs b/crypto/test/src/test/BlockCipherTest.cs
index 7e8e38c40..d14988940 100644
--- a/crypto/test/src/test/BlockCipherTest.cs
+++ b/crypto/test/src/test/BlockCipherTest.cs
@@ -458,19 +458,19 @@ namespace Org.BouncyCastle.Tests
         {
             KeyParameter key = null;
             CipherKeyGenerator keyGen;
-            SecureRandom rand;
             IBufferedCipher inCipher = null, outCipher = null;
             byte[] iv = null;
             CipherStream cIn, cOut;
             MemoryStream bIn, bOut;
 
-            rand = new FixedSecureRandom();
+            SecureRandom rand = new FixedSecureRandom();
 
-#if NET_1_1
-            string[] parts = algorithm.ToUpper(CultureInfo.InvariantCulture).Split('/');
+#if PORTABLE
+            string upper = algorithm.ToUpperInvariant();
 #else
-            string[] parts = algorithm.ToUpperInvariant().Split('/');
+            string upper = algorithm.ToUpper(CultureInfo.InvariantCulture);
 #endif
+            string[] parts = upper.Split('/');
             string baseAlgorithm = parts[0];
             string mode = parts.Length > 1 ? parts[1] : null;
 
@@ -502,11 +502,12 @@ namespace Org.BouncyCastle.Tests
                 inCipher = CipherUtilities.GetCipher(algorithm);
                 outCipher = CipherUtilities.GetCipher(algorithm);
 
-#if NET_1_1
-                if (!inCipher.AlgorithmName.ToUpper(CultureInfo.InvariantCulture).StartsWith(baseAlgorithm))
+#if PORTABLE
+                upper = inCipher.AlgorithmName.ToUpperInvariant();
 #else
-                if (!inCipher.AlgorithmName.ToUpperInvariant().StartsWith(baseAlgorithm))
+                upper = inCipher.AlgorithmName.ToUpper(CultureInfo.InvariantCulture);
 #endif
+                if (!upper.StartsWith(baseAlgorithm))
                 {
                     Fail("wrong cipher returned!");
                 }
diff --git a/crypto/test/src/tls/test/TlsTestUtilities.cs b/crypto/test/src/tls/test/TlsTestUtilities.cs
index fe2cf038f..04e3a52d1 100644
--- a/crypto/test/src/tls/test/TlsTestUtilities.cs
+++ b/crypto/test/src/tls/test/TlsTestUtilities.cs
@@ -51,10 +51,10 @@ namespace Org.BouncyCastle.Tls.Tests
 
         internal static string ToUpperInvariant(string s)
         {
-#if NET_1_1
-            return s.ToUpper(CultureInfo.InvariantCulture);
-#else
+#if PORTABLE
             return s.ToUpperInvariant();
+#else
+            return s.ToUpper(CultureInfo.InvariantCulture);
 #endif
         }