没有合适的资源?快使用搜索试试~ 我知道了~
首页ASN.1编码规则:ISO/IEC 8825-2-2015 PER压缩解析
ASN.1编码规则:ISO/IEC 8825-2-2015 PER压缩解析
需积分: 32 44 下载量 114 浏览量
更新于2024-07-16
收藏 925KB PDF 举报
"ISO/IEC 8825-2-2015 信息技术-ASN.1编码规则:压缩编码规则(PER)_高清.pdf"
这篇文档详细介绍了ASN.1编码规则中的压缩编码规则(Packed Encoding Rules,简称PER),这是一种在ASN.1框架下用于高效数据编码的方法。ASN.1,即抽象语法标记一号,是一种国际标准,它提供了一种描述数据结构的抽象语法,以便在不同系统间进行结构化数据交换,尤其在通信协议和网络环境中。
ASN.1并不直接规定如何编码这些结构,而是定义了多种编码规则,如基本编码规则(BER)、规范编码规则(CER)、唯一编码规则(DER)以及XML编码规则(XER)。其中,PER是一种压缩编码方式,旨在减少编码后的位序列长度,从而优化传输效率,尤其适用于带宽有限或需要高效存储的场景。
PER编码规则的核心特性在于它的紧凑性,它通过消除不必要的填充和对齐,减少了编码的冗余。例如,对于数值类型,PER可以使用变长编码,对于布尔值,只需一位来表示真或假。此外,PER还支持优化编码未定义或默认值,进一步节省空间。
文档ISO/IEC 8825-2:2015(E)是第五版,发布于2015年11月15日,详细阐述了PER编码的规范和实现细节。该标准由国际标准化组织(ISO)和国际电信联盟(ITU-T)联合制定,版权受保护,未经授权不得复制或使用。
ASN.1的应用广泛,包括电子邮件协议X.400、目录服务协议X.500和轻型目录访问协议(LDAP)、语音-over-IP(VoIP)协议H.323、简单网络管理协议(SNMP)以及在UMTS(通用移动通信系统)的接入和非接入层。asn.1的编码规则如PER,对于确保这些协议的互操作性和数据一致性至关重要。
这份文档对于理解PER编码规则及其在ASN.1框架下的应用具有重要价值,对于开发和维护依赖ASN.1编码的通信系统和网络协议的工程师来说,是一份重要的参考资料。
ISO/IEC 8825-2: 2015 (E)
Rec. ITU-T X.691 (08/2015) 1
INTERNATIONAL STANDARD
ITU-T RECOMMENDATION
Information technology –
ASN.1 encoding rules:
Specification of Packed Encoding Rules (PER)
1 Scope
This Recommendation | International Standard specifies a set of Packed Encoding Rules that may be used to derive a
transfer syntax for values of types defined in Rec. ITU-T X.680 | ISO/IEC 8824-1. These Packed Encoding Rules are also
to be applied for decoding such a transfer syntax in order to identify the data values being transferred.
The encoding rules specified in this Recommendation | International Standard:
– are used at the time of communication;
– are intended for use in circumstances where minimizing the size of the representation of values is the
major concern in the choice of encoding rules;
– allow the extension of an abstract syntax by addition of extra values, preserving the encodings
of the existing values, for all forms of extension described in Rec. ITU-T X.680 | ISO/IEC 8824-1;
– can be modified in accordance with the provisions of Rec. ITU-T X.695 | ISO/IEC 8825-6.
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. It cannot be applied using later versions
of this standard.
2.1 Identical Recommendations | International Standards
– Recommendation ITU-T X.680 (2015) | ISO/IEC 8824-1:2015, Information technology – Abstract Syntax
Notation One (ASN.1): Specification of basic notation.
– Recommendation ITU-T X.681 (2015) | ISO/IEC 8824-2:2015, Information technology – Abstract Syntax
Notation One (ASN.1): Information object specification.
– Recommendation ITU-T X.682 (2015) | ISO/IEC 8824-3:2015, Information technology – Abstract Syntax
Notation One (ASN.1): Constraint specification.
– Recommendation ITU-T X.683 (2015) | ISO/IEC 8824-4:2015, Information technology – Abstract Syntax
Notation One (ASN.1): Parameterization of ASN.1 specifications.
– Recommendation ITU-T X.690 (2015) | ISO/IEC 8825-1:2015, 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.695 (2015) | ISO/IEC 8825-6:2015, Information technology – ASN.1 encoding
rules: Registration and application of PER encoding instructions.
2.2 Additional references
– ISO/IEC 646:1991, Information technology – ISO 7-bit coded character set for information interchange.
– ISO/IEC 2022:1994, Information technology – Character code structure and extension techniques.
ISO/IEC 8825-2: 2015 (E)
2 Rec. ITU-T X.691 (08/2015)
– ISO/IEC 2375:2003, Information technology – Procedure for registration of escape sequences and coded
character sets.
– ISO 6093:1985, Information processing – Representation of numerical values in character strings for
information interchange.
– 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).
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
This Recommendation | International Standard makes use of the following terms defined in Rec. ITU-T X.690 |
ISO/IEC 8825-1:
a) dynamic conformance;
b) static conformance;
c) data value;
d) encoding (of a data value);
e) sender;
f) receiver.
3.6 PER Encoding Instructions
This Recommendation | International Standard makes use of the following term defined in Rec. ITU-T X.695 |
ISO/IEC 8825-6:
– identifying keyword.
3.7 Additional definitions
For the purposes of this Recommendation | International Standard, the following definitions apply.
3.7.1 2's-complement-binary-integer encoding: The encoding of a whole number into a bit-field (octet-aligned in
the ALIGNED variant) of a specified length, or into the minimum number of octets that will accommodate that whole
ISO/IEC 8825-2: 2015 (E)
Rec. ITU-T X.691 (08/2015) 3
number encoded as a 2's-complement-integer, which provides representations for whole numbers that are equal to, greater
than, or less than zero, as specified in 11.4.
NOTE 1 – The value of a two's complement binary number is derived by numbering the bits in the contents octets, starting with
bit 1 of the last octet as bit zero and ending the numbering with bit 8 of the first octet. Each bit is assigned a numerical value of 2
N
,
where N is its position in the above numbering sequence. The value of the two's complement binary number 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.
NOTE 2 – Whole number is a synonym for the mathematical term integer. It is used here to avoid confusion with the ASN.1 type
integer.
3.7.2 abstract syntax value: A value of an abstract syntax (defined as the set of values of a single ASN.1 type),
which is to be encoded by PER, or which is to be generated by PER decoding.
NOTE – The single ASN.1 type associated with an abstract syntax is formally identified by an object of class ABSTRACT-SYNTAX.
3.7.3 bit-field: The product of some part of the encoding mechanism that consists of an ordered set of bits that are
not necessarily a multiple of eight.
NOTE – If the use of this term is followed by "octet-aligned in the ALIGNED variant", this means that the bit-field is required to
begin on an octet boundary in the complete encoding for the aligned variant of PER.
3.7.4 canonical encoding: A complete encoding of an abstract syntax value obtained by the application of encoding
rules that have no implementation-dependent options; such rules result in the definition of a 1-1 mapping between
unambiguous and unique bitstrings in the transfer syntax and values in the abstract syntax.
3.7.5 composite type: A set, sequence, set-of, sequence-of, choice, embedded-pdv, external or unrestricted character
string type.
3.7.6 composite value: The value of a composite type.
3.7.7 constrained whole number: A whole number which is constrained by PER-visible constraints to lie within a
range from "lb" to "ub" with the value "lb" less than or equal to "ub", and the values of "lb" and "ub" as permitted values.
NOTE – Constrained whole numbers occur in the encoding which identifies the chosen alternative of a choice type, the length of
character, octet and bit string types whose length has been restricted by PER-visible constraints to a maximum length, the count of
the number of components in a sequence-of or set-of type that has been restricted by PER-visible constraints to a maximum
number of components, the value of an integer type that has been constrained by PER-visible constraints to lie within finite
minimum and maximum values, and the value that denotes an enumeration in an enumerated type.
3.7.8 effective size constraint (for a constrained string type): A single finite size constraint that could be applied
to a built-in string type and whose effect would be to permit all and only those lengths that can be present in the
constrained string type.
NOTE 1 – For example, the following has an effective size constraint:
A ::= IA5String (SIZE(1..4) | SIZE(10..15))
since it can be rewritten with a single size constraint that applies to all values:
A ::= IA5String (SIZE(1..4 | 10..15))
whereas the following has no effective size constraint since the string can be arbitrarily long if it does not contain any characters
other than 'a', 'b' and 'c':
B ::= IA5String (SIZE(1..4) | FROM("abc"))
NOTE 2 – The effective size constraint is used only to determine the encoding of lengths.
3.7.9 effective permitted-alphabet constraint (for a constrained restricted character string type): A single
permitted-alphabet constraint that could be applied to a built-in known-multiplier character string type and whose effect
would be to permit all and only those characters that can be present in at least one character position of any one of the
values in the constrained restricted character string type.
NOTE 1 – For example, in:
Ax ::= IA5String (FROM("AB") | FROM("CD"))
Bx ::= IA5String (SIZE(1..4) | FROM("abc"))
Ax has an effective permitted-alphabet constraint of "ABCD". Bx has an effective permitted-alphabet constraint that consists
of the entire IA5String alphabet since there is no smaller permitted-alphabet constraint that applies to all values of Bx.
NOTE 2 – The effective permitted-alphabet constraint is used only to determine the encoding of characters.
3.7.10 enumeration index: The non-negative whole number associated with an "EnumerationItem" in an enumerated
type. The enumeration indices are determined by sorting the "EnumerationItem"s into ascending order by their
enumeration value, then by assigning an enumeration index starting with zero for the first "EnumerationItem", one for the
second, and so on up to the last "EnumerationItem" in the sorted list.
NOTE – "EnumerationItem"s in the "RootEnumeration" are sorted separately from those in the "AdditionalEnumeration".
ISO/IEC 8825-2: 2015 (E)
4 Rec. ITU-T X.691 (08/2015)
3.7.11 extensible for PER encoding: A property of a type which requires that PER identifies an encoding of a value
as that of a root value or as that of an extension addition.
NOTE – Root values are normally encoded more efficiently than extension additions.
3.7.12 field-list: An ordered set of bit-fields that is produced as a result of applying these encoding rules to
components of an abstract value.
3.7.13 indefinite-length: An encoding whose length is greater than 64K-1 or whose maximum length cannot be
determined from the ASN.1 notation.
3.7.14 fixed-length type: A type such that the value of the outermost length determinant in an encoding of this type
can be determined (using the mechanisms specified in this Recommendation | International Standard) from the type
notation (after the application of PER-visible constraints only) and is the same for all possible values of the type.
3.7.15 fixed value: A value such that it can be determined (using the mechanisms specified in this Recommendation |
International Standard) that this is the only permitted value (after the application of PER-visible constraints only) of the
type governing it.
3.7.16 known-multiplier character string type: A restricted character string type where the number of octets in the
encoding is a known fixed multiple of the number of characters in the character string for all permitted character string
values. The known-multiplier character string types are IA5String, PrintableString, VisibleString,
NumericString, UniversalString and BMPString.
3.7.17 length determinant: A count (of bits, octets, characters, or components) determining the length of part or all of
a PER encoding.
3.7.18 normally small non-negative whole number: A part of an encoding which represents values of an unbounded
non-negative integer, but where small values are more likely to occur than large ones.
3.7.19 normally small length: A length encoding which represents values of an unbounded length, but where small
lengths are more likely to occur than large ones.
3.7.20 non-negative-binary-integer encoding: The encoding of a constrained or semi-constrained whole number into
either a bit-field of a specified length, or into a bit-field (octet-aligned in the ALIGNED variant) of a specified length, or
into the minimum number of octets that will accommodate that whole number encoded as a non-negative-binary-integer
which provides representations for whole numbers greater than or equal to zero, as specified in 11.3.
NOTE – The value of a non-negative-binary-number is derived by numbering the bits in the contents octets, starting with bit 1 of
the last octet as bit zero and ending the numbering with bit 8 of the first octet. Each bit is assigned a numerical value of 2
N
, where
N is its position in the above numbering sequence. The value of the non-negative-binary-number is obtained by summing the
numerical values assigned to each bit for those bits which are set to one.
3.7.21 outermost type: An ASN.1 type whose encoding is included in a non-ASN.1 carrier or as the value of other
ASN.1 constructs (see 11.1.1).
NOTE – PER encodings of an outermost type are always an integral multiple of eight bits.
3.7.22 PER-visible constraint: An instance of use of the ASN.1 constraint notation which affects the PER encoding
of a value.
3.7.23 relay-safe encoding: A complete encoding of an abstract syntax value which can be decoded (including any
embedded encodings) without knowledge of the environment in which the encoding was performed.
3.7.24 semi-constrained whole number: A whole number which is constrained by PER-visible constraints to exceed
or equal some value "lb" with the value "lb" as a permitted value, and which is not a constrained whole number.
NOTE – Semi-constrained whole numbers occur in the encoding of the length of unconstrained (and in some cases constrained)
character, octet and bit string types, the count of the number of components in unconstrained (and in some cases constrained)
sequence-of and set-of types, and the value of an integer type that has been constrained to exceed some minimum value.
3.7.25 simple type: A type that is not a composite type.
3.7.26 textually dependent: A term used to identify the case where if some reference name is used in evaluating an
element set, the value of the element set is considered to be dependent on that reference name, regardless of whether the
actual set arithmetic being performed is such that the final value of the element set is independent of the actual element
set value assigned to the reference name.
NOTE – For example, the following definition of Foo is textually dependent on Bar even though Bar has no effect on Foos set of
values (thus, according to 10.3.6 the constraint on Foo is not PER-visible since Bar is constrained by a table constraint and Foo is
textually dependent on Bar).
MY-CLASS ::= CLASS { &name PrintableString, &age INTEGER } WITH SYNTAX{&name , &age}
MyObjectSet MY-CLASS ::= { {"Jack", 7} | {"Jill", 5} }
剩余75页未读,继续阅读
zeroworld
- 粉丝: 1
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功