1、 Reference numberISO/IEC 8825-2:2002(E)ISO/IEC 2002INTERNATIONAL STANDARD ISO/IEC8825-2Third edition2002-12-15Information technology ASN.1 encoding rules: Specification of Packed Encoding Rules (PER) Technologies de linformation Rgles de codage ASN.1: Spcification des rgles de codage compact (PER) A
2、dopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard.Date of ANSI Approval: 12/28/2004Published by American National Standards Institute,25 West 43rd Street, New York, New York 10036Copyright 2004 by Information Technology Industry Council
3、(ITI).All rights reserved.These materials are subject to copyright claims of International Standardization Organization (ISO), InternationalElectrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Technology Industry Council(ITI). Not for resale. No part of th
4、is publication may be reproduced in any form, including an electronic retrieval system, withoutthe prior written permission of ITI. All requests pertaining to this standard should be submitted to ITI, 1250 Eye Street NW,Washington, DC 20005.Printed in the United States of AmericaCopyright American N
5、ational Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 8825-2:2002(E) PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be prin
6、ted or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat accepts no li
7、ability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is
8、 suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform the Central Secretariat at the address given below. ISO/IEC 2002 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form
9、or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISOs member body in the country of the requester. ISO copyright office Case postale 56 CH-1211 Geneva 20 Tel. + 41 22 749 01 11 Fax + 41 22 749 09 47
10、 E-mail copyrightiso.org Web www.iso.org Published by ISO in 2003 Published in Switzerland ii ISO/IEC 2002 All rights reservedCopyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO
11、/IEC 8825-2:2002(E) ISO/IEC 2002 All rights reserved iiiCONTENTS Page Introduction . vi 1 Scope 1 2 Normative references . 1 2.1 Identical Recommendations | International Standards 1 2.2 Paired Recommendations | International Standards equivalent in technical content. 1 2.3 Additional references 1 3
12、 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 . 2 3.6 Additional definitions 2 4 Abbreviations . 5 5 Notation 5 6 Convention . 5 7 Encoding rules def
13、ined in this Recommendation | International Standard. 5 8 Conformance 6 9 The approach to encoding used for PER 6 9.1 Use of the type notation 6 9.2 Use of tags to provide a canonical order . 7 9.3 PER-visible constraints . 7 9.4 Type and value model used for encoding 8 9.5 Structure of an encoding
14、. 8 9.6 Types to be encoded 9 10 Encoding procedures 10 10.1 Production of the complete encoding 10 10.2 Open type fields 10 10.3 Encoding as a non-negative-binary-integer. 10 10.4 Encoding as a 2s-complement-binary-integer 11 10.5 Encoding of a constrained whole number . 11 10.6 Encoding of a norma
15、lly small non-negative whole number 12 10.7 Encoding of a semi-constrained whole number 13 10.8 Encoding of an unconstrained whole number . 13 10.9 General rules for encoding a length determinant 13 11 Encoding the boolean type . 16 12 Encoding the integer type. 16 13 Encoding the enumerated type .
16、17 14 Encoding the real type 17 15 Encoding the bitstring type. 17 16 Encoding the octetstring type . 18 17 Encoding the null type 19 18 Encoding the sequence type . 19 19 Encoding the sequence-of type. 20 20 Encoding the set type . 20 21 Encoding the set-of type. 21 22 Encoding the choice type 21 C
17、opyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 8825-2:2002(E) iv ISO/IEC 2002 All rights reserved23 Encoding the object identifier type. 22 24 Encoding the relative obje
18、ct identifier type 22 25 Encoding the embedded-pdv type 22 26 Encoding of a value of the external type 22 27 Encoding the restricted character string types 23 28 Encoding the unrestricted character string type 25 29 Object identifiers for transfer syntaxes. 25 Annex A Example of encodings . 27 A.1 R
19、ecord that does not use subtype constraints. 27 A.1.1 ASN.1 description of the record structure . 27 A.1.2 ASN.1 description of a record value . 27 A.1.3 ALIGNED PER representation of this record value 27 A.1.4 UNALIGNED PER representation of this record value 28 A.2 Record that uses subtype constra
20、ints . 30 A.2.1 ASN.1 description of the record structure . 30 A.2.2 ASN.1 description of a record value . 30 A.2.3 ALIGNED PER representation of this record value 30 A.2.4 UNALIGNED PER representation of this record value 31 A.3 Record that uses extension markers. 32 A.3.1 ASN.1 description of the
21、record structure . 32 A.3.2 ASN.1 description of a record value . 33 A.3.3 ALIGNED PER representation of this record value 33 A.3.4 UNALIGNED PER representation of this record value 34 A.4 Record that uses extension addition groups. 36 A.4.1 ASN.1 description of the record structure . 36 A.4.2 ASN.1
22、 description of a record value . 36 A.4.3 ALIGNED PER representation of this record value 36 A.4.4 UNALIGNED PER representation of this record value 37 Annex B Observations on combining PER-visible constraints. 38 Annex C Support for the PER algorithms. 43 Annex D Support for the ASN.1 rules of exte
23、nsibility . 44 Annex E Tutorial annex on concatenation of PER encodings 45 Annex F Assignment of object identifier values. 46 Copyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO
24、/IEC 8825-2:2002(E) ISO/IEC 2002 All rights reserved vForeword 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
25、 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-gov
26、ernmental, 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
27、 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 v
28、ote. 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-2 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information tech
29、nology, Subcommittee SC 6, Telecommunications and information exchange between systems, in collaboration with ITU-T. The identical text is published as ITU-T Rec. X.691. This third edition cancels and replaces the second edition (ISO/IEC 8825-2:1998), which has been technically revised. It also inco
30、rporates the Amendment ISO/IEC 8825-2:1998/Amd.1:2000 and the Technical Corrigenda ISO/IEC 8825-2:1998/Cor.1:1999, ISO/IEC 8825-2:1998/Cor.2:2002 and ISO/IEC 8825-2:1998/Cor.3:2002. ISO/IEC 8825 consists of the following parts, under the general title Information technology ASN.1 encoding rules: Par
31、t 1: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER) Part 2: Specification of Packed Encoding Rules (PER) Part 3: Specification of Encoding Control Notation (ECN) Part 4: XML Encoding Rules (XER) Part 5: Mapping W3C XML schema defini
32、tions into ASN.1 Copyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 8825-2:2002(E) vi ISO/IEC 2002 All rights reservedIntroduction The publications ITU-T Rec. X.680 | ISO/I
33、EC 8824-1, ITU-T Rec. X.681 | ISO/IEC 8824-2, ITU-T Rec. X.682 | ISO/IEC 8824-3, ITU-T Rec. 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
34、 defines encoding rules that may be applied to values of types defined using the notation specified in ITU-T Rec. X.680 | ISO/IEC 8824-1. 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
35、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 a set of Packed Encoding Rules (PER), so called because they achieve a much more compact representation than that achieved by the Bas
36、ic Encoding Rules (BER) and its derivatives described in ITU-T Rec. X.690 | ISO/IEC 8825-1 which is referenced for some parts of the specification of these Packed Encoding Rules. Copyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or
37、networking permitted without license from IHS-,-,-ISO/IEC 8825-2:2003 (E) ITU-T Rec. X.691 (07/2002) 1 INTERNATIONAL STANDARD ISO/IEC 8825-2 : 1995 (E) ITU-T Rec. X.691 (1995 E) ITU-T RECOMMENDATION Information technology ASN.1 encoding rules: Specification of Packed Encoding Rules (PER) 1 Scope Thi
38、s 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 ITU-T Rec. X.680 | ISO/IEC 8824-1. These Packed Encoding Rules are also to be applied for decoding such a transfer syntax in order to identif
39、y 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 rul
40、es; 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 ITU-T Rec. X.680 | ISO/IEC 8824-1. 2 Normative references The following Recommendations and International Standards contain provisions w
41、hich, 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 | Internationa
42、l 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 li
43、st of currently valid ITU-T Recommendations. 2.1 Identical Recommendations | International Standards ITU-T Recommendation X.680 (2002) | ISO/IEC 8824-1:2002, Information technology Abstract Syntax Notation One (ASN.1): Specification of basic notation. ITU-T Recommendation X.681 (2002) | ISO/IEC 8824
44、-2:2002, Information technology Abstract Syntax Notation One (ASN.1): Information object specification. ITU-T Recommendation X.682 (2002) | ISO/IEC 8824-3:2002, Information technology Abstract Syntax Notation One (ASN.1): Constraint specification. ITU-T Recommendation X.683 (2002) | ISO/IEC 8824-4:2
45、002, Information technology Abstract Syntax Notation One (ASN.1): Parameterization of ASN.1 specifications. ITU-T Recommendation X.690 (2002) | ISO/IEC 8825-1:2002, Information technology ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguis
46、hed Encoding Rules (DER). 2.2 Paired Recommendations | International Standards equivalent in technical content 2.3 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 struct
47、ure and extension techniques. ISO 2375:1985, Data processing Procedure for registration of escape sequences. ISO 6093:1985, Information processing Representation of numerical values in character strings for information interchange. ISO/IEC 8824-1:2002 (E)ISO/IEC 8825-1:2002 (E)ISO/IEC 8825-2:2002 (E
48、)Copyright American National Standards Institute Provided by IHS under license with ANSI Not for ResaleNo reproduction or networking permitted without license from IHS-,-,-ISO/IEC 8825-2:2003 (E) 2 ITU-T Rec. X.691 (07/2002) ISO International Register of Coded Character Sets to be Used with Escape Sequences. ISO/IEC 10646-1:2000, Information technology Universal Multiple-Octet Coded Character Set (UCS) Part 1: Architecture and Basic Multilingual Plane. 3 Definitions For the purposes of this Recommendation | International Standard, the following definitio