diff --git a/scapy/asn1fields.py b/scapy/asn1fields.py index a080e1edf2a2678fad93375180751db90a3ec286..6b23f9bd0ea82968bce82c7ba0fe6950301f4271 100644 --- a/scapy/asn1fields.py +++ b/scapy/asn1fields.py @@ -402,11 +402,14 @@ class ASN1F_CHOICE(ASN1F_field): Multiple types are allowed: ASN1_Packet, ASN1F_field and ASN1F_PACKET(), e.g. you could define ASN1F_CHOICE("qualifier", None, X509_UserNotice, - ASN1F_X509_CPSuri, + ASN1F_X509_CPSuri) + or ASN1F_CHOICE("qualifier", None, ASN1F_PACKET("index", dflt, X509_Pkt, implicit_tag=0x82), explicit_tag=0xa1) Other ASN1F_field instances than ASN1F_PACKET instances must not be used. + ASN1F_PACKET instances must not be mixed with other types. + self.instantiated_choices signals whether only such instances are present. """ holds_packets = 1 ASN1_tag = ASN1_Class_UNIVERSAL.ANY diff --git a/scapy/layers/x509.py b/scapy/layers/x509.py index e0e1e17c54f9f8f91c6335c526b3ea4600e0cdcf..4bd14080911ede4facb128b519fbb34d365fd4d4 100644 --- a/scapy/layers/x509.py +++ b/scapy/layers/x509.py @@ -94,7 +94,7 @@ class ECParameters(ASN1_Packet): ASN1_root = ASN1F_CHOICE("curve", ASN1_OID("ansip384r1"), ASN1F_OID, # for named curves ASN1F_NULL, # for implicit curves - ASN1F_PACKET("curve", None, ECSpecifiedDomain)) + ECSpecifiedDomain) class ECDSAPublicKey(ASN1_Packet): ASN1_codec = ASN1_Codecs.BER