Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RSAPublicKeyAsn.cs
Go to the documentation of this file.
3
5
6internal struct RSAPublicKeyAsn
7{
9
11
13 {
14 return Decode(Asn1Tag.Sequence, encoded, ruleSet);
15 }
16
17 internal static RSAPublicKeyAsn Decode(Asn1Tag expectedTag, ReadOnlyMemory<byte> encoded, AsnEncodingRules ruleSet)
18 {
19 try
20 {
21 AsnValueReader reader = new AsnValueReader(encoded.Span, ruleSet);
22 DecodeCore(ref reader, expectedTag, encoded, out var decoded);
23 reader.ThrowIfNotEmpty();
24 return decoded;
25 }
26 catch (AsnContentException inner)
27 {
29 }
30 }
31
32 private static void DecodeCore(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory<byte> rebind, out RSAPublicKeyAsn decoded)
33 {
34 decoded = default(RSAPublicKeyAsn);
35 AsnValueReader asnValueReader = reader.ReadSequence(expectedTag);
36 decoded.Modulus = asnValueReader.ReadInteger();
37 decoded.PublicExponent = asnValueReader.ReadInteger();
38 asnValueReader.ThrowIfNotEmpty();
39 }
40}
static string Cryptography_Der_Invalid_Encoding
Definition SR.cs:50
Definition SR.cs:7
static readonly Asn1Tag Sequence
Definition Asn1Tag.cs:29
BigInteger ReadInteger(Asn1Tag? expectedTag=null)
AsnValueReader ReadSequence(Asn1Tag? expectedTag=null)
unsafe ReadOnlySpan< T > Span
static void DecodeCore(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory< byte > rebind, out RSAPublicKeyAsn decoded)
static RSAPublicKeyAsn Decode(Asn1Tag expectedTag, ReadOnlyMemory< byte > encoded, AsnEncodingRules ruleSet)
static RSAPublicKeyAsn Decode(ReadOnlyMemory< byte > encoded, AsnEncodingRules ruleSet)