summary refs log tree commit diff
path: root/crypto/src/security/PublicKeyFactory.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/security/PublicKeyFactory.cs')
-rw-r--r--crypto/src/security/PublicKeyFactory.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/src/security/PublicKeyFactory.cs b/crypto/src/security/PublicKeyFactory.cs
index 775884e94..03cabbb13 100644
--- a/crypto/src/security/PublicKeyFactory.cs
+++ b/crypto/src/security/PublicKeyFactory.cs
@@ -280,6 +280,16 @@ namespace Org.BouncyCastle.Security
             }
         }
 
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+        private static ReadOnlySpan<byte> GetRawKey(SubjectPublicKeyInfo keyInfo)
+        {
+            /*
+             * TODO[RFC 8422]
+             * - Require keyInfo.Algorithm.Parameters == null?
+             */
+            return keyInfo.PublicKeyData.GetOctetsSpan();
+        }
+#else
         private static byte[] GetRawKey(SubjectPublicKeyInfo keyInfo)
         {
             /*
@@ -288,6 +298,7 @@ namespace Org.BouncyCastle.Security
              */
             return keyInfo.PublicKeyData.GetOctets();
         }
+#endif
 
         private static bool IsPkcsDHParam(Asn1Sequence seq)
         {