Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
PBEParameter.cs
Go to the documentation of this file.
2
4
5internal struct PBEParameter
6{
8
9 internal int IterationCount;
10
12 {
13 return Decode(Asn1Tag.Sequence, encoded, ruleSet);
14 }
15
17 {
18 try
19 {
21 DecodeCore(ref reader, expectedTag, encoded, out var decoded);
22 reader.ThrowIfNotEmpty();
23 return decoded;
24 }
25 catch (AsnContentException inner)
26 {
28 }
29 }
30
31 private static void DecodeCore(ref System.Formats.Asn1.AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory<byte> rebind, out System.Security.Cryptography.Asn1.PBEParameter decoded)
32 {
33 decoded = default(System.Security.Cryptography.Asn1.PBEParameter);
34 System.Formats.Asn1.AsnValueReader asnValueReader = reader.ReadSequence(expectedTag);
35 ReadOnlySpan<byte> span = rebind.Span;
36 if (asnValueReader.TryReadPrimitiveOctetString(out var value))
37 {
38 decoded.Salt = (span.Overlaps(value, out var elementOffset) ? rebind.Slice(elementOffset, value.Length) : ((ReadOnlyMemory<byte>)value.ToArray()));
39 }
40 else
41 {
42 decoded.Salt = asnValueReader.ReadOctetString();
43 }
44 if (!asnValueReader.TryReadInt32(out decoded.IterationCount))
45 {
46 asnValueReader.ThrowIfNotEmpty();
47 }
48 asnValueReader.ThrowIfNotEmpty();
49 }
50}
static string Cryptography_Der_Invalid_Encoding
Definition SR.cs:50
Definition SR.cs:7
static readonly Asn1Tag Sequence
Definition Asn1Tag.cs:29
bool TryReadInt32(out int value, Asn1Tag? expectedTag=null)
bool TryReadPrimitiveOctetString(out ReadOnlySpan< byte > value, Asn1Tag? expectedTag=null)
byte[] ReadOctetString(Asn1Tag? expectedTag=null)
AsnValueReader ReadSequence(Asn1Tag? expectedTag=null)
unsafe ReadOnlySpan< T > Span
ReadOnlyMemory< T > Slice(int start)
static PBEParameter Decode(ReadOnlyMemory< byte > encoded, AsnEncodingRules ruleSet)
static System.Security.Cryptography.Asn1.PBEParameter Decode(ReadOnlyMemory< byte > encoded, AsnEncodingRules ruleSet)
static System.Security.Cryptography.Asn1.PBEParameter Decode(Asn1Tag expectedTag, ReadOnlyMemory< byte > encoded, AsnEncodingRules ruleSet)
static void DecodeCore(ref AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory< byte > rebind, out PBEParameter decoded)
static void DecodeCore(ref System.Formats.Asn1.AsnValueReader reader, Asn1Tag expectedTag, ReadOnlyMemory< byte > rebind, out System.Security.Cryptography.Asn1.PBEParameter decoded)