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

◆ ReadPkcs8< TRet >() [1/2]

static void System.Security.Cryptography.KeyFormatHelper.ReadPkcs8< TRet > ( string[] validOids,
ReadOnlyMemory< byte > source,
KeyReader< TRet > keyReader,
out int bytesRead,
out TRet ret )
inlinestaticprivate

Definition at line 94 of file KeyFormatHelper.cs.

95 {
96 try
97 {
99 int length = reader.PeekEncodedValue().Length;
100 PrivateKeyInfoAsn.Decode(ref reader, source, out var decoded);
101 if (Array.IndexOf(validOids, decoded.PrivateKeyAlgorithm.Algorithm) < 0)
102 {
103 throw new CryptographicException(System.SR.Cryptography_NotValidPublicOrPrivateKey);
104 }
105 keyReader(decoded.PrivateKey, in decoded.PrivateKeyAlgorithm, out ret);
106 bytesRead = length;
107 }
108 catch (AsnContentException inner)
109 {
110 throw new CryptographicException(System.SR.Cryptography_Der_Invalid_Encoding, inner);
111 }
112 }
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.