From bac5663b0e3e29f57403989684661c0002f6461d Mon Sep 17 00:00:00 2001 From: mtu <maxence.tury@ssi.gouv.fr> Date: Wed, 3 Feb 2016 10:49:07 +0100 Subject: [PATCH] Fix ECParamaters due to ASN1F_CHOICE limitations --- scapy/asn1fields.py | 5 ++++- scapy/layers/x509.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scapy/asn1fields.py b/scapy/asn1fields.py index a080e1ed..6b23f9bd 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 e0e1e17c..4bd14080 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 -- GitLab