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

◆ WriteBitStringCore()

void System.Formats.Asn1.AsnWriter.WriteBitStringCore ( Asn1Tag tag,
ReadOnlySpan< byte > bitString,
int unusedBitCount )
inlineprivate

Definition at line 491 of file AsnWriter.cs.

492 {
494 {
495 throw new ArgumentOutOfRangeException("unusedBitCount", unusedBitCount, System.SR.Argument_UnusedBitCountRange);
496 }
497 if (bitString.Length == 0 && unusedBitCount != 0)
498 {
500 }
501 byte lastByte = (byte)((!bitString.IsEmpty) ? bitString[bitString.Length - 1] : 0);
502 if (!CheckValidLastByte(lastByte, unusedBitCount))
503 {
504 throw new ArgumentException(System.SR.Argument_UnusedBitWasSet, "unusedBitCount");
505 }
506 if (RuleSet == AsnEncodingRules.CER && bitString.Length >= 1000)
507 {
509 return;
510 }
511 WriteTag(tag.AsPrimitive());
512 WriteLength(bitString.Length + 1);
514 _offset++;
516 _offset += bitString.Length;
517 }
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
static bool CheckValidLastByte(byte lastByte, int unusedBitCount)
Definition AsnWriter.cs:519
void WriteLength(int length)
Definition AsnWriter.cs:272
void WriteConstructedCerBitString(Asn1Tag tag, ReadOnlySpan< byte > payload, int unusedBitCount)
Definition AsnWriter.cs:533
void WriteTag(Asn1Tag tag)
Definition AsnWriter.cs:261
static string Argument_UnusedBitWasSet
Definition SR.cs:38
static string Argument_UnusedBitCountMustBeZero
Definition SR.cs:34
static string Argument_UnusedBitCountRange
Definition SR.cs:36
Definition SR.cs:7

References System.Formats.Asn1.AsnWriter._buffer, System.Formats.Asn1.AsnWriter._offset, System.SR.Argument_UnusedBitCountMustBeZero, System.SR.Argument_UnusedBitCountRange, System.SR.Argument_UnusedBitWasSet, System.Formats.Asn1.Asn1Tag.AsPrimitive(), System.Formats.Asn1.AsnWriter.CheckValidLastByte(), System.Collections.Generic.Dictionary< TKey, TValue >.CopyTo(), System.Formats.Asn1.AsnWriter.RuleSet, System.Formats.Asn1.AsnWriter.WriteConstructedCerBitString(), System.Formats.Asn1.AsnWriter.WriteLength(), and System.Formats.Asn1.AsnWriter.WriteTag().

Referenced by System.Formats.Asn1.AsnWriter.WriteBitString().