-
-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathimg4.py
More file actions
27 lines (19 loc) · 748 Bytes
/
img4.py
File metadata and controls
27 lines (19 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# SPDX-License-Identifier: MIT
from . import asn1
def img4p_extract(data):
decoder = asn1.Decoder()
decoder.start(data)
tag = decoder.peek()
assert tag.nr == asn1.Numbers.Sequence
assert tag.typ == asn1.Types.Constructed
decoder.enter()
tag, value = decoder.read()
assert tag == asn1.Tag(asn1.Numbers.IA5String, asn1.Types.Primitive, 0)
assert value == "IM4P"
tag, name = decoder.read()
assert tag == asn1.Tag(asn1.Numbers.IA5String, asn1.Types.Primitive, 0)
tag, unk = decoder.read()
assert tag == asn1.Tag(asn1.Numbers.IA5String, asn1.Types.Primitive, 0)
tag, data = decoder.read()
assert tag == asn1.Tag(asn1.Numbers.OctetString, asn1.Types.Primitive, 0)
return name, data