summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-07-17 23:28:05 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-07-17 23:28:05 +0700
commit74e3b3e7882eb11fc2b9510b3760cca5697ad512 (patch)
treee92f2890874cc3db160aa2fc470de65c576a3439
parentAdd AesX86Engine using Aes intrinsics (diff)
downloadBouncyCastle.NET-ed25519-74e3b3e7882eb11fc2b9510b3760cca5697ad512.tar.xz
Add SupportedOSPlatform attributes
-rw-r--r--crypto/src/security/DotNetUtilities.cs18
-rw-r--r--crypto/test/src/security/test/TestDotNetUtil.cs8
2 files changed, 16 insertions, 10 deletions
diff --git a/crypto/src/security/DotNetUtilities.cs b/crypto/src/security/DotNetUtilities.cs
index d37e27abd..ccfb2b2b8 100644
--- a/crypto/src/security/DotNetUtilities.cs
+++ b/crypto/src/security/DotNetUtilities.cs
@@ -1,6 +1,7 @@
-#if !PORTABLE
-
 using System;
+#if NET5_0_OR_GREATER
+using System.Runtime.Versioning;
+#endif
 using System.Security.Cryptography;
 using SystemX509 = System.Security.Cryptography.X509Certificates;
 
@@ -17,6 +18,9 @@ namespace Org.BouncyCastle.Security
     /// <summary>
     /// A class containing methods to interface the BouncyCastle world to the .NET Crypto world.
     /// </summary>
+#if NET5_0_OR_GREATER
+    [SupportedOSPlatform("windows")]
+#endif
     public static class DotNetUtilities
     {
         /// <summary>
@@ -225,16 +229,14 @@ namespace Org.BouncyCastle.Security
             return BigIntegers.AsUnsignedByteArray(size, n);
         }
 
-        private static RSA CreateRSAProvider(RSAParameters rp)
+        private static RSACryptoServiceProvider CreateRSAProvider(RSAParameters rp)
         {
             CspParameters csp = new CspParameters();
             csp.KeyContainerName = string.Format("BouncyCastle-{0}", Guid.NewGuid());
-            RSACryptoServiceProvider rsaCsp = new RSACryptoServiceProvider(csp);
-            rsaCsp.ImportParameters(rp);
-            return rsaCsp;
+            return CreateRSAProvider(rp, csp);
         }
 
-        private static RSA CreateRSAProvider(RSAParameters rp, CspParameters csp)
+        private static RSACryptoServiceProvider CreateRSAProvider(RSAParameters rp, CspParameters csp)
         {
             RSACryptoServiceProvider rsaCsp = new RSACryptoServiceProvider(csp);
             rsaCsp.ImportParameters(rp);
@@ -242,5 +244,3 @@ namespace Org.BouncyCastle.Security
         }
     }
 }
-
-#endif
diff --git a/crypto/test/src/security/test/TestDotNetUtil.cs b/crypto/test/src/security/test/TestDotNetUtil.cs
index 82cad46f1..3ca3efdbb 100644
--- a/crypto/test/src/security/test/TestDotNetUtil.cs
+++ b/crypto/test/src/security/test/TestDotNetUtil.cs
@@ -1,5 +1,8 @@
 using System;
 using System.Collections.Generic;
+#if NET5_0_OR_GREATER
+using System.Runtime.Versioning;
+#endif
 using System.Security.Cryptography;
 using SystemX509 = System.Security.Cryptography.X509Certificates;
 
@@ -17,7 +20,10 @@ using Org.BouncyCastle.X509;
 namespace Org.BouncyCastle.Security.Tests
 {
 	[TestFixture]
-	public class TestDotNetUtilities
+#if NET5_0_OR_GREATER
+    [SupportedOSPlatform("windows")]
+#endif
+    public class TestDotNetUtilities
 	{
 		[Test]
 		public void TestRsaInterop()