summary refs log tree commit diff
path: root/crypto/src
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 /crypto/src
parentAdd AesX86Engine using Aes intrinsics (diff)
downloadBouncyCastle.NET-ed25519-74e3b3e7882eb11fc2b9510b3760cca5697ad512.tar.xz
Add SupportedOSPlatform attributes
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/security/DotNetUtilities.cs18
1 files changed, 9 insertions, 9 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