summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/util/Platform.cs6
-rw-r--r--crypto/test/UnitTests.csproj1
-rw-r--r--crypto/test/src/asn1/test/X509ExtensionsTest.cs2
-rw-r--r--crypto/test/src/cms/test/CMSTestUtil.cs4
-rw-r--r--crypto/test/src/cms/test/EnvelopedDataStreamTest.cs6
-rw-r--r--crypto/test/src/crypto/tls/test/TlsTestUtilities.cs4
-rw-r--r--crypto/test/src/security/test/TestSignerUtil.cs4
-rw-r--r--crypto/test/src/test/BlockCipherTest.cs8
-rw-r--r--crypto/test/src/tls/test/TlsTestUtilities.cs4
-rw-r--r--crypto/test/src/tsp/test/NewTspTest.cs2
-rw-r--r--crypto/test/src/x509/test/TestCertificateGen.cs4
11 files changed, 33 insertions, 12 deletions
diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs
index 547cef3fa..040b0786e 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 PORTABLE
-            return s.ToUpperInvariant();
-#else
+#if NET_1_1
             return s.ToUpper(CultureInfo.InvariantCulture);
+#else
+            return s.ToUpperInvariant();
 #endif
         }
 
diff --git a/crypto/test/UnitTests.csproj b/crypto/test/UnitTests.csproj
index 00f8eb087..92d3b7d92 100644
--- a/crypto/test/UnitTests.csproj
+++ b/crypto/test/UnitTests.csproj
@@ -417,6 +417,7 @@
     <Compile Include="src\security\test\TestDigestUtil.cs" />
     <Compile Include="src\security\test\TestDotNetUtil.cs" />
     <Compile Include="src\security\test\TestEncodings.cs" />
+    <Compile Include="src\security\test\TestMacUtil.cs" />
     <Compile Include="src\security\test\TestParameterUtil.cs" />
     <Compile Include="src\security\test\TestSignerUtil.cs" />
     <Compile Include="src\test\AESSICTest.cs" />
diff --git a/crypto/test/src/asn1/test/X509ExtensionsTest.cs b/crypto/test/src/asn1/test/X509ExtensionsTest.cs
index 71bb5ef67..8656836f6 100644
--- a/crypto/test/src/asn1/test/X509ExtensionsTest.cs
+++ b/crypto/test/src/asn1/test/X509ExtensionsTest.cs
@@ -120,7 +120,7 @@ namespace Org.BouncyCastle.Asn1.Tests
                 extensionsGenerator.AddExtension(X509Extensions.AuditIdentity, false, new DerSequence(new Asn1EncodableVector(new Asn1Encodable[] { name2 })));
                 Fail("Expected exception, not a white listed duplicate.");
             }
-            catch (Exception ex)
+            catch (Exception)
             {
                 // ok
             }
diff --git a/crypto/test/src/cms/test/CMSTestUtil.cs b/crypto/test/src/cms/test/CMSTestUtil.cs
index 69f7c2983..ca94959d7 100644
--- a/crypto/test/src/cms/test/CMSTestUtil.cs
+++ b/crypto/test/src/cms/test/CMSTestUtil.cs
@@ -207,11 +207,11 @@ namespace Org.BouncyCastle.Cms.Tests
 			{
 				if (i + 64 < data.Length)
 				{
-					buf.Append(Encoding.Default.GetString(data, i, 64));
+					buf.Append(Encoding.ASCII.GetString(data, i, 64));
 				}
 				else
 				{
-					buf.Append(Encoding.Default.GetString(data, i, data.Length - i));
+					buf.Append(Encoding.ASCII.GetString(data, i, data.Length - i));
 				}
 				buf.Append('\n');
 			}
diff --git a/crypto/test/src/cms/test/EnvelopedDataStreamTest.cs b/crypto/test/src/cms/test/EnvelopedDataStreamTest.cs
index 8512f6622..39776e852 100644
--- a/crypto/test/src/cms/test/EnvelopedDataStreamTest.cs
+++ b/crypto/test/src/cms/test/EnvelopedDataStreamTest.cs
@@ -361,7 +361,7 @@ namespace Org.BouncyCastle.Cms.Tests
 		[Test]
 		public void TestKeyTransAes128()
 		{
-			byte[] data = Encoding.Default.GetBytes("WallaWallaWashington");
+			byte[] data = Encoding.ASCII.GetBytes("WallaWallaWashington");
 
 			CmsEnvelopedDataStreamGenerator edGen = new CmsEnvelopedDataStreamGenerator();
 
@@ -399,7 +399,7 @@ namespace Org.BouncyCastle.Cms.Tests
 		[Test]
 		public void TestAesKek()
 		{
-			byte[] data = Encoding.Default.GetBytes("WallaWallaWashington");
+			byte[] data = Encoding.ASCII.GetBytes("WallaWallaWashington");
 			KeyParameter kek = CmsTestUtil.MakeAes192Key();
 
 			CmsEnvelopedDataStreamGenerator edGen = new CmsEnvelopedDataStreamGenerator();
@@ -440,7 +440,7 @@ namespace Org.BouncyCastle.Cms.Tests
 		[Test]
 		public void TestTwoAesKek()
 		{
-			byte[] data = Encoding.Default.GetBytes("WallaWallaWashington");
+			byte[] data = Encoding.ASCII.GetBytes("WallaWallaWashington");
 			KeyParameter kek1 = CmsTestUtil.MakeAes192Key();
 			KeyParameter kek2 = CmsTestUtil.MakeAes192Key();
 
diff --git a/crypto/test/src/crypto/tls/test/TlsTestUtilities.cs b/crypto/test/src/crypto/tls/test/TlsTestUtilities.cs
index e339850a6..709c720a8 100644
--- a/crypto/test/src/crypto/tls/test/TlsTestUtilities.cs
+++ b/crypto/test/src/crypto/tls/test/TlsTestUtilities.cs
@@ -45,7 +45,11 @@ 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);
+#else
+            string hex = Encoding.ASCII.GetString(hexBytes).ToUpperInvariant();
+#endif
 
             StringBuilder fp = new StringBuilder();
             int i = 0;
diff --git a/crypto/test/src/security/test/TestSignerUtil.cs b/crypto/test/src/security/test/TestSignerUtil.cs
index 8088f21fd..cc9cd2900 100644
--- a/crypto/test/src/security/test/TestSignerUtil.cs
+++ b/crypto/test/src/security/test/TestSignerUtil.cs
@@ -142,7 +142,11 @@ namespace Org.BouncyCastle.Security.Tests
             {
                 ISigner signer = SignerUtilities.GetSigner(algorithm);
 
+#if NET_1_1
                 string upper = algorithm.ToUpper(CultureInfo.InvariantCulture);
+#else
+                string upper = algorithm.ToUpperInvariant();
+#endif
                 int withPos = upper.LastIndexOf("WITH");
 
                 string cipherName = withPos < 0
diff --git a/crypto/test/src/test/BlockCipherTest.cs b/crypto/test/src/test/BlockCipherTest.cs
index 18753eb1a..7e8e38c40 100644
--- a/crypto/test/src/test/BlockCipherTest.cs
+++ b/crypto/test/src/test/BlockCipherTest.cs
@@ -466,7 +466,11 @@ namespace Org.BouncyCastle.Tests
 
             rand = new FixedSecureRandom();
 
+#if NET_1_1
             string[] parts = algorithm.ToUpper(CultureInfo.InvariantCulture).Split('/');
+#else
+            string[] parts = algorithm.ToUpperInvariant().Split('/');
+#endif
             string baseAlgorithm = parts[0];
             string mode = parts.Length > 1 ? parts[1] : null;
 
@@ -498,7 +502,11 @@ namespace Org.BouncyCastle.Tests
                 inCipher = CipherUtilities.GetCipher(algorithm);
                 outCipher = CipherUtilities.GetCipher(algorithm);
 
+#if NET_1_1
                 if (!inCipher.AlgorithmName.ToUpper(CultureInfo.InvariantCulture).StartsWith(baseAlgorithm))
+#else
+                if (!inCipher.AlgorithmName.ToUpperInvariant().StartsWith(baseAlgorithm))
+#endif
                 {
                     Fail("wrong cipher returned!");
                 }
diff --git a/crypto/test/src/tls/test/TlsTestUtilities.cs b/crypto/test/src/tls/test/TlsTestUtilities.cs
index 3ecacb0f0..fe2cf038f 100644
--- a/crypto/test/src/tls/test/TlsTestUtilities.cs
+++ b/crypto/test/src/tls/test/TlsTestUtilities.cs
@@ -51,7 +51,11 @@ namespace Org.BouncyCastle.Tls.Tests
 
         internal static string ToUpperInvariant(string s)
         {
+#if NET_1_1
             return s.ToUpper(CultureInfo.InvariantCulture);
+#else
+            return s.ToUpperInvariant();
+#endif
         }
 
         internal static string Fingerprint(X509CertificateStructure c)
diff --git a/crypto/test/src/tsp/test/NewTspTest.cs b/crypto/test/src/tsp/test/NewTspTest.cs
index 6bc03b8c2..a1e4934f3 100644
--- a/crypto/test/src/tsp/test/NewTspTest.cs
+++ b/crypto/test/src/tsp/test/NewTspTest.cs
@@ -762,7 +762,7 @@ namespace Org.BouncyCastle.Tsp.Tests
 
 			TimeStampResponseGenerator tsRespGen = new TimeStampResponseGenerator(tsTokenGen, TspAlgorithms.Allowed);
 
-			TimeStampResponse tsResp = tsRespGen.Generate(request, new BigInteger("23"), DateTime.Now);
+			TimeStampResponse tsResp = tsRespGen.Generate(request, new BigInteger("23"), DateTime.UtcNow);
 
 			Assert.AreEqual((int)PkiStatus.Granted, tsResp.Status);
 
diff --git a/crypto/test/src/x509/test/TestCertificateGen.cs b/crypto/test/src/x509/test/TestCertificateGen.cs
index 24dbdf08f..491f6d312 100644
--- a/crypto/test/src/x509/test/TestCertificateGen.cs
+++ b/crypto/test/src/x509/test/TestCertificateGen.cs
@@ -258,8 +258,8 @@ namespace Org.BouncyCastle.X509.Tests
             certGen.SetSerialNumber(BigInteger.One);
 
             certGen.SetIssuerDN(new X509Name(ord, attrs));
-            certGen.SetNotBefore(DateTime.Today.Subtract(new TimeSpan(1, 0, 0, 0)));
-            certGen.SetNotAfter(DateTime.Today.AddDays(1));
+            certGen.SetNotBefore(DateTime.UtcNow.AddDays(-1));
+            certGen.SetNotAfter(DateTime.UtcNow.AddDays(1));
             certGen.SetSubjectDN(new X509Name(ord, attrs));
             certGen.SetPublicKey(ecPub);
             certGen.SetSignatureAlgorithm("SHA1WITHECDSA");