diff options
Diffstat (limited to 'crypto/src/security/PrivateKeyFactory.cs')
-rw-r--r-- | crypto/src/security/PrivateKeyFactory.cs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/src/security/PrivateKeyFactory.cs b/crypto/src/security/PrivateKeyFactory.cs index 5d70423f4..38e571cd6 100644 --- a/crypto/src/security/PrivateKeyFactory.cs +++ b/crypto/src/security/PrivateKeyFactory.cs @@ -350,10 +350,17 @@ namespace Org.BouncyCastle.Security } } +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + private static ReadOnlySpan<byte> GetRawKey(PrivateKeyInfo keyInfo) + { + return Asn1OctetString.GetInstance(keyInfo.ParsePrivateKey()).GetOctetsSpan(); + } +#else private static byte[] GetRawKey(PrivateKeyInfo keyInfo) { return Asn1OctetString.GetInstance(keyInfo.ParsePrivateKey()).GetOctets(); } +#endif public static AsymmetricKeyParameter DecryptKey( char[] passPhrase, |