My ASN.1 Notes: Difference between revisions
| Line 42: | Line 42: | ||
Source: [https://www.etsi.org/standards ETSI TS 101 671 V3.15.1 (2018-06)] | Source: [https://www.etsi.org/standards ETSI TS 101 671 V3.15.1 (2018-06)] | ||
<pre>TimeStamp ::= CHOICE | <pre> | ||
LawfulInterceptionIdentifier ::= OCTET STRING (SIZE (1..25)) | |||
-- It is recommended to use ASCII characters in "a"…"z", "A"…"Z", "-", "_", ".", and "0"…"9". | |||
-- For sub-address option only "0"..."9" shall be used. | |||
National-Parameters ::= SET SIZE (1..40) OF OCTET STRING (SIZE (1..256)) | |||
-- Content defined by national law. | |||
Network-Identifier ::= SEQUENCE | |||
{ | |||
operator-Identifier [0] OCTET STRING (SIZE (1..5)), | |||
-- It is a notification of the NWO/AP/SvP in ASCII- characters. | |||
-- For sub-address option only "0"..."9" shall be used. | |||
network-Element-Identifier [1] Network-Element-Identifier OPTIONAL, | |||
... | |||
} | |||
Network-Element-Identifier ::= CHOICE | |||
{ | |||
e164-Format [1] OCTET STRING (SIZE (1..25)), | |||
-- E164 address of the node in international format. Coded in the same format as the | |||
-- calling party number parameter of the ISUP (parameter part: EN 300 356 [5]). | |||
x25-Format [2] OCTET STRING (SIZE (1..25)), | |||
-- X25 address | |||
iP-Format [3] OCTET STRING (SIZE (1..25)), | |||
-- IP address | |||
dNS-Format [4] OCTET STRING (SIZE (1..25)), | |||
-- DNS address | |||
..., | |||
iP-Address [5] IPAddress | |||
} | |||
TimeStamp ::= CHOICE | |||
{ | { | ||
localTime [0] LocalTimeStamp, | localTime [0] LocalTimeStamp, | ||
Revision as of 16:45, 25 August 2020
Resources
OSS Nokalva Note: I have used OSS Nokalva's ASN.1 Studio and really enjoyed it (UI could use a little love).
ETSI ASN.1 Object Identifiers Tree
Mobile Application Part (MAP) CommonDataTypes.asn
Python ASN.1 Resources
Pycrate is a french word for qualifying bad wine. The present software library has nothing to do with bad wine, it is simply a Python library for manipulating various digital formats in an easy way. It is the glorious successor of libmich, which was started 8 years ago and served well.
It provides basically a runtime for encoding and decoding data structures, including CSN.1 and ASN.1. Additionally, it features a 3G and LTE mobile core network.
pyasn1 is a free and open source implementation of ASN.1 types and codecs as a Python package. It has been first written to support particular protocol (SNMP) but then generalized to be suitable for a wide range of protocols based on ASN.1 specification.
asn1ate is a Python library for translating ASN.1 into other forms. It is intended for code generation from formal ASN.1 definitions, and a code generator for pyasn1 is included.
Python-ASN1 is a simple ASN.1 encoder and decoder for Python 2.6+ and 3.3+.
asn1tinydecoder.py is a simple and fast ASN.1 decoder without external libraries designed to parse large files.
Nice examples
Example explaining CHOICE tagging
Example to understand IMPLICIT tagging
TBCD
Telephony Binary-Coded Decimal strings are not part of the ASN.1 standard, but their use is prevalent in many telephony-related ASN.1 specifications.
Conversion of these types into standard numeric text strings is supported by Objective Systems software.
In general, BCD strings pack two numeric digits into a single byte value by using a four-bit nibble to hold each digit. By convention, the digits are reversed in TBCD strings, but there are no official standards for this encoding.
My Notes
Source: ETSI TS 101 671 V3.15.1 (2018-06)
LawfulInterceptionIdentifier ::= OCTET STRING (SIZE (1..25))
-- It is recommended to use ASCII characters in "a"…"z", "A"…"Z", "-", "_", ".", and "0"…"9".
-- For sub-address option only "0"..."9" shall be used.
National-Parameters ::= SET SIZE (1..40) OF OCTET STRING (SIZE (1..256))
-- Content defined by national law.
Network-Identifier ::= SEQUENCE
{
operator-Identifier [0] OCTET STRING (SIZE (1..5)),
-- It is a notification of the NWO/AP/SvP in ASCII- characters.
-- For sub-address option only "0"..."9" shall be used.
network-Element-Identifier [1] Network-Element-Identifier OPTIONAL,
...
}
Network-Element-Identifier ::= CHOICE
{
e164-Format [1] OCTET STRING (SIZE (1..25)),
-- E164 address of the node in international format. Coded in the same format as the
-- calling party number parameter of the ISUP (parameter part: EN 300 356 [5]).
x25-Format [2] OCTET STRING (SIZE (1..25)),
-- X25 address
iP-Format [3] OCTET STRING (SIZE (1..25)),
-- IP address
dNS-Format [4] OCTET STRING (SIZE (1..25)),
-- DNS address
...,
iP-Address [5] IPAddress
}
TimeStamp ::= CHOICE
{
localTime [0] LocalTimeStamp,
utcTime [1] UTCTime
}
LocalTimeStamp ::= SEQUENCE
{
generalizedTime [0] GeneralizedTime,
winterSummerIndication [1] ENUMERATED
{
notProvided(0),
winterTime(1),
summerTime(2),
...
}
}
List of common ASN.1 Types which includes UTCTime and GeneralizedTime in TimeStamp example above.