Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ReadPkcs8()

static ReadOnlyMemory< byte > System.Security.Cryptography.KeyFormatHelper.ReadPkcs8 ( string[] validOids,
ReadOnlyMemory< byte > source,
out int bytesRead )
inlinestaticpackage

Definition at line 74 of file KeyFormatHelper.cs.

75 {
76 try
77 {
79 int length = reader.PeekEncodedValue().Length;
80 PrivateKeyInfoAsn.Decode(ref reader, source, out var decoded);
81 if (Array.IndexOf(validOids, decoded.PrivateKeyAlgorithm.Algorithm) < 0)
82 {
83 throw new CryptographicException(System.SR.Cryptography_NotValidPublicOrPrivateKey);
84 }
85 bytesRead = length;
86 return decoded.PrivateKey;
87 }
88 catch (AsnContentException inner)
89 {
90 throw new CryptographicException(System.SR.Cryptography_Der_Invalid_Encoding, inner);
91 }
92 }
static string Cryptography_Der_Invalid_Encoding
Definition SR.cs:50
static string Cryptography_NotValidPublicOrPrivateKey
Definition SR.cs:122
Definition SR.cs:7
ReadOnlySpan< byte > PeekEncodedValue()
static PrivateKeyInfoAsn Decode(ReadOnlyMemory< byte > encoded, AsnEncodingRules ruleSet)

References System.SR.Cryptography_Der_Invalid_Encoding, System.SR.Cryptography_NotValidPublicOrPrivateKey, System.Security.Cryptography.Asn1.PrivateKeyInfoAsn.Decode(), System.Array.IndexOf(), System.length, System.ReadOnlySpan< T >.Length, System.Formats.Asn1.AsnValueReader.PeekEncodedValue(), and System.source.

Referenced by System.Security.Cryptography.ECDiffieHellman.ImportPkcs8PrivateKey(), System.Security.Cryptography.ECDsa.ImportPkcs8PrivateKey(), System.Security.Cryptography.KeyFormatHelper.ReadEncryptedPkcs8< TRet >(), System.Security.Cryptography.RSAKeyFormatHelper.ReadPkcs8(), System.Security.Cryptography.DSAKeyFormatHelper.ReadPkcs8(), and System.Security.Cryptography.KeyFormatHelper.ReadPkcs8< TRet >().