Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .config/ci/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ python -m pip install --upgrade pip setuptools wheel --ignore-installed

# Make sure tox is installed and up to date
python -m pip install -U tox --ignore-installed

# Optional test dependency for ASN.1 OER interoperability tests
python -m pip install asn1tools
3 changes: 3 additions & 0 deletions .config/ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@ python -m pip install --upgrade pip setuptools wheel --ignore-installed
# Make sure tox is installed and up to date
python -m pip install -U tox --ignore-installed

# Optional test dependency for ASN.1 OER interoperability tests
python -m pip install asn1tools

# Dump Environment (so that we can check PATH, UT_FLAGS, etc.)
set
5 changes: 5 additions & 0 deletions .config/codespell_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ wan
wanna
webp
widgits
uper
UPER
uPER
acn
ACN
2 changes: 2 additions & 0 deletions scapy/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

from scapy.asn1.asn1 import *
from scapy.asn1.ber import *
from scapy.asn1.oer import *
from scapy.asn1.uper import *
from scapy.asn1.mib import *

from scapy.pipetool import *
Expand Down
8 changes: 7 additions & 1 deletion scapy/asn1/ber.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,14 @@ def BER_tagging_dec(s, # type: bytes

def BER_tagging_enc(s, implicit_tag=None, explicit_tag=None):
# type: (bytes, Optional[int], Optional[int]) -> bytes
from scapy.config import conf
if len(s) > 0:
if implicit_tag is not None:
s = BER_id_enc(implicit_tag) + s[1:]
elif explicit_tag is not None:
s = BER_id_enc(explicit_tag) + BER_len_enc(len(s)) + s
s = BER_id_enc(explicit_tag) + BER_len_enc(
len(s), size=conf.ASN1_default_long_size,
) + s
return s

# [ BER classes ] #
Expand Down Expand Up @@ -629,10 +632,13 @@ class BERcodec_SEQUENCE(BERcodec_Object[Union[bytes, List[BERcodec_Object[Any]]]
@classmethod
def enc(cls, _ll, size_len=0):
# type: (Union[bytes, List[BERcodec_Object[Any]]], Optional[int]) -> bytes
from scapy.config import conf
if isinstance(_ll, bytes):
ll = _ll
else:
ll = b"".join(x.enc(cls.codec) for x in _ll)
if not size_len:
size_len = conf.ASN1_default_long_size
return chb(int(cls.tag)) + BER_len_enc(len(ll), size=size_len) + ll

@classmethod
Expand Down
Loading
Loading