<s>
Abstract	B-Protocol
Syntax	I-Protocol
Notation	I-Protocol
One	I-Protocol
(	O
ASN.1	B-Protocol
)	O
is	O
a	O
standard	O
interface	B-General_Concept
description	I-General_Concept
language	I-General_Concept
for	O
defining	O
data	O
structures	O
that	O
can	O
be	O
serialized	B-Application
and	I-Application
deserialized	I-Application
in	O
a	O
cross-platform	O
way	O
.	O
</s>
<s>
It	O
is	O
broadly	O
used	O
in	O
telecommunications	O
and	O
computer	B-Architecture
networking	I-Architecture
,	O
and	O
especially	O
in	O
cryptography	O
.	O
</s>
<s>
Protocol	O
developers	O
define	O
data	O
structures	O
in	O
ASN.1	B-Protocol
modules	O
,	O
which	O
are	O
generally	O
a	O
section	O
of	O
a	O
broader	O
standards	O
document	O
written	O
in	O
the	O
ASN.1	B-Protocol
language	O
.	O
</s>
<s>
The	O
advantage	O
is	O
that	O
the	O
ASN.1	B-Protocol
description	O
of	O
the	O
data	O
encoding	O
is	O
independent	O
of	O
a	O
particular	O
computer	O
or	O
programming	O
language	O
.	O
</s>
<s>
Because	O
ASN.1	B-Protocol
is	O
both	O
human-readable	O
and	O
machine-readable	O
,	O
an	O
ASN.1	B-Protocol
compiler	O
can	O
compile	O
modules	O
into	O
libraries	O
of	O
code	O
,	O
codecs	B-General_Concept
,	O
that	O
decode	O
or	O
encode	O
the	O
data	O
structures	O
.	O
</s>
<s>
Some	O
ASN.1	B-Protocol
compilers	O
can	O
produce	O
code	O
to	O
encode	O
or	O
decode	O
several	O
encodings	O
,	O
e.g.	O
</s>
<s>
packed	O
,	O
BER	O
or	O
XML	B-Protocol
.	O
</s>
<s>
ASN.1	B-Protocol
is	O
a	O
joint	O
standard	O
of	O
the	O
International	O
Telecommunication	O
Union	O
Telecommunication	O
Standardization	O
Sector	O
(	O
ITU-T	O
)	O
in	O
ITU-T	O
Study	O
Group	O
17	O
and	O
ISO/IEC	O
,	O
originally	O
defined	O
in	O
1984	O
as	O
part	O
of	O
CCITT	O
X.409:1984	O
.	O
</s>
<s>
In	O
1988	O
,	O
ASN.1	B-Protocol
moved	O
to	O
its	O
own	O
standard	O
,	O
X.208	B-Protocol
,	O
due	O
to	O
wide	O
applicability	O
.	O
</s>
<s>
The	O
substantially	O
revised	O
1995	O
version	O
is	O
covered	O
by	O
the	O
X.680	B-Protocol
series	O
.	O
</s>
<s>
The	O
latest	O
revision	O
of	O
the	O
X.680	B-Protocol
series	O
of	O
recommendations	O
is	O
the	O
6.0	O
Edition	O
,	O
published	O
in	O
2021	O
.	O
</s>
<s>
ASN.1	B-Protocol
is	O
a	O
data	O
type	O
declaration	O
notation	O
.	O
</s>
<s>
Manipulation	O
of	O
variables	O
is	O
defined	O
in	O
other	O
languages	O
such	O
as	O
SDL	B-Application
(	O
Specification	B-Application
and	I-Application
Description	I-Application
Language	I-Application
)	O
for	O
executable	O
modeling	O
or	O
TTCN-3	B-Protocol
(	O
Testing	O
and	O
Test	O
Control	O
Notation	O
)	O
for	O
conformance	O
testing	O
.	O
</s>
<s>
Both	O
these	O
languages	O
natively	O
support	O
ASN.1	B-Protocol
declarations	O
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
import	O
an	O
ASN.1	B-Protocol
module	O
and	O
declare	O
a	O
variable	O
of	O
any	O
of	O
the	O
ASN.1	B-Protocol
types	O
declared	O
in	O
the	O
module	O
.	O
</s>
<s>
ASN.1	B-Protocol
is	O
used	O
to	O
define	O
a	O
large	O
number	O
of	O
protocols	O
.	O
</s>
<s>
+	O
Protocols	O
that	O
use	O
ASN.1	B-Protocol
Protocol	O
Specification	O
Specified	O
or	O
customary	O
encoding	O
rules	O
Uses	O
Interledger	O
Protocol	O
https://interledger.org/rfcs/asn1/index.html	O
Octet	O
Encoding	O
Rules	O
NTCIP	O
1103	O
-	O
Transport	O
Management	O
Protocols	O
NTCIP	O
1103	O
Octet	O
Encoding	O
Rules	O
Traffic	O
,	O
Transportation	O
,	O
and	O
Infrastructure	O
Management	O
X.500	B-Protocol
Directory	I-Protocol
Services	I-Protocol
The	O
ITU	O
X.500	B-Protocol
Recommendation	O
Series	O
Basic	O
Encoding	O
Rules	O
,	O
Distinguished	O
Encoding	O
Rules	O
LDAP	B-Protocol
,	O
TLS	O
(	O
X.509	O
)	O
Certificates	O
,	O
Authentication	O
Lightweight	B-Protocol
Directory	I-Protocol
Access	I-Protocol
Protocol	I-Protocol
(	O
LDAP	B-Protocol
)	O
Basic	O
Encoding	O
Rules	O
PKCS	O
Cryptography	O
Standards	O
PKCS	O
Cryptography	O
Standards	O
Basic	O
Encoding	O
Rules	O
and	O
Distinguished	O
Encoding	O
Rules	O
Asymmetric	O
Keys	O
,	O
certificate	O
bundles	O
X.400	B-Protocol
Message	I-Protocol
Handling	I-Protocol
The	O
ITU	O
X.400	B-Protocol
Recommendation	O
Series	O
An	O
early	O
competitor	O
to	O
email	O
EMV	O
EMVCo	O
Publications	O
Payment	O
cards	O
T.120	O
Multimedia	O
conferencing	O
The	O
ITU	O
T.120	O
Recommendation	O
Series	O
Basic	O
Encoding	O
Rules	O
,	O
Packed	O
Encoding	O
Rules	O
Microsoft	O
's	O
Remote	B-Protocol
Desktop	I-Protocol
Protocol	I-Protocol
(	O
RDP	O
)	O
Simple	B-Protocol
Network	I-Protocol
Management	I-Protocol
Protocol	I-Protocol
(	O
SNMP	B-Protocol
)	O
Basic	O
Encoding	O
Rules	O
Managing	O
and	O
monitoring	O
networks	O
and	O
computers	O
,	O
particularly	O
characteristics	O
pertaining	O
to	O
performance	O
and	O
reliability	O
Common	O
Management	O
Information	O
Protocol	O
(	O
CMIP	O
)	O
ITU	O
Recommendation	O
X.711	O
A	O
competitor	O
to	O
SNMP	B-Protocol
but	O
more	O
capable	O
and	O
not	O
nearly	O
as	O
popular	O
Signalling	O
System	O
No	O
.	O
</s>
<s>
7	O
(	O
SS7	O
)	O
The	O
ITU	O
Q.700	O
Recommendation	O
Series	O
Managing	O
telephone	O
connections	O
over	O
the	O
Public	O
Switched	O
Telephone	O
Network	O
(	O
PSTN	O
)	O
ITU	O
H-Series	O
Multimedia	O
Protocols	O
The	O
ITU	O
H.200	O
,	O
H.300	O
,	O
and	O
H.400	O
Recommendation	O
Series	O
Voice	O
Over	O
Internet	O
Protocol	O
(	O
VOIP	O
)	O
BioAPI	O
Interworking	O
Protocol	O
(	O
BIP	O
)	O
ISO/IEC	O
24708:2008	O
Common	O
Biometric	O
Exchange	O
Formats	O
Framework	O
(	O
CBEFF	O
)	O
NIST	O
IR	O
6529-A	O
Basic	O
Encoding	O
Rules	O
Authentication	O
Contexts	O
for	O
Biometrics	O
(	O
ACBio	O
)	O
ISO/IEC	O
24761:2019	O
Computer-supported	O
telecommunications	O
applications	O
(	O
CSTA	O
)	O
https://www.ecma-international.org/activities/Communications/TG11/cstaIII.htm	O
Basic	O
Encoding	O
Rules	O
Dedicated	O
short-range	O
communications	O
(	O
DSRC	O
)	O
SAE	O
J2735	O
Packed	O
Encoding	O
Rules	O
Vehicle	O
communication	O
IEEE	O
802.11p	O
(	O
IEEE	O
WAVE	O
)	O
IEEE	O
1609.2	O
Vehicle	O
communication	O
Intelligent	O
Transport	O
Systems	O
(	O
ETSI	O
ITS	O
)	O
ETSI	O
EN	O
302	O
637	O
2	O
(	O
CAM	O
)	O
ETSI	O
EN	O
302	O
637	O
3	O
(	O
DENM	O
)	O
Unaligned	O
Packed	O
Encoding	O
Rules	O
Vehicle	O
communication	O
Global	O
System	O
for	O
Mobile	O
Communications	O
(	O
GSM	O
)	O
http://www.ttfn.net/techno/smartcards/gsm11-11.pdf	O
2G	O
Mobile	O
Phone	O
Communications	O
General	O
Packet	O
Radio	O
Service	O
(	O
GPRS	O
)	O
/	O
Enhanced	O
Data	O
rates	O
for	O
GSM	O
Evolution	O
(	O
EDGE	O
)	O
http://www.3gpp.org/technologies/keywords-acronyms/102-gprs-edge	O
2.5G	O
Mobile	O
Phone	O
Communications	O
Universal	B-Protocol
Mobile	I-Protocol
Telecommunications	I-Protocol
System	I-Protocol
(	O
UMTS	B-Protocol
)	O
http://www.3gpp.org/DynaReport/25-series.htm	O
3G	B-Architecture
Mobile	I-Architecture
Phone	O
Communications	O
Long-Term	O
Evolution	O
(	O
LTE	O
)	O
http://www.3gpp.org/technologies/keywords-acronyms/98-lte	O
4G	B-Architecture
Mobile	I-Architecture
Phone	O
Communications	O
5G	O
https://www.3gpp.org/news-events/3gpp-news/1987-imt2020_workshop	O
5G	O
Mobile	O
Phone	O
Communications	O
Common	O
Alerting	O
Protocol	O
(	O
CAP	O
)	O
http://docs.oasis-open.org/emergency/cap/v1.2/CAP-v1.2-os.html	O
XML	B-Protocol
Encoding	I-Protocol
Rules	I-Protocol
Exchanging	O
Alert	O
Information	O
,	O
such	O
as	O
Amber	O
Alerts	O
Controller	B-Device
–	I-Device
pilot	I-Device
data	I-Device
link	I-Device
communications	I-Device
(	O
CPDLC	B-Device
)	O
Aeronautics	O
communications	O
Space	O
Link	O
Extension	O
Services	O
(	O
SLE	O
)	O
Space	O
systems	O
communications	O
Manufacturing	O
Message	O
Specification	O
(	O
MMS	O
)	O
ISO	B-General_Concept
9506-1:2003	O
Manufacturing	O
File	B-Protocol
Transfer	I-Protocol
,	I-Protocol
Access	I-Protocol
and	I-Protocol
Management	I-Protocol
(	O
FTAM	B-Protocol
)	O
An	O
early	O
and	O
more	O
capable	O
competitor	O
to	O
File	O
Transfer	O
Protocol	O
,	O
but	O
its	O
rarely	O
used	O
anymore	O
.	O
</s>
<s>
Remote	O
Operations	O
Service	O
Element	O
protocol	O
(	O
ROSE	O
)	O
ITU	O
Recommendations	O
X.880	O
,	O
X.881	O
,	O
and	O
X.882	O
An	O
early	O
form	O
of	O
Remote	B-Operating_System
procedure	I-Operating_System
call	I-Operating_System
Association	B-Protocol
Control	I-Protocol
Service	I-Protocol
Element	I-Protocol
(	O
ACSE	O
)	O
ITU	O
Recommendation	O
X.227	O
Building	O
Automation	O
and	O
Control	O
Networks	O
Protocol	O
(	O
BACnet	O
)	O
ASHRAE	O
135-2020	O
BACnet	O
Encoding	O
Rules	O
Building	O
automation	O
and	O
control	O
,	O
such	O
as	O
with	O
fire	O
alarms	O
,	O
elevators	O
,	O
HVAC	O
systems	O
,	O
etc	O
.	O
</s>
<s>
ASN.1	B-Protocol
is	O
closely	O
associated	O
with	O
a	O
set	O
of	O
encoding	O
rules	O
that	O
specify	O
how	O
to	O
represent	O
a	O
data	O
structure	O
as	O
a	O
series	O
of	O
bytes	B-Application
.	O
</s>
<s>
The	O
standard	O
ASN.1	B-Protocol
encoding	O
rules	O
include	O
:	O
</s>
<s>
+	O
ASN.1	B-Protocol
Encoding	O
Rules	O
Encoding	O
rules	O
Object	O
identifier	O
Object	O
descriptor	O
value	O
rowspan	O
=	O
2	O
rowspan	O
=	O
2	O
rowspan	O
=	O
2	O
rowspan	O
=	O
2	O
rowspan	O
=	O
2	O
Description	O
Dotted	O
Basic	O
Encoding	O
Rules	O
(	O
BER	O
)	O
ITU-T	O
X.690	B-Protocol
-	O
Basic	O
Encoding	O
Rules	O
(	O
BER	O
)	O
2.1.1	O
/ASN.1/Basic	O
-Encoding	O
Basic	O
Encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
ITU	O
X.690	B-Protocol
Octet	O
The	O
first	O
specified	O
encoding	O
rules	O
.	O
</s>
<s>
Encodes	O
elements	O
as	O
tag-length-value	B-Protocol
(	O
TLV	O
)	O
sequences	O
.	O
</s>
<s>
Distinguished	O
Encoding	O
Rules	O
(	O
DER	O
)	O
ITU-T	O
X.690	B-Protocol
-	O
Distinguished	O
Encoding	O
Rules	O
(	O
DER	O
)	O
2.1.2.1	O
/ASN.1/BERDerived/DistinguishedEncoding	O
Distinguished	O
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
ITU	O
X.690	B-Protocol
Octet	O
A	O
restricted	O
subset	O
of	O
the	O
Basic	O
Encoding	O
Rules	O
(	O
BER	O
)	O
.	O
</s>
<s>
Typically	O
used	O
for	O
things	O
that	O
are	O
digitally-signed	O
because	O
,	O
since	O
the	O
DER	O
allow	O
for	O
fewer	O
options	O
for	O
encoding	O
,	O
and	O
because	O
DER-encoded	O
values	O
are	O
more	O
likely	O
to	O
be	O
re-encoded	O
on	O
the	O
exact	O
same	O
bytes	B-Application
,	O
digital	O
signatures	O
produced	O
by	O
a	O
given	O
abstract	O
value	O
will	O
be	O
the	O
same	O
across	O
implementations	O
and	O
digital	O
signatures	O
produced	O
over	O
DER-encoded	O
data	O
will	O
be	O
less	O
susceptible	O
to	O
collision-based	O
attacks	O
.	O
</s>
<s>
Canonical	O
Encoding	O
Rules	O
(	O
CER	O
)	O
ITU-T	O
X.690	B-Protocol
-	O
Canonical	O
Encoding	O
Rules	O
(	O
CER	O
)	O
2.1.2.0	O
/ASN.1/BERDerived/CanonicalEncoding	O
Canonical	O
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
ITU	O
X.690	B-Protocol
Octet	O
A	O
restricted	O
subset	O
of	O
the	O
Basic	O
Encoding	O
Rules	O
(	O
BER	O
)	O
.	O
</s>
<s>
Employs	O
almost	O
all	O
of	O
the	O
same	O
restrictions	O
as	O
the	O
Distinguished	O
Encoding	O
Rules	O
(	O
DER	O
)	O
,	O
but	O
the	O
noteworthy	O
difference	O
is	O
that	O
the	O
CER	O
specify	O
that	O
many	O
large	O
values	O
(	O
especially	O
strings	O
)	O
are	O
to	O
be	O
"	O
chopped	O
up	O
"	O
into	O
individual	O
substring	O
elements	O
at	O
the	O
1000-byte	O
or	O
1000-character	O
mark	O
(	O
depending	O
on	O
the	O
data	O
type	O
)	O
.	O
</s>
<s>
Basic	O
Packed	O
Encoding	O
Rules	O
(	O
PER	O
)	O
AlignedITU-T	O
X.691	O
-	O
Packed	O
Encoding	O
Rules	O
(	O
PER	O
)	O
2.1.3.0.0	O
/ASN.1/PackedEncoding/Basic/Aligned	O
Packed	O
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
(	O
basic	O
aligned	O
)	O
ITU	O
X.691	O
Bit	O
Encodes	O
values	O
on	O
bits	O
,	O
but	O
if	O
the	O
bits	O
encoded	O
are	O
not	O
evenly	O
divisible	O
by	O
eight	O
,	O
padding	O
bits	O
are	O
added	O
until	O
an	O
integral	O
number	O
of	O
octets	O
encode	O
the	O
value	O
.	O
</s>
<s>
Basic	O
Packed	O
Encoding	O
Rules	O
(	O
PER	O
)	O
Unaligned	O
2.1.3.0.1	O
/ASN.1/PackedEncoding/Basic/Unaligned	O
Packed	O
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
(	O
basic	O
unaligned	O
)	O
ITU	O
X.691	O
Bit	O
A	O
variant	O
of	O
the	O
Aligned	O
Basic	O
Packed	O
Encoding	O
Rules	O
(	O
PER	O
)	O
,	O
but	O
it	O
does	O
not	O
pad	O
data	O
values	O
with	O
bits	O
to	O
produce	O
an	O
integral	O
number	O
of	O
octets	O
.	O
</s>
<s>
Canonical	O
Packed	O
Encoding	O
Rules	O
(	O
CPER	O
)	O
Aligned	O
2.1.3.1.0	O
/ASN.1/PackedEncoding/Canonical/Aligned	O
Packed	O
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
(	O
canonical	O
aligned	O
)	O
ITU	O
X.691	O
Bit	O
A	O
variant	O
of	O
the	O
Packed	O
Encoding	O
Rules	O
(	O
PER	O
)	O
that	O
specifies	O
a	O
single	O
way	O
of	O
encoding	O
values	O
.	O
</s>
<s>
Canonical	O
Packed	O
Encoding	O
Rules	O
(	O
CPER	O
)	O
Unaligned	O
2.1.3.1.1	O
/ASN.1/PackedEncoding/Canonical/Unaligned	O
Packed	O
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
(	O
canonical	O
unaligned	O
)	O
ITU	O
X.691	O
Bit	O
A	O
variant	O
of	O
the	O
Aligned	O
Canonical	O
Packed	O
Encoding	O
Rules	O
(	O
CPER	O
)	O
,	O
but	O
it	O
does	O
not	O
pad	O
data	O
values	O
with	O
bits	O
to	O
produce	O
an	O
integral	O
number	O
of	O
octets	O
.	O
</s>
<s>
Basic	O
XML	B-Protocol
Encoding	I-Protocol
Rules	I-Protocol
(	O
XER	O
)	O
ITU-T	O
X.693	O
-	O
XML	B-Protocol
Encoding	I-Protocol
Rules	I-Protocol
(	O
XER	O
)	O
2.1.5.0	O
/ASN.1/XMLEncoding/Basic	O
Basic	O
XML	B-Protocol
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
ITU	O
X.693	O
Character	O
Encodes	O
ASN.1	B-Protocol
data	O
as	O
XML	B-Protocol
.	O
</s>
<s>
Canonical	B-Protocol
XML	I-Protocol
Encoding	I-Protocol
Rules	I-Protocol
(	O
CXER	B-Protocol
)	O
2.1.5.1	O
/ASN.1/XMLEncoding/Canonical	O
Canonical	O
XML	B-Protocol
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
ITU	O
X.693	O
Character	O
Extended	O
XML	B-Protocol
Encoding	I-Protocol
Rules	I-Protocol
(	O
EXER	O
)	O
2.1.5.2	O
/ASN.1/XMLEncoding/Extended	O
Extended	O
XML	B-Protocol
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
ITU	O
X.693	O
Character	O
Octet	O
Encoding	O
Rules	O
(	O
OER	O
)	O
ITU-T	O
X.696	O
-	O
Octet	O
Encoding	O
Rules	O
(	O
OER	O
)	O
2.1.6.0	O
Basic	O
OER	O
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
ITU	O
X.696	O
Octet	O
A	O
set	O
of	O
encoding	O
rules	O
that	O
encodes	O
values	O
on	O
octets	O
,	O
but	O
does	O
not	O
encode	O
tags	O
or	O
length	O
determinants	O
like	O
the	O
Basic	O
Encoding	O
Rules	O
(	O
BER	O
)	O
.	O
</s>
<s>
In	O
addition	O
to	O
reducing	O
the	O
effort	O
of	O
developing	O
encoder/decoders	B-General_Concept
,	O
the	O
use	O
of	O
OER	O
can	O
decrease	O
bandwidth	O
utilization	O
(	O
though	O
not	O
as	O
much	O
as	O
the	O
Packed	O
Encoding	O
Rules	O
)	O
,	O
save	O
CPU	O
cycles	O
,	O
and	O
lower	O
encoding/decoding	O
latency	O
.	O
</s>
<s>
Canonical	O
Encoding	O
Rules	O
(	O
OER	O
)	O
2.1.6.1	O
Canonical	O
OER	O
encoding	O
of	O
a	O
single	O
ASN.1	B-Protocol
type	O
ITU	O
X.696	O
Octet	O
JSON	B-General_Concept
Encoding	O
Rules	O
(	O
JER	O
)	O
ITU-T	O
X.697	O
-	O
JavaScript	B-General_Concept
Object	I-General_Concept
Notation	I-General_Concept
Encoding	O
Rules	O
(	O
JER	O
)	O
ITU	O
X.697	O
Character	O
Encodes	O
ASN.1	B-Protocol
data	O
as	O
JSON	B-General_Concept
.	O
</s>
<s>
GSER	O
was	O
originally	O
designed	O
for	O
the	O
Lightweight	B-Protocol
Directory	I-Protocol
Access	I-Protocol
Protocol	I-Protocol
(	O
LDAP	B-Protocol
)	O
and	O
is	O
rarely	O
used	O
outside	O
of	O
it	O
.	O
</s>
<s>
The	O
use	O
of	O
GSER	O
in	O
actual	O
protocols	O
is	O
discouraged	O
since	O
not	O
all	O
character	O
string	O
encodings	O
supported	O
by	O
ASN.1	B-Protocol
can	O
be	O
reproduced	O
in	O
it	O
.	O
</s>
<s>
BACnet	O
Encoding	O
Rules	O
ASHRAE	O
135	O
Octet	O
Encodes	O
elements	O
as	O
tag-length-value	B-Protocol
(	O
TLV	O
)	O
sequences	O
like	O
the	O
Basic	O
Encoding	O
Rules	O
(	O
BER	O
)	O
.	O
</s>
<s>
Designed	O
to	O
produce	O
an	O
identical	O
encoding	O
from	O
ASN.1	B-Protocol
that	O
previously-existing	O
protocols	O
not	O
specified	O
in	O
ASN.1	B-Protocol
would	O
produce	O
.	O
</s>
<s>
It	O
is	O
incomplete	O
because	O
it	O
cannot	O
encode	O
and	O
decode	O
all	O
ASN.1	B-Protocol
data	O
types	O
.	O
</s>
<s>
ASN.1	B-Protocol
recommendations	O
provide	O
a	O
number	O
of	O
predefined	O
encoding	O
rules	O
.	O
</s>
<s>
If	O
none	O
of	O
the	O
existing	O
encoding	O
rules	O
are	O
suitable	O
,	O
the	O
Encoding	B-Protocol
Control	I-Protocol
Notation	I-Protocol
(	O
ECN	O
)	O
provides	O
a	O
way	O
for	O
a	O
user	O
to	O
define	O
his	O
or	O
her	O
own	O
customized	O
encoding	O
rules	O
.	O
</s>
<s>
Privacy-Enhanced	B-Protocol
Mail	I-Protocol
(	O
PEM	O
)	O
encoding	O
is	O
entirely	O
unrelated	O
to	O
ASN.1	B-Protocol
and	O
its	O
codecs	B-General_Concept
,	O
but	O
encoded	O
ASN.1	B-Protocol
data	O
,	O
which	O
is	O
often	O
binary	O
,	O
is	O
often	O
PEM-encoded	O
so	O
that	O
it	O
can	O
be	O
transmitted	O
as	O
textual	O
data	O
,	O
e.g.	O
</s>
<s>
over	O
SMTP	B-Protocol
relays	O
,	O
or	O
through	O
copy/paste	O
buffers	O
.	O
</s>
<s>
This	O
is	O
an	O
example	O
ASN.1	B-Protocol
module	O
defining	O
the	O
messages	O
(	O
data	O
structures	O
)	O
of	O
a	O
fictitious	O
Foo	O
Protocol	O
:	O
</s>
<s>
Conversation	O
flows	O
,	O
transaction	O
interchanges	O
,	O
and	O
states	O
are	O
not	O
defined	O
in	O
ASN.1	B-Protocol
,	O
but	O
are	O
left	O
to	O
other	O
notations	O
and	O
textual	O
description	O
of	O
the	O
protocol	O
.	O
</s>
<s>
Assuming	O
a	O
message	O
that	O
complies	O
with	O
the	O
Foo	O
Protocol	O
and	O
that	O
will	O
be	O
sent	O
to	O
the	O
receiving	O
party	O
,	O
this	O
particular	O
message	O
(	O
protocol	B-Protocol
data	I-Protocol
unit	I-Protocol
(	O
PDU	O
)	O
)	O
is	O
:	O
</s>
<s>
ASN.1	B-Protocol
supports	O
constraints	O
on	O
values	O
and	O
sizes	O
,	O
and	O
extensibility	O
.	O
</s>
<s>
Good	O
ASN.1	B-Protocol
compilers	O
will	O
generate	O
(	O
in	O
C	O
,	O
C++	O
,	O
Java	O
,	O
etc	O
.	O
)	O
</s>
<s>
To	O
send	O
the	O
myQuestion	O
message	O
through	O
the	O
network	O
,	O
the	O
message	O
is	O
serialized	O
(	O
encoded	O
)	O
as	O
a	O
series	O
of	O
bytes	B-Application
using	O
one	O
of	O
the	O
encoding	O
rules	O
.	O
</s>
<s>
DER	O
is	O
a	O
type	B-Protocol
–	I-Protocol
length	I-Protocol
–	I-Protocol
value	I-Protocol
encoding	O
,	O
so	O
the	O
sequence	O
above	O
can	O
be	O
interpreted	O
,	O
with	O
reference	O
to	O
the	O
standard	O
SEQUENCE	O
,	O
INTEGER	O
,	O
and	O
IA5String	B-Protocol
types	O
,	O
as	O
follows	O
:	O
</s>
<s>
(	O
IA5	O
means	O
the	O
full	O
7-bit	O
ISO	B-General_Concept
646	O
set	O
,	O
including	O
variants	O
,	O
</s>
<s>
Alternatively	O
,	O
it	O
is	O
possible	O
to	O
encode	O
the	O
same	O
ASN.1	B-Protocol
data	O
structure	O
with	O
XML	B-Protocol
Encoding	I-Protocol
Rules	I-Protocol
(	O
XER	O
)	O
to	O
achieve	O
greater	O
human	O
readability	O
"	O
over	O
the	O
wire	O
"	O
.	O
</s>
<s>
Additionally	O
,	O
the	O
bytes	B-Application
for	O
the	O
value	O
of	O
the	O
IA5String	B-Protocol
are	O
packed	O
using	O
7-bit	O
units	O
instead	O
of	O
8-bit	O
units	O
,	O
because	O
the	O
encoder	O
knows	O
that	O
encoding	O
an	O
IA5String	B-Protocol
byte	B-Application
value	O
requires	O
only	O
7	O
bits	O
.	O
</s>
<s>
However	O
the	O
length	O
bytes	B-Application
are	O
still	O
encoded	O
here	O
,	O
even	O
for	O
the	O
first	O
integer	O
tag	O
01	O
(	O
but	O
a	O
PER	O
packer	O
could	O
also	O
omit	O
it	O
if	O
it	O
knows	O
that	O
the	O
allowed	O
value	O
range	O
fits	O
on	O
8	O
bits	O
,	O
and	O
it	O
could	O
even	O
compact	O
the	O
single	O
value	O
byte	B-Application
05	O
with	O
less	O
than	O
8	O
bits	O
,	O
if	O
it	O
knows	O
that	O
allowed	O
values	O
can	O
only	O
fit	O
in	O
a	O
smaller	O
range	O
)	O
.	O
</s>
<s>
The	O
last	O
6	O
bits	O
in	O
the	O
encoded	O
PER	O
are	O
padded	O
with	O
null	O
bits	O
in	O
the	O
6	O
least	O
significant	O
bits	O
of	O
the	O
last	O
byte	B-Application
c0	O
:	O
these	O
extra	O
bits	O
may	O
not	O
be	O
transmitted	O
or	O
used	O
for	O
encoding	O
something	O
else	O
if	O
this	O
sequence	O
is	O
inserted	O
as	O
a	O
part	O
of	O
a	O
longer	O
unaligned	O
PER	O
sequence	O
.	O
</s>
<s>
This	O
means	O
that	O
unaligned	O
PER	O
data	O
is	O
essentially	O
an	O
ordered	O
stream	O
of	O
bits	O
,	O
and	O
not	O
an	O
ordered	O
stream	O
of	O
bytes	B-Application
like	O
with	O
aligned	O
PER	O
,	O
and	O
that	O
it	O
will	O
be	O
a	O
bit	O
more	O
complex	O
to	O
decode	O
by	O
software	O
on	O
usual	O
processors	O
because	O
it	O
will	O
require	O
additional	O
contextual	O
bit-shifting	O
and	O
masking	O
and	O
not	O
direct	O
byte	B-Application
addressing	O
(	O
but	O
the	O
same	O
remark	O
would	O
be	O
true	O
with	O
modern	O
processors	O
and	O
memory/storage	O
units	O
whose	O
minimum	O
addressable	O
unit	O
is	O
larger	O
than	O
1	O
octet	O
)	O
.	O
</s>
<s>
However	O
modern	O
processors	O
and	O
signal	O
processors	O
include	O
hardware	O
support	O
for	O
fast	O
internal	O
decoding	O
of	O
bit	O
streams	O
with	O
automatic	O
handling	O
of	O
computing	O
units	O
that	O
are	O
crossing	O
the	O
boundaries	O
of	O
addressable	O
storage	O
units	O
(	O
this	O
is	O
needed	O
for	O
efficient	O
processing	O
in	O
data	O
codecs	B-General_Concept
for	O
compression/decompression	O
or	O
with	O
some	O
encryption/decryption	O
algorithms	O
)	O
.	O
</s>
<s>
Most	O
of	O
the	O
tools	O
supporting	O
ASN.1	B-Protocol
do	O
the	O
following	O
:	O
</s>
<s>
parse	O
the	O
ASN.1	B-Protocol
files	O
,	O
</s>
<s>
A	O
list	O
of	O
tools	O
supporting	O
ASN.1	B-Protocol
can	O
be	O
found	O
on	O
the	O
.	O
</s>
<s>
ASN.1	B-Protocol
is	O
similar	O
in	O
purpose	O
and	O
use	O
to	O
protocol	B-Protocol
buffers	I-Protocol
and	O
Apache	B-Protocol
Thrift	I-Protocol
,	O
which	O
are	O
also	O
interface	B-General_Concept
description	I-General_Concept
languages	I-General_Concept
for	O
cross-platform	O
data	B-Application
serialization	I-Application
.	O
</s>
<s>
Like	O
those	O
languages	O
,	O
it	O
has	O
a	O
schema	O
(	O
in	O
ASN.1	B-Protocol
,	O
called	O
a	O
"	O
module	O
"	O
)	O
,	O
and	O
a	O
set	O
of	O
encodings	O
,	O
typically	O
type	B-Protocol
–	I-Protocol
length	I-Protocol
–	I-Protocol
value	I-Protocol
encodings	O
.	O
</s>
<s>
Unlike	O
them	O
,	O
ASN.1	B-Protocol
does	O
not	O
provide	O
a	O
single	O
and	O
readily	O
usable	O
open-source	O
implementation	O
,	O
and	O
is	O
published	O
as	O
a	O
specification	O
to	O
be	O
implemented	O
by	O
third-party	O
vendors	O
.	O
</s>
<s>
However	O
,	O
ASN.1	B-Protocol
,	O
defined	O
in	O
1984	O
,	O
predates	O
them	O
by	O
many	O
years	O
.	O
</s>
<s>
A	O
single	O
ASN.1	B-Protocol
message	O
can	O
include	O
data	O
from	O
multiple	O
modules	O
defined	O
in	O
multiple	O
standards	O
,	O
even	O
standards	O
defined	O
years	O
apart	O
.	O
</s>
<s>
ASN.1	B-Protocol
also	O
includes	O
built-in	O
support	O
for	O
constraints	O
on	O
values	O
and	O
sizes	O
.	O
</s>
<s>
Values	O
used	O
as	O
constraints	O
can	O
either	O
be	O
literals	O
used	O
in	O
the	O
PDU	O
specification	O
,	O
or	O
ASN.1	B-Protocol
values	O
specified	O
elsewhere	O
in	O
the	O
schema	O
file	O
.	O
</s>
<s>
Some	O
ASN.1	B-Protocol
tools	O
will	O
make	O
these	O
ASN.1	B-Protocol
values	O
available	O
to	O
programmers	O
in	O
the	O
generated	O
source	O
code	O
.	O
</s>
<s>
This	O
significantly	O
aids	O
protocol	O
development	O
;	O
the	O
protocol	O
's	O
constants	O
can	O
be	O
altered	O
in	O
the	O
ASN.1	B-Protocol
schema	O
and	O
all	O
implementations	O
are	O
updated	O
simply	O
by	O
recompiling	O
,	O
promoting	O
a	O
rapid	O
and	O
low	O
risk	O
development	O
cycle	O
.	O
</s>
<s>
If	O
the	O
ASN.1	B-Protocol
tools	O
properly	O
implement	O
constraints	O
checking	O
in	O
the	O
generated	O
source	O
code	O
,	O
this	O
acts	O
to	O
automatically	O
validate	O
protocol	O
data	O
during	O
program	O
operation	O
.	O
</s>
<s>
Generally	O
ASN.1	B-Protocol
tools	O
will	O
include	O
constraints	O
checking	O
into	O
the	O
generated	O
serialization	B-Application
/	O
deserialization	B-Application
routines	O
,	O
raising	O
errors	O
or	O
exceptions	O
if	O
out-of-bounds	O
data	O
is	O
encountered	O
.	O
</s>
<s>
It	O
is	O
complex	O
to	O
implement	O
all	O
aspects	O
of	O
ASN.1	B-Protocol
constraints	O
in	O
an	O
ASN.1	B-Protocol
compiler	O
.	O
</s>
<s>
XML	B-Language
schema	I-Language
and	O
JSON	B-General_Concept
schema	O
both	O
support	O
similar	O
constraints	O
concepts	O
.	O
</s>
<s>
ASN.1	B-Protocol
is	O
visually	O
similar	O
to	O
Augmented	O
Backus-Naur	O
form	O
(	O
ABNF	O
)	O
,	O
which	O
is	O
used	O
to	O
define	O
many	O
Internet	O
protocols	O
like	O
HTTP	B-Protocol
and	O
SMTP	B-Protocol
.	O
</s>
<s>
However	O
,	O
in	O
practice	O
they	O
are	O
quite	O
different	O
:	O
ASN.1	B-Protocol
defines	O
a	O
data	O
structure	O
,	O
which	O
can	O
be	O
encoded	O
in	O
various	O
ways	O
(	O
e.g.	O
</s>
<s>
JSON	B-General_Concept
,	O
XML	B-Protocol
,	O
binary	O
)	O
.	O
</s>
<s>
ABNF	O
tends	O
to	O
be	O
used	O
more	O
frequently	O
for	O
defining	O
textual	O
,	O
human-readable	O
protocols	O
,	O
and	O
generally	O
is	O
not	O
used	O
to	O
define	O
type	B-Protocol
–	I-Protocol
length	I-Protocol
–	I-Protocol
value	I-Protocol
encodings	O
.	O
</s>
<s>
Many	O
programming	O
languages	O
define	O
language-specific	O
serialization	B-Application
formats	O
.	O
</s>
<s>
JSON	B-General_Concept
and	O
XML	B-Protocol
similarly	O
do	O
not	O
require	O
a	O
schema	O
,	O
making	O
them	O
easy	O
to	O
use	O
.	O
</s>
<s>
They	O
are	O
also	O
both	O
cross-platform	O
standards	O
that	O
are	O
broadly	O
popular	O
for	O
communications	O
protocols	O
,	O
particularly	O
when	O
combined	O
with	O
a	O
JSON	B-General_Concept
schema	O
or	O
XML	B-Language
schema	I-Language
.	O
</s>
<s>
Some	O
ASN.1	B-Protocol
tools	O
are	O
able	O
to	O
translate	O
between	O
ASN.1	B-Protocol
and	O
XML	B-Language
schema	I-Language
(	O
XSD	O
)	O
.	O
</s>
<s>
This	O
makes	O
it	O
possible	O
for	O
a	O
protocol	O
to	O
be	O
defined	O
in	O
ASN.1	B-Protocol
,	O
and	O
also	O
automatically	O
in	O
XSD	O
.	O
</s>
<s>
Thus	O
it	O
is	O
possible	O
(	O
though	O
perhaps	O
ill-advised	O
)	O
to	O
have	O
in	O
a	O
project	O
an	O
XSD	O
schema	O
being	O
compiled	O
by	O
ASN.1	B-Protocol
tools	O
producing	O
source	O
code	O
that	O
serializes	B-Application
objects	O
to/from	O
JSON	B-General_Concept
wireformat	O
.	O
</s>
<s>
A	O
more	O
practical	O
use	O
is	O
to	O
permit	O
other	O
sub-projects	O
to	O
consume	O
an	O
XSD	O
schema	O
instead	O
of	O
an	O
ASN.1	B-Protocol
schema	O
,	O
perhaps	O
suiting	O
tools	O
availability	O
for	O
the	O
sub-projects	O
language	O
of	O
choice	O
,	O
with	O
XER	O
used	O
as	O
the	O
protocol	O
wireformat	O
.	O
</s>
<s>
For	O
more	O
detail	O
,	O
see	O
Comparison	B-Application
of	I-Application
data	I-Application
serialization	I-Application
formats	I-Application
.	O
</s>
