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

◆ TryReadPrimitiveOctetStringCore()

static bool System.Formats.Asn1.AsnDecoder.TryReadPrimitiveOctetStringCore ( ReadOnlySpan< byte > source,
AsnEncodingRules ruleSet,
Asn1Tag expectedTag,
UniversalTagNumber universalTagNumber,
out int? contentLength,
out int headerLength,
out ReadOnlySpan< byte > contents,
out int bytesConsumed )
inlinestaticprivate

Definition at line 1234 of file AsnDecoder.cs.

1235 {
1239 if (tag.IsConstructed)
1240 {
1241 if (ruleSet == AsnEncodingRules.DER)
1242 {
1243 throw new AsnContentException(System.SR.ContentException_InvalidUnderDer_TryBerOrCer);
1244 }
1245 contents = default(ReadOnlySpan<byte>);
1246 bytesConsumed = 0;
1247 return false;
1248 }
1249 if (ruleSet == AsnEncodingRules.CER && readOnlySpan.Length > 1000)
1250 {
1251 throw new AsnContentException(System.SR.ContentException_InvalidUnderCer_TryBerOrDer);
1252 }
1253 contents = readOnlySpan;
1255 return true;
1256 }
static ReadOnlySpan< byte > Slice(ReadOnlySpan< byte > source, int offset, int length)
static void CheckExpectedTag(Asn1Tag tag, Asn1Tag expectedTag, UniversalTagNumber tagNumber)
static Asn1Tag ReadTagAndLength(ReadOnlySpan< byte > source, AsnEncodingRules ruleSet, out int? contentsLength, out int bytesRead)
static string ContentException_InvalidUnderCer_TryBerOrDer
Definition SR.cs:54
static string ContentException_InvalidUnderDer_TryBerOrCer
Definition SR.cs:58
Definition SR.cs:7

References System.Formats.Asn1.AsnDecoder.CheckExpectedTag(), System.SR.ContentException_InvalidUnderCer_TryBerOrDer, System.SR.ContentException_InvalidUnderDer_TryBerOrCer, System.Formats.Asn1.Asn1Tag.IsConstructed, System.Formats.Asn1.AsnDecoder.ReadTagAndLength(), System.Formats.Asn1.AsnDecoder.Slice(), and System.source.

Referenced by System.Formats.Asn1.AsnDecoder.GetOctetStringContents(), System.Formats.Asn1.AsnDecoder.TryReadCharacterStringBytesCore(), System.Formats.Asn1.AsnDecoder.TryReadOctetString(), System.Formats.Asn1.AsnDecoder.TryReadPrimitiveCharacterStringBytes(), and System.Formats.Asn1.AsnDecoder.TryReadPrimitiveOctetString().