Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
FieldID.cs
Go to the documentation of this file.
2
4
5internal struct FieldID
6{
7 internal string FieldType;
8
10
11 internal void Encode(AsnWriter writer)
12 {
14 }
15
16 internal void Encode(AsnWriter writer, Asn1Tag tag)
17 {
18 writer.PushSequence(tag);
19 try
20 {
21 writer.WriteObjectIdentifier(FieldType);
22 }
23 catch (ArgumentException inner)
24 {
26 }
27 try
28 {
29 writer.WriteEncodedValue(Parameters.Span);
30 }
31 catch (ArgumentException inner2)
32 {
34 }
35 writer.PopSequence(tag);
36 }
37
38 internal static void Decode(ref System.Formats.Asn1.AsnValueReader reader, ReadOnlyMemory<byte> rebind, out System.Security.Cryptography.Asn1.FieldID decoded)
39 {
40 Decode(ref reader, Asn1Tag.Sequence, rebind, out decoded);
41 }
42
43 internal static void Decode(ref System.Formats.Asn1.AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory<byte> rebind, out System.Security.Cryptography.Asn1.FieldID decoded)
44 {
45 try
46 {
47 DecodeCore(ref reader, expectedTag, rebind, out decoded);
48 }
49 catch (AsnContentException inner)
50 {
52 }
53 }
54
55 private static void DecodeCore(ref System.Formats.Asn1.AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory<byte> rebind, out System.Security.Cryptography.Asn1.FieldID decoded)
56 {
57 decoded = default(System.Security.Cryptography.Asn1.FieldID);
58 System.Formats.Asn1.AsnValueReader asnValueReader = reader.ReadSequence(expectedTag);
59 ReadOnlySpan<byte> span = rebind.Span;
60 decoded.FieldType = asnValueReader.ReadObjectIdentifier();
61 ReadOnlySpan<byte> other = asnValueReader.ReadEncodedValue();
62 decoded.Parameters = (span.Overlaps(other, out var elementOffset) ? rebind.Slice(elementOffset, other.Length) : ((ReadOnlyMemory<byte>)other.ToArray()));
63 asnValueReader.ThrowIfNotEmpty();
64 }
65}
static string Cryptography_Der_Invalid_Encoding
Definition SR.cs:50
Definition SR.cs:7
static readonly Asn1Tag Sequence
Definition Asn1Tag.cs:29
string ReadObjectIdentifier(Asn1Tag? expectedTag=null)
ReadOnlySpan< byte > ReadEncodedValue()
AsnValueReader ReadSequence(Asn1Tag? expectedTag=null)
unsafe ReadOnlySpan< T > Span
ReadOnlyMemory< T > Slice(int start)
static void DecodeCore(ref System.Formats.Asn1.AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory< byte > rebind, out System.Security.Cryptography.Asn1.FieldID decoded)
Definition FieldID.cs:55
static void DecodeCore(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory< byte > rebind, out FieldID decoded)
Definition FieldID.cs:55
static void Decode(ref AsnValueReader reader, ReadOnlyMemory< byte > rebind, out FieldID decoded)
Definition FieldID.cs:38
static void Decode(ref System.Formats.Asn1.AsnValueReader reader, ReadOnlyMemory< byte > rebind, out System.Security.Cryptography.Asn1.FieldID decoded)
Definition FieldID.cs:38
ReadOnlyMemory< byte > Parameters
Definition FieldID.cs:9
static void Decode(ref System.Formats.Asn1.AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory< byte > rebind, out System.Security.Cryptography.Asn1.FieldID decoded)
Definition FieldID.cs:43
void Encode(AsnWriter writer, Asn1Tag tag)
Definition FieldID.cs:16