if eoc_expected.tobytes() != EOC:
raise DecodeError(
"no EOC",
+ klass=self.__class__,
decode_path=decode_path,
offset=offset,
)
if not ctx.get("bered", False):
raise DecodeError(
"unallowed BER constructed encoding",
+ klass=self.__class__,
decode_path=decode_path,
offset=offset,
)
if vlen > l:
raise DecodeError(
"chunk out of bounds",
+ klass=self.__class__,
decode_path=len(chunks) - 1,
offset=chunks[-1].offset,
)
except TagMismatch:
raise DecodeError(
"expected BitString encoded chunk",
+ klass=self.__class__,
decode_path=sub_decode_path,
offset=sub_offset,
)
if len(chunks) == 0:
raise DecodeError(
"no chunks",
+ klass=self.__class__,
decode_path=decode_path,
offset=offset,
)
if chunk.bit_len % 8 != 0:
raise DecodeError(
"BitString chunk is not multiple of 8 bit",
+ klass=self.__class__,
decode_path=decode_path + (str(chunk_i),),
offset=chunk.offset,
)
if not ctx.get("bered", False):
raise DecodeError(
"unallowed BER constructed encoding",
+ klass=self.__class__,
decode_path=decode_path,
offset=offset,
)
if vlen > l:
raise DecodeError(
"chunk out of bounds",
+ klass=self.__class__,
decode_path=len(chunks) - 1,
offset=chunks[-1].offset,
)
except TagMismatch:
raise DecodeError(
"expected OctetString encoded chunk",
+ klass=self.__class__,
decode_path=sub_decode_path,
offset=sub_offset,
)
if len(chunks) == 0:
raise DecodeError(
"no chunks",
+ klass=self.__class__,
decode_path=decode_path,
offset=offset,
)