internal void Encode(AsnWriter writer, Asn1Tag tag) { writer.PushSequence(tag); writer.WriteOctetString(Entry.Span); Assertion.Encode(writer); writer.PopSequence(tag); }
internal void Encode(AsnWriter writer) { bool wroteValue = false; if (And != null) { if (wroteValue) { throw new CryptographicException(); } writer.PushSetOf(new Asn1Tag(TagClass.ContextSpecific, 0)); for (int i = 0; i < And.Length; i++) { And[i].Encode(writer); } writer.PopSetOf(new Asn1Tag(TagClass.ContextSpecific, 0)); wroteValue = true; } if (Or != null) { if (wroteValue) { throw new CryptographicException(); } writer.PushSetOf(new Asn1Tag(TagClass.ContextSpecific, 1)); for (int i = 0; i < Or.Length; i++) { Or[i].Encode(writer); } writer.PopSetOf(new Asn1Tag(TagClass.ContextSpecific, 1)); wroteValue = true; } if (Not != null) { if (wroteValue) { throw new CryptographicException(); } writer.PushSequence(new Asn1Tag(TagClass.ContextSpecific, 2)); writer.PushSequence(); Not.Encode(writer); writer.PopSequence(); writer.PopSequence(new Asn1Tag(TagClass.ContextSpecific, 2)); wroteValue = true; } if (EqualityMatch != null) { if (wroteValue) { throw new CryptographicException(); } EqualityMatch.Encode(writer, new Asn1Tag(TagClass.ContextSpecific, 3)); wroteValue = true; } if (Substrings != null) { if (wroteValue) { throw new CryptographicException(); } Substrings.Encode(writer, new Asn1Tag(TagClass.ContextSpecific, 4)); wroteValue = true; } if (GreaterOrEqual != null) { if (wroteValue) { throw new CryptographicException(); } GreaterOrEqual.Encode(writer, new Asn1Tag(TagClass.ContextSpecific, 5)); wroteValue = true; } if (LessOrEqual != null) { if (wroteValue) { throw new CryptographicException(); } LessOrEqual.Encode(writer, new Asn1Tag(TagClass.ContextSpecific, 6)); wroteValue = true; } if (Present.HasValue) { if (wroteValue) { throw new CryptographicException(); } writer.WriteOctetString(new Asn1Tag(TagClass.ContextSpecific, 7), Present.Value.Span); wroteValue = true; } if (ApproxMatch != null) { if (wroteValue) { throw new CryptographicException(); } ApproxMatch.Encode(writer, new Asn1Tag(TagClass.ContextSpecific, 8)); wroteValue = true; } if (ExtensibleMatch != null) { if (wroteValue) { throw new CryptographicException(); } ExtensibleMatch.Encode(writer, new Asn1Tag(TagClass.ContextSpecific, 9)); wroteValue = true; } if (!wroteValue) { throw new CryptographicException(); } }