Skip to content

Commit b3a32cd

Browse files
committed
added RELATIVE-OID support in ASN.1 reader
1 parent 49b0a03 commit b3a32cd

1 file changed

Lines changed: 22 additions & 40 deletions

File tree

Asn1Parser/Asn1Reader.cs

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -527,46 +527,28 @@ public void Reset() {
527527
/// </summary>
528528
/// <returns>ASN.1 object that represents current tag.</returns>
529529
public Asn1Universal GetTagObject() {
530-
switch (Tag) {
531-
case (Byte)Asn1Type.BOOLEAN:
532-
return new Asn1Boolean(this);
533-
case (Byte)Asn1Type.INTEGER:
534-
return new Asn1Integer(this);
535-
case (Byte)Asn1Type.BIT_STRING:
536-
return new Asn1BitString(this);
537-
case (Byte)Asn1Type.OCTET_STRING:
538-
return new Asn1OctetString(this);
539-
case (Byte)Asn1Type.NULL:
540-
return new Asn1Null(this);
541-
case (Byte)Asn1Type.OBJECT_IDENTIFIER:
542-
return new Asn1ObjectIdentifier(this);
543-
case (Byte)Asn1Type.ENUMERATED:
544-
return new Asn1Enumerated(this);
545-
case (Byte)Asn1Type.UTF8String:
546-
return new Asn1UTF8String(this);
547-
case (Byte)Asn1Type.NumericString:
548-
return new Asn1NumericString(this);
549-
case (Byte)Asn1Type.PrintableString:
550-
return new Asn1PrintableString(this);
551-
case (Byte)Asn1Type.TeletexString:
552-
return new Asn1TeletexString(this);
553-
case (Byte)Asn1Type.VideotexString:
554-
return new Asn1VideotexString(this);
555-
case (Byte)Asn1Type.IA5String:
556-
return new Asn1IA5String(this);
557-
case (Byte)Asn1Type.UTCTime:
558-
return new Asn1UtcTime(this);
559-
case (Byte)Asn1Type.GeneralizedTime:
560-
return new Asn1GeneralizedTime(this);
561-
case (Byte)Asn1Type.VisibleString:
562-
return new Asn1VisibleString(this);
563-
case (Byte)Asn1Type.UniversalString:
564-
return new Asn1UniversalString(this);
565-
case (Byte)Asn1Type.BMPString:
566-
return new Asn1BMPString(this);
567-
default:
568-
return new Asn1AnyType(this);
569-
}
530+
return Tag switch {
531+
(Byte)Asn1Type.BOOLEAN => new Asn1Boolean(this),
532+
(Byte)Asn1Type.INTEGER => new Asn1Integer(this),
533+
(Byte)Asn1Type.BIT_STRING => new Asn1BitString(this),
534+
(Byte)Asn1Type.OCTET_STRING => new Asn1OctetString(this),
535+
(Byte)Asn1Type.NULL => new Asn1Null(this),
536+
(Byte)Asn1Type.OBJECT_IDENTIFIER => new Asn1ObjectIdentifier(this),
537+
(Byte)Asn1Type.RELATIVE_OID => new Asn1RelativeOid(this),
538+
(Byte)Asn1Type.ENUMERATED => new Asn1Enumerated(this),
539+
(Byte)Asn1Type.UTF8String => new Asn1UTF8String(this),
540+
(Byte)Asn1Type.NumericString => new Asn1NumericString(this),
541+
(Byte)Asn1Type.PrintableString => new Asn1PrintableString(this),
542+
(Byte)Asn1Type.TeletexString => new Asn1TeletexString(this),
543+
(Byte)Asn1Type.VideotexString => new Asn1VideotexString(this),
544+
(Byte)Asn1Type.IA5String => new Asn1IA5String(this),
545+
(Byte)Asn1Type.UTCTime => new Asn1UtcTime(this),
546+
(Byte)Asn1Type.GeneralizedTime => new Asn1GeneralizedTime(this),
547+
(Byte)Asn1Type.VisibleString => new Asn1VisibleString(this),
548+
(Byte)Asn1Type.UniversalString => new Asn1UniversalString(this),
549+
(Byte)Asn1Type.BMPString => new Asn1BMPString(this),
550+
_ => new Asn1AnyType(this)
551+
};
570552
}
571553
/// <summary>
572554
/// Recursively processes ASN tree and builds internal offset map.

0 commit comments

Comments
 (0)