Skip to content

Commit

Permalink
Returning offset for multiple object ASN.1 stream with separated records
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladislav Andel committed Feb 3, 2020
1 parent c09b87c commit b6c592f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions asn1crypto/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Asn1Value(object):
_native = None

@classmethod
def load(cls, encoded_data, strict=False, **kwargs):
def load(cls, encoded_data, strict=False, return_offset=False, **kwargs):
"""
Loads a BER/DER-encoded byte string using the current class as the spec
Expand All @@ -227,8 +227,12 @@ def load(cls, encoded_data, strict=False, **kwargs):
if cls.tag is not None:
spec = cls

value, _ = _parse_build(encoded_data, spec=spec, spec_params=kwargs, strict=strict)
return value
if return_offset:
value, new_pointer = _parse_build(encoded_data, spec=spec, spec_params=kwargs, strict=strict)
return value, new_pointer
else:
value, _ = _parse_build(encoded_data, spec=spec, spec_params=kwargs, strict=strict)
return value

def __init__(self, explicit=None, implicit=None, no_explicit=False, tag_type=None, class_=None, tag=None,
optional=None, default=None, contents=None, method=None):
Expand Down

0 comments on commit b6c592f

Please sign in to comment.