Information technology - ASN.1 encoding rules - Part 7: Specification of Octet Encoding Rules (OER)

ISO/IEC 8825-7:2014 specifies a set of Basic Octet Encoding Rules (BASIC-OER) that may be used to derive a transfer syntax for values of the types defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, Rec. ITU-T X.681 | ISO/IEC 8824-2, Rec. ITU-T X.682 | ISO/IEC 8824-3, Rec. ITU-T X.683 | ISO/IEC 8824-4. ISO/IEC 8825-7:2014 also specifies a set of Canonical Octet Encoding Rules (CANONICAL-OER) which provides constraints on the Basic Octet Encoding Rules and produces a unique encoding for any given ASN.1 value. It is implicit in the specification of these encoding rules that they are also to be used for decoding. The encoding rules specified in this Recommendation | International Standard: ? are used at the time of communication; ? are intended for use in circumstances where encoding/decoding speed is the major concern in the choice of encoding rules; ? allow the extension of an abstract syntax by addition of extra values for all forms of extensibility described in Rec. ITU-T X.680 | ISO/IEC 8824-1.

Technologies de l'information — Règles de codage ASN.1 — Partie 7: Spécification des règles de codage des octets (OER)

General Information

Status
Withdrawn
Publication Date
19-Nov-2014
Withdrawal Date
19-Nov-2014
Current Stage
9599 - Withdrawal of International Standard
Start Date
12-Nov-2015
Completion Date
30-Oct-2025
Ref Project

Relations

Standard
ISO/IEC 8825-7:2014 - Information technology -- ASN.1 encoding rules
English language
30 pages
sale 15% off
Preview
sale 15% off
Preview

Frequently Asked Questions

ISO/IEC 8825-7:2014 is a standard published by the International Organization for Standardization (ISO). Its full title is "Information technology - ASN.1 encoding rules - Part 7: Specification of Octet Encoding Rules (OER)". This standard covers: ISO/IEC 8825-7:2014 specifies a set of Basic Octet Encoding Rules (BASIC-OER) that may be used to derive a transfer syntax for values of the types defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, Rec. ITU-T X.681 | ISO/IEC 8824-2, Rec. ITU-T X.682 | ISO/IEC 8824-3, Rec. ITU-T X.683 | ISO/IEC 8824-4. ISO/IEC 8825-7:2014 also specifies a set of Canonical Octet Encoding Rules (CANONICAL-OER) which provides constraints on the Basic Octet Encoding Rules and produces a unique encoding for any given ASN.1 value. It is implicit in the specification of these encoding rules that they are also to be used for decoding. The encoding rules specified in this Recommendation | International Standard: ? are used at the time of communication; ? are intended for use in circumstances where encoding/decoding speed is the major concern in the choice of encoding rules; ? allow the extension of an abstract syntax by addition of extra values for all forms of extensibility described in Rec. ITU-T X.680 | ISO/IEC 8824-1.

ISO/IEC 8825-7:2014 specifies a set of Basic Octet Encoding Rules (BASIC-OER) that may be used to derive a transfer syntax for values of the types defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, Rec. ITU-T X.681 | ISO/IEC 8824-2, Rec. ITU-T X.682 | ISO/IEC 8824-3, Rec. ITU-T X.683 | ISO/IEC 8824-4. ISO/IEC 8825-7:2014 also specifies a set of Canonical Octet Encoding Rules (CANONICAL-OER) which provides constraints on the Basic Octet Encoding Rules and produces a unique encoding for any given ASN.1 value. It is implicit in the specification of these encoding rules that they are also to be used for decoding. The encoding rules specified in this Recommendation | International Standard: ? are used at the time of communication; ? are intended for use in circumstances where encoding/decoding speed is the major concern in the choice of encoding rules; ? allow the extension of an abstract syntax by addition of extra values for all forms of extensibility described in Rec. ITU-T X.680 | ISO/IEC 8824-1.

ISO/IEC 8825-7:2014 is classified under the following ICS (International Classification for Standards) categories: 35.100.60 - Presentation layer. The ICS classification helps identify the subject area and facilitates finding related standards.

ISO/IEC 8825-7:2014 has the following relationships with other standards: It is inter standard links to ISO/IEC 8825-7:2015. Understanding these relationships helps ensure you are using the most current and applicable version of the standard.

You can purchase ISO/IEC 8825-7:2014 directly from iTeh Standards. The document is available in PDF format and is delivered instantly after payment. Add the standard to your cart and complete the secure checkout process. iTeh Standards is an authorized distributor of ISO standards.

Standards Content (Sample)


INTERNATIONAL ISO/IEC
STANDARD 8825-7
First edition
2014-12-01
Information technology —
ASN.1 encoding rules —
Part 7:
Specification of Octet Encoding Rules
(OER)
Technologies de l'information -- Règles de codage ASN.1 —
Partie 7: Spécification des règles de codage des octets (OER)

Reference number
©
ISO/IEC 2014
©  ISO/IEC 2014
All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any
means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission.
Permission can be requested from either ISO at the address below or ISO’s member body in the country of the requester.
ISO copyright office
Case postale 56 x CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org
Web www.iso.org
Published in Switzerland
ii © ISO/IEC 2014 – All rights reserved

CONTENTS
Page
1 Scope . 1
2 Normative references. 1
2.1 Identical Recommendations | International Standards . 1
2.2 Additional references . 1
3 Definitions . 2
3.1 Specification of basic notation . 2
3.2 Information object specification . 2
3.3 Constraint specification . 2
3.4 Parameterization of ASN.1 specification . 2
3.5 Basic Encoding Rules (BER) . 2
3.6 Packed Encoding Rules (PER) . 2
3.7 Additional definitions . 2
4 Abbreviations . 4
5 Convention . 4
6 Encodings specified by this Recommendation | International Standard . 4
7 Conformance . 5
8 General provisions . 5
8.1 Use of the type notation . 5
8.2 Constraints . 5
8.3 Type and value model used for encoding . 7
8.4 Types to be encoded . 7
8.5 Production of a complete OER encoding . 7
8.6 Length determinant . 7
8.7 Encoding of tags . 8
9 Encoding of Boolean values . 8
10 Encoding of integer values . 8
11 Encoding of enumerated values . 9
12 Encoding of real values . 10
13 Encoding of bitstring values . 11
13.1 General . 11
13.2 Encoding of bitstring types with a fixed size . 11
13.3 Encoding of bitstring types with a variable size . 11
14 Encoding of octetstring values . 11
15 Encoding of the null value . 11
16 Encoding of sequence values . 11
17 Encoding of sequence-of values . 13
18 Encoding of set values . 13
19 Encoding of set-of values . 13
20 Encoding of choice values . 13
21 Encoding of object identifier values . 13
22 Encoding of relative object identifier values . 14
23 Encoding of values of the internationalized resource reference type . 14
24 Encoding of values of the relative internationalized resource reference type . 14
25 Encoding of values of the embedded-pdv type . 14
26 Encoding of values of the external type . 14
27 Encoding of values of the restricted character string types . 14
28 Encoding of values of the unrestricted character string type . 15
Rec. ITU-T X.696 (08/2014) iii

Page
29 Encoding of values of the time types . 16
29.1 General . 16
29.2 Optimized encoding of time subtypes with the Basic=Date property setting . 17
29.3 Optimized encoding of time subtypes with the Basic=Time property setting . 18
29.4 Optimized encoding of time subtypes with the Basic=Interval property setting . 19
30 Encoding of open type values . 20
31 Canonical Octet Encoding Rules . 20
32 Object identifier values referencing the encoding rules . 21
Annex A – Example of OER encodings . 22
A.1 ASN.1 description of the record structure . 22
A.2 ASN.1 description of a record value . 22
A.3 BASIC-OER and CANONICAL-OER representation of this record value . 22
Annex B – Interoperability with NTCIP 1102:2004 . 25
Bibliography . 26

iv Rec. ITU-T X.696 (08/2014)
Foreword
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical
Commission) form the specialized system for worldwide standardization. National bodies that are members of
ISO or IEC participate in the development of International Standards through technical committees
established by the respective organization to deal with particular fields of technical activity. ISO and IEC
technical committees collaborate in fields of mutual interest. Other international organizations, governmental
and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information
technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1.
International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.
The main task of the joint technical committee is to prepare International Standards. Draft International
Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as
an International Standard requires approval by at least 75 % of the national bodies casting a vote.
Attention is drawn to the possibility that some of the elements of this document may be the subject of patent
rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.
ISO/IEC 8825-7 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 6, Telecommunications and information exchange between systems, in collaboration with
ITU-T. The identical text is published as ITU-T X.696 (08/2014).
v
© ISO/IEC 2014 – All rights reserved

Introduction
The publications Rec. ITU-T X.680 | ISO/IEC 8824-1, Rec. ITU-T X.681 | ISO/IEC 8824-2, Rec. ITU-T X.682 |
ISO/IEC 8824-3, Rec. ITU-T X.683 | ISO/IEC 8824-4 together describe Abstract Syntax Notation One (ASN.1), a
notation for the definition of messages to be exchanged between peer applications.
This Recommendation | International Standard defines encoding rules that may be applied to values of ASN.1 types which
have been defined using the notation specified in the above-mentioned publications. Application of these encoding rules
produces a transfer syntax for such values. It is implicit in the specification of these encoding rules that they are also to
be used for decoding.
There are more than one set of encoding rules that can be applied to values of ASN.1 types. This Recommendation |
International Standard defines two sets of Octet Encoding Rules, so-called because the encoding of every type takes a
whole number of octets. Encoding and decoding data with the Octet Encoding Rules is usually faster than encoding and
decoding the same data with the Basic Encoding Rules (described in Rec. ITU-T X.690 | ISO/IEC 8825-1) or the Packed
Encoding Rules (described in Rec. ITU-T X.691 | ISO/IEC 8825-2).
NOTE – The encoding rules specified in this Recommendation | International Standard derive from the Octet Encoding Rules
(OER) published by American Association of State Highway and Transportation Officials (AASHTO), Institute of Transportation
Engineers (ITE) and National Electrical Manufacturers Association (NEMA) as NTCIP 1102:2004. In most practical cases, an
implementation of this Recommendation | International Standard can interoperate with an implementation of NTCIP 1102.
Clauses 8 to 30 specify the BASIC-OER encoding of ASN.1 types.
Clause 31 specifies the CANONICAL-OER encoding of ASN.1 types.
Annex A is informative and contains examples of BASIC-OER and CANONICAL-OER encodings.
vi Rec. ITU-T X.696 (08/2014)
INTERNATIONAL STANDARD
ITU-T RECOMMENDATION
Information technology – ASN.1 encoding rules: Specification of
Octet Encoding Rules (OER)
1 Scope
This Recommendation | International Standard specifies a set of Basic Octet Encoding Rules (BASIC-OER) that may be
used to derive a transfer syntax for values of the types defined in Rec. ITU-T X.680 | ISO/IEC 8824-1, Rec. ITU-T X.681
| ISO/IEC 8824-2, Rec. ITU-T X.682 | ISO/IEC 8824-3, Rec. ITU-T X.683 | ISO/IEC 8824-4. This Recommendation |
International Standard also specifies a set of Canonical Octet Encoding Rules (CANONICAL-OER) which provides
constraints on the Basic Octet Encoding Rules and produces a unique encoding for any given ASN.1 value. It is implicit
in the specification of these encoding rules that they are also to be used for decoding.
The encoding rules specified in this Recommendation | International Standard:
– are used at the time of communication;
– are intended for use in circumstances where encoding/decoding speed is the major concern in the choice
of encoding rules;
– allow the extension of an abstract syntax by addition of extra values for all forms of extensibility described
in Rec. ITU-T X.680 | ISO/IEC 8824-1.
2 Normative references
The following Recommendations and International Standards contain provisions which, through reference in this text,
constitute provisions of this Recommendation | International Standard. At the time of publication, the editions indicated
were valid. All Recommendations and Standards are subject to revision, and parties to agreements based on this
Recommendation | International Standard are encouraged to investigate the possibility of applying the most recent edition
of the Recommendations and Standards listed below. Members of IEC and ISO maintain registers of currently valid
International Standards. The Telecommunication Standardization Bureau of the ITU maintains a list of currently valid
ITU-T Recommendations.
NOTE – This Recommendation | International Standard is based on ISO/IEC 10646:2003 and the Unicode standard version
3.2.0:2002. It cannot be applied using later versions of these two standards.
2.1 Identical Recommendations | International Standards
– Recommendation ITU-T X.680 (2008) | ISO/IEC 8824-1:2008, Information technology – Abstract Syntax
Notation One (ASN.1): Specification of basic notation.
– Recommendation ITU-T X.681 (2008) | ISO/IEC 8824-2:2008, Information technology – Abstract Syntax
Notation One (ASN.1): Information object specification.
– Recommendation ITU-T X.682 (2008) | ISO/IEC 8824-3:2008, Information technology – Abstract Syntax
Notation One (ASN.1): Constraint specification.
– Recommendation ITU-T X.683 (2008) | ISO/IEC 8824-4:2008, Information technology – Abstract Syntax
Notation One (ASN.1): Parameterization of ASN.1 specifications.
– Recommendation ITU-T X.690 (2008) | ISO/IEC 8825-1:2008, Information technology – ASN.1 encoding
rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished
Encoding Rules (DER).
– Recommendation ITU-T X.691 (2008) | ISO/IEC 8825-2:2008, Information technology – ASN.1 encoding
rules: Specification of Packed Encoding Rules (PER).
2.2 Additional references
– ISO/IEC 2375:2003, Information technology – Procedure for registration of escape sequences and coded
character sets.
– ISO International Register of Coded Character Sets to be Used with Escape Sequences.
– ISO/IEC 10646:2003, Information technology – Universal Multiple-Octet Coded Character Set (UCS).
Rec. ITU-T X.696 (08/2014) 1
3 Definitions
For the purposes of this Recommendation | International Standard, the following definitions apply.
3.1 Specification of basic notation
For the purposes of this Recommendation | International Standard, all the definitions in Rec. ITU-T X.680 |
ISO/IEC 8824-1 apply.
3.2 Information object specification
For the purposes of this Recommendation | International Standard, all the definitions in Rec. ITU-T X.681 |
ISO/IEC 8824-2 apply.
3.3 Constraint specification
This Recommendation | International Standard makes use of the following terms defined in Rec. ITU-T X.682 |
ISO/IEC 8824-3:
a) component relation constraint;
b) table constraint.
3.4 Parameterization of ASN.1 specification
This Recommendation | International Standard makes use of the following term defined in Rec. ITU-T X.683 |
ISO/IEC 8824-4:
– variable constraint.
3.5 Basic Encoding Rules (BER)
This Recommendation | International Standard makes use of the following terms defined in Rec. ITU-T X.690 |
ISO/IEC 8825-1:
a) data value;
b) dynamic conformance;
c) encoding (of a data value);
d) receiver;
e) sender;
f) static conformance.
3.6 Packed Encoding Rules (PER)
This Recommendation | International Standard makes use of the following terms defined in Rec. ITU-T X.691 |
ISO/IEC 8825-2:
a) canonical encoding;
b) composite type;
c) composite value;
d) known-multiplier character string type;
e) outermost type;
f) relay-safe encoding;
g) simple type;
h) textually dependent.
3.7 Additional definitions
For the purposes of this Recommendation | International Standard, the following definitions apply.
2 Rec. ITU-T X.696 (08/2014)
3.7.1 abstract syntax value: A value of an abstract syntax (defined as a set of values of a single ASN.1 type) which
is to be encoded by BASIC-OER or CANONICAL-OER, or which is generated by BASIC-OER or CANONICAL-OER
decoding.
3.7.2 effective value constraint (of an integer type): The smallest integer range that includes all the values of the
integer type that are permitted by the OER-visible constraints (see 8.2.7).
3.7.3 effective size constraint (of a string type): The smallest integer range that includes the lengths of all the values
of the string type that are permitted by the OER-visible constraints (see 8.2.8).
3.7.4 fixed-size signed number: A word (see 3.7.13) representing a negative, zero or positive whole number encoded
as a signed integer encoding (see 3.7.9).
NOTE 1 – The least significant bit of the whole number is stored in bit 1 of the last octet of the word.
NOTE 2 – The range of integers that can be encoded as fixed-size signed numbers is −128 to 127 for a one-octet word,
−32768 to 32767 for a two-octet word, −2147483648 to 2147483647 for a four-octet word, and
−9223372036854775808 to 9223372036854775807 for an eight-octet word.
3.7.5 fixed-size unsigned number: A word (see 3.7.13) representing a zero or positive whole number encoded as an
unsigned integer encoding (see 3.7.10).
NOTE 1 – The least significant bit of the whole number is stored in bit 1 of the last octet of the word.
NOTE 2 – The smallest integer that can be encoded as fixed-size unsigned numbers of any size is 0. The largest integer that can be
encoded as a fixed-size unsigned number is 255 for a one-octet word, 65535 for a two-octet word, 4294967295 for a four-octet
word, and 18446744073709551615 for an eight-octet word.
3.7.6 length determinant: A group of one or more consecutive octets encoding the length of a series of octets
(see 8.6).
3.7.7 octet: A group of eight consecutive bits, numbered from bit 8 (the most significant bit) to bit 1 (the least
significant bit).
NOTE – Within an OER encoding, each octet starts at a location that is a whole multiple of eight bits from the first bit of the
encoding.
3.7.8 OER-visible constraint: An instance of use of the ASN.1 constraint notation that affects the OER encoding of
a value.
3.7.9 signed integer encoding: The encoding of a whole number into a group of consecutive octets of a specified
length as a 2's-complement binary integer, which provides representations for whole numbers that are equal to, greater
than or less than zero.
NOTE – The value of a signed integer encoding is derived by numbering the bits in the octets of the group, starting with bit 1 of
N
the last octet and ending the numbering with bit 8 of the first octet. Each bit is assigned a numerical value of 2 , where N is its
position (starting from 0) in the above numbering sequence. The value of the signed integer encoding is obtained by summing the
numerical values assigned to each bit for those bits which are set to one, excluding bit 8 of the first octet, and then reducing this
value by the numerical value assigned to bit 8 of the first octet if that bit is set to one.
3.7.10 unsigned integer encoding: The encoding of a whole number into a group of consecutive octets of a specified
length as an unsigned binary integer, which provides representations for whole numbers that are equal to or greater than
zero.
NOTE – The value of an unsigned integer encoding is derived by numbering the bits in the octets of the group, starting with bit 1
N
of the last octet and ending the numbering with bit 8 of the first octet. Each bit is assigned a numerical value of 2 , where N is its
position (starting from 0) in the above numbering sequence. The value of the unsigned integer encoding is obtained by summing
the numerical values assigned to each bit for those bits which are set to one.
3.7.11 variable-size signed number: A group of one or more consecutive octets containing a negative, zero, or
positive whole number encoded as a signed integer encoding, with the least significant bit of the binary number stored in
bit 1 of the last octet of the variable-size signed number.
NOTE – There are no restrictions to the length of such a group of octets. In particular, the Basic Octet Encoding Rules (but not the
Canonical Octet Encoding Rules) allow the presence of redundant octets set to 0 (for zero or positive values) or 255 (for negative
values) at the beginning of the group.
3.7.12 variable-size unsigned number: A group of one or more consecutive octets containing a zero or positive whole
number encoded as an unsigned integer encoding, with the least significant bit of the binary number stored in bit 1 of the
last octet of the variable-size unsigned number.
NOTE – There are no restrictions to the length of such a group of octets. In particular, the Basic Octet Encoding Rules (but not the
Canonical Octet Encoding Rules) allow the presence of redundant octets set to 0 at the beginning of the group.
3.7.13 word: A group of one, two, four or eight consecutive octets containing the encoding of a whole number, where
the first octet contains the most significant part of the number and the last octet contains the least significant part of the
number.
Rec. ITU-T X.696 (08/2014) 3
NOTE 1 – A single octet is also a word according to this definition. The octet ordering of words consisting of 2, 4 or 8 octets is
big-endian.
NOTE 2 – Within an OER encoding, a word can start at any location within the encoding that is a whole number of octets from the
beginning of the encoding (that is, there is no requirement that a word should start on a word boundary).
4 Abbreviations
For the purposes of this Recommendation | International Standard, the following abbreviations apply:
ASN.1 Abstract Syntax Notation One
BER Basic Encoding Rules of ASN.1
ITS Intelligent Transportation Systems
NTCIP National Transportation Communications for ITS Protocol
OER Octet Encoding Rules of ASN.1
PER Packed Encoding Rules of ASN.1
PDU Protocol Data Unit
5 Convention
For the purposes of this Recommendation | International Standard, the bits of an octet are numbered from 8 to 1, where
bit 8 is the most significant bit and bit 1 is the least significant bit.
6 Encodings specified by this Recommendation | International Standard
6.1 This Recommendation | International Standard specifies two sets of encoding rules (together with their
associated object identifiers) which can be used to encode and decode the values of an abstract syntax defined as the
values of a single (known) ASN.1 type. This clause describes their applicability and properties.
6.2 Without knowledge of the type of the value encoded, it is not possible to determine the structure of the encoding.
In particular, the end of the encoding cannot be determined from the encoding itself without knowledge of the type being
encoded.
6.3 OER encodings are always relay-safe provided the abstract values of the types EXTERNAL, EMBEDDED PDV and
CHARACTER STRING are constrained to prevent the carriage of OSI presentation context identifiers.
6.4 The most general set of encoding rules specified in this Recommendation | International Standard is
BASIC-OER, which does not in general produce a canonical encoding.
6.5 A second set of encoding rules specified in this Recommendation | International Standard is
CANONICAL-OER, which produces encodings that are canonical. This is defined as a restriction of implementation-
dependent choices in the BASIC-OER encoding.
NOTE 1 – CANONICAL-OER produces encodings that have applications when authenticators need to be applied to abstract
values.
NOTE 2 – Any implementation conforming to CANONICAL-OER for encoding is conformant to BASIC-OER for encoding. Any
implementation conforming to BASIC-OER for decoding is conformant to CANONICAL-OER for decoding. Thus, encodings
made according to CANONICAL-OER are encodings that are permitted by BASIC-OER.
6.6 If a type encoded with BASIC-OER or CANONICAL-OER contains EXTERNAL, EMBEDDED PDV or CHARACTER
STRING types, then the outer encoding ceases to be relay-safe unless the transfer syntax used for all the EXTERNAL,
EMBEDDED PDV or CHARACTER STRING types is relay-safe. If a type encoded with CANONICAL-OER contains
EXTERNAL, EMBEDDED PDV or CHARACTER STRING types, then the outer encoding ceases to be canonical unless the
encoding used for all the EXTERNAL, EMBEDDED PDV, and CHARACTER STRING types is canonical.
NOTE – The character transfer syntaxes supporting all character abstract syntaxes of the form {iso standard 10646
level-1(1) …} are canonical. Those supporting {iso standard 10646 level-2(2) …} and {iso standard 10646
level-3(3) …} are not always canonical. All the above character transfer syntaxes are relay-safe.
6.7 OER encodings are self-delimiting only with knowledge of the type of the encoded value. Encodings are always
a whole multiple of eight bits. When carried in an EXTERNAL type, they shall be carried in the OCTET STRING choice
alternative, unless the EXTERNAL type itself is encoded in OER, in which case the value may be encoded as a single ASN.1
type (i.e., an open type). When carried in an OSI presentation protocol, the "full encoding" (as defined in Rec. ITU-T
X.226 | ISO/IEC 8823-1) with the OCTET STRING alternative shall be used.
4 Rec. ITU-T X.696 (08/2014)
6.8 CANONICAL-OER provides an alternative to both the Distinguished Encoding Rules (DER) and Canonical
Encoding Rules (CER) specified in Rec. ITU-T X.690 | ISO/IEC 8825-1 where a canonical and relay-safe encoding is
required.
7 Conformance
7.1 Dynamic conformance for the Basic Octet Encoding Rules is specified by clauses 8 to 30. Dynamic
conformance for the Canonical Octet Encoding Rules is specified by clause 31.
7.2 Static conformance is specified by those standards which specify the application of these encoding rules.
7.3 Alternative encodings are permitted by the Basic Octet Encoding Rules as encoder's options. Decoders that
claim conformance to BASIC-OER shall support all BASIC-OER encoding alternatives. No alternative encodings are
permitted by the CANONICAL-OER for the encoding of an ASN.1 value.
7.4 The rules in this Recommendation | International Standard are specified in terms of an encoding procedure.
Implementations are not required to mirror the procedure specified, provided the octet string produced as the complete
encoding of an abstract syntax value is identical to one of those specified in this Recommendation | International Standard
for the applicable transfer syntax.
7.5 Implementations performing decoding are required to produce the abstract syntax value corresponding to any
received octet string which could be produced by a sender conforming to the encoding rules identified in the transfer
syntax associated with the material being decoded.
NOTE – When CANONICAL-OER is used to provide a canonical encoding, it is recommended that any resulting encrypted hash
value that is derived from it should have associated with it an algorithm identifier that identifies CANONICAL-OER as the
transformation from the abstract syntax value to an initial bitstring (which is then hashed).
8 General provisions
8.1 Use of the type notation
8.1.1 These encoding rules make specific use of the ASN.1 type notation as specified in Rec. ITU-T X.680 |
ISO/IEC 8824-1, Rec. ITU-T X.681 | ISO/IEC 8824-2, Rec. ITU-T X.682 | ISO/IEC 8824-3, Rec. ITU-T X.683 |
ISO/IEC 8824-4, and can only be applied to encode the values of a single ASN.1 type specified using that notation.
8.1.2 In particular, but not exclusively, they are dependent on the following information being retained in the ASN.1
type and value model underlying the use of the notation:
a) the nesting of choice types within choice types;
b) the tags placed on the components in a set type and on the alternatives in a choice type, and the numeric values
given to an enumeration;
c) whether a set or sequence type component is optional or not;
d) whether a set or sequence type component has a default value or not;
e) the restricted range of values of a type which arise through the application of OER-visible constraints;
f) whether the type of a component is an open type.
8.2 Constraints
NOTE – The fact that some ASN.1 constraints may not be OER-visible for the purposes of encoding and decoding does not in any
way affect the use of such constraints in the handling of errors detected during decoding, nor does it imply that values violating
such constraints are allowed to be transmitted by a conforming sender. However, this Recommendation | International Standard
makes no use of such constraints in the specification of encodings.
8.2.1 In general, the constraint on a type will consist of individual constraints combined using some or all of set
arithmetic, contained subtype constraints, and serial application of constraints.
The following constraints are OER-visible:
a) non-extensible single value constraints and value range constraints on integer types;
b) non-extensible single value constraints on real types where the single value is either plus zero or minus zero or
one of the special real values PLUS-INFINITY, MINUS-INFINITY and NOT-A-NUMBER;
Rec. ITU-T X.696 (08/2014) 5
c) non-extensible size constraints on known-multiplier character string types, octetstring types, and bitstring types;
d) an inner type constraint applying an OER-visible constraint (including one that restricts the mantissa, base, or
exponent of a real type);
e) a contained subtype constraint in which the constraining type carries an OER-visible constraint.
8.2.2 All other constraints are not OER-visible. In particular, the following constraints are not OER-visible:
a) constraints that are expressed in human-readable text or in ASN.1 comment;
b) variable constraints (see Rec. ITU-T X.683 | ISO/IEC 8824-4, 10.3 and 10.4);
c) user-defined constraints (see Rec. ITU-T X.682 | ISO/IEC 8824-3, 9.1);
d) table constraints (see Rec. ITU-T X.682 | ISO/IEC 8824-3);
e) component relation constraints (see Rec. ITU-T X.682 | ISO/IEC 8824-3, 10.7);
f) constraints whose evaluation is textually dependent on a table constraint or a component relation constraint (see
Rec. ITU-T X.682 | ISO/IEC 8824-3);
g) extensible subtype constraints;
h) size constraints on restricted character string types which are not known-multiplier character string types (see
clause 27);
i) single value subtype constraints applied to a character string type;
j) permitted alphabet constraints;
k) pattern constraints;
l) constraints on real types except those specified in 8.2.1 (b) and (d);
m) constraints on the time type and on the useful and defined time types;
n) an inner type constraint applied to a component of an unrestricted character string or embbeded-pdv type or
external type;
o) constraints on the useful types.
8.2.3 If a type is specified using a serial application of constraints, each of those constraints may or may not be
individually OER-visible. If the last subtype constraint of the series of constraints is OER-visible and contains an
extension marker, then that subtype constraint is extensible for the purposes of these encoding rules. Any other constraint
is not extensible for the purposes of these encoding rules, even if it contains an extension marker.
NOTE – In a serial application of constraints, each subtype constraint removes the extensibility specified in earlier constaints of
the series of constraints (see Rec. ITU-T X.680 | ISO/IEC 8824-1, 50.8).
8.2.4 If a constraint that is OER-visible is part of an INTERSECTION construction, then the resulting constraint is
OER-visible, and consists of the INTERSECTION of all the OER-visible parts (with the non-OER-visible parts ignored).
8.2.5 If a constraint that is not OER-visible is part of a UNION construction, then the resulting constraint is not OER-
visible.
8.2.6 If a constraint has an EXCEPT clause, the EXCEPT keyword and the following value set is completely ignored,
whether the value set following the EXCEPT keyword is OER-visible or not.
8.2.7 The effective value constraint of an integer type is an integer range determined as follows, taking into account
all the OER-visible constraints present in the type definition and ignoring any constraints that are not OER-visible:
a) The lower bound of the effective value constraint is the least permitted value of the integer type, if such a value
exists; otherwise, the effective value constraint has no finite lower bound.
b) The upper bound of the effective value constraint is the greatest permitted value of the integer type, if such a
value exists; otherwise, the effective value constraint has no finite upper bound.
8.2.8 The effective size constraint of a string type (a known-multiplier character string type, an octetstring type, or a
bitstring type) is a single integer range determined as follows, taking into account all the OER-visible constraints present
in the type definition and ignoring any constraints that are not OER-visible:
a) The lower bound of the effective size constraint is the length of the shortest permitted value of the string type
(possibly zero).
6 Rec. ITU-T X.696 (08/2014)
b) The upper bound of the effective size constraint is the length of the longest permitted value of the string type, if
such length is finite; otherwise, the effective size constraint has no finite upper bound.
8.3 Type and value model used for encoding
8.3.1 An ASN.1 type is either a simple type or a type built using other types. The notation permits the use of type
references and tagging of types. For the purpose of these encoding rules, the use of type references and tagging have no
effect on the encoding and are invisible in the model, except as stated in 18.2 and 20.1. The notation also permits the
application of constraints and of error specifications. OER-visible constraints are present in the model as a restriction of
the values of a type. Other constraints and error specifications do not affect encoding and are invisible in the OER type
and value model.
8.3.2 A value to be encoded can be considered as either a simple value or as a composite value built using the
structuring mechanisms from components which are either simple or composite values, paralleling the structure of the
ASN.1 type definition.
8.4 Types to be encoded
8.4.1 Clauses 9 to 30 specify the encoding of the following types: Boolean, integer, enumerated, real, bitstring,
octetstring, null, sequence, sequence-of, set, set-of, choice, object identifier, relative object identifier, internationalized
resource reference, relative internationalized resource reference, embedded-pdv, external, restricted character string,
unrestricted character string, time, and open types.
8.4.1 The selection type shall be encoded as an encoding of the selected type.
8.4.2 This Recommendation | International Standard does not contain specific provisions for the encoding of tagged
types, except as stated in 18.2 and 20.1, tagging is not visible in the type and value model used for these encoding rules.
Tagged types are thus encoded according to the type which has been tagged.
8.4.3 An encoding prefixed type is encoded according to the type which has been prefixed.
8.4.4 The useful types GeneralizedTime, UTCTime, and ObjectDescriptor shall be encoded as if they had been
replaced by their definitions given in Rec. ITU-T X.680 | ISO/IEC 8824-1, clause 45. Constraints on the useful types are
not OER-visible.
8.4.5 A type defined using a value set assignment shall be encoded as if the type had been defined using the production
specified in Rec. ITU-T X.680 | ISO/IEC 8824-1, 16.8.
8.5 Production of a complete OER encoding
8.5.1 If an ASN.1 type is encoded using OER and the encoding is contained in:
a) an ASN.1 bitstring type or octetstring type; or
b) an ASN.1 open type; or
c) any part of an ASN.1 external or embedded-pdv type; or
d) any carrier protocol that is not defined using ASN.1,
then that ASN.1 type is defined as an outermost type, and clause 8.5.2 shall be applied to all the encodings of its values.
8.5.2 The series of words and groups of octets produced as a result of applying this Recommendation | International
Standard to an abstract value of an outermost type shall be concatenated into a string of octets, which is the complete
encoding of the abstract value of the outermost type.
8.6 Length determinant
8.6.1 A length determinant occurs at the beginning of the encoding of many types as specified in the respective
clauses.
8.6.2 When a length determinant is included in the encoding of a type, it shall indicate the number of octets (zero or
more) occupied by the remainder of the encoding of that type.
NOTE – The encoding of a sequence-of or set-of type does not utilize a length determinant, but a different determinant called
quantity (see 17.2), which indicates the number of occurrences.
8.6.3 There are two forms of length determinant—a short form and a long form. The short form allows the
specification of lengths between 0 and 127 octets. The long form allows the specifications of lengths between 0 and an
Rec. ITU-T X.696 (08/2014) 7
1016 1016
effectively unlimited number (2 – 1) of octets. Values whose encoding would be longer than 2 – 1 octets cannot be
encoded in these encoding rules.
8.6.4 The short form of length determinant consists of a single octet. Bit 8 of this octet shall be set to '0', and bits 7 to
1 of this octet shall contain the length (0 to 127) encoded as an unsigned binary integer into 7 bits.
8.6.5 The long form of length determinant consists of an initial octet followed by one or more subsequent octets. Bit 8
of the initial octet shall be set to 1, and bits 7 to 1 of this octet shall indicate the number of subsequent octets (1 to 127).
The length shall be encoded as a variable-size unsigned number into the subsequent octets.
NOTE – In CANONICAL-OER, the long form of length determinant is used only for lengths greater than 127, and the length is
encoded in the smallest possible number of octets (see 31.2). These restrictions do not apply to BASIC-OER.
8.7 Encoding of tags
8.7.1 In these encoding rules, tags are encoded only as part of the encoding of a choice type, where the tag indicates
which alternative of the choice type is the chosen alternative (see 20.1).
8.7.2 The encoding of a tag shall consist of one or more octets, as specified in 8.7.2.1 to 8.7.2.3.
8.7.2.1 Bits 8 and 7 of the first octet shall denote the tag class of the tag, as follows:
a) '00'B denotes the universal tag class;
b) '01'B denotes the application tag class;
c) '10'B denotes the context-specific tag class; and
d) '11'B denotes the private tag class.
8.7.2.2 If the tag number is less than 63, it shall be encoded into bits 6 to 1 of the first (and only) octet.
8.7.2.3 If the tag number is greater or equal to 63, it shall be encoded into an initial octet followed by one or more
subsequent octets, as follows:
a) Bits 6 to 1 of the initial octet shall be set to '111111'B.
b) The tag number shall be encoded into bits 7 to 1 of each subsequent octet (seven bits in each octet), with bit 1 of
the final subsequent octet containing the least significant bit of the tag number ("big-endian" encoding).
c) Bits 7 to 1 of the first subsequent octet shall not be all set to 0.
d) Bit 8 of each subsequent octet except the last shall be set to 1.
e) Bit 8 of the final subsequent octet shall be set to 0.
9 Encoding of Boolean values
The encoding of a Boolean value shall be a single octet. The octet value 0 denotes the Boolean value FALSE and a non-zero
octet value denotes the Boolean value TRUE.
NOTE – In CANONICAL-OER, only the octet value 'FF'H can be used to encode the value TRUE (see 31.3). This restriction does
not apply to BASIC-OER.
10 Encoding of integer values
10.1 The encoding of an integer value depends on the effective value constraint (see 8.2.7) of the integer type as
determined by the OER-visible constraints present in the type definition.
10.2 There are two main cases:
a) The effective value constraint has a lower bound, and that lower bound is zero or positive.
b) The effective value constraint has either a negative lower bound or no lower bound.
10.3 In case (a) of 10.2, the encoding of the integer value depends on the upper bound of the effective value
constraint, as follows:
a) If the upper bound is less than or equal to 2 – 1 (255), then every value of the integer type shall be encoded as
a
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...