1、 Reference numberISO/IEC 8824-1:2002(E)ISO/IEC 2002INTERNATIONAL STANDARD ISO/IEC8824-1Third edition2002-12-15Information technology Abstract Syntax Notation One (ASN.1): Specification of basic notation Technologies de linformation Notation de syntaxe abstraite numro un (ASN.1): Spcification de la n
2、otation de base Adopted 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
3、Industry Council (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 resa
4、le. No part of this 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 AmericaISO
5、/IEC 8824-1:2002(E) PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be printed 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 dow
6、nloading this file, parties accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat accepts no liability 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 th
7、e 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 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
8、 given below. ISO/IEC 2002 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISO
9、s 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 E-mail copyrightiso.org Web www.iso.org Published by ISO in 2003 Published in Switzerland ii ISO/IEC 2002 All rights reservedISO/IEC 8824-1:2002(E) ISO/I
10、EC 2002 All rights reserved iiiCONTENTS Page Introduction . viii 1 Scope 1 2 Normative references . 1 2.1 Identical Recommendations | International Standards 1 2.2 Additional references 2 3 Definitions 2 3.1 Information object specification 2 3.2 Constraint specification. 2 3.3 Parameterization of A
11、SN.1 specification 2 3.4 Structure for identification of organizations 3 3.5 Universal Multiple-Octet Coded Character Set (UCS) . 3 3.6 Additional definitions 3 4 Abbreviations . 7 5 Notation 8 5.1 General 8 5.2 Productions 8 5.3 The alternative collections 8 5.4 Non-spacing indicator . 9 5.5 Exampl
12、e of a production . 9 5.6 Layout . 9 5.7 Recursion 9 5.8 References to permitted sequences of lexical items 9 5.9 References to a lexical item 9 5.10 Short-hand notations . 9 5.11 Value references and the typing of values. 10 6 The ASN.1 model of type extension 10 7 Extensibility requirements on enc
13、oding rules. 11 8 Tags 12 9 Use of the ASN.1 notation 12 10 The ASN.1 character set. 13 11 ASN.1 lexical items 14 11.1 General rules . 14 11.2 Type references . 14 11.3 Identifiers 15 11.4 Value references 15 11.5 Module references. 15 11.6 Comments . 15 11.7 Empty lexical item 15 11.8 Numbers 15 11
14、.9 Real numbers. 16 11.10 Binary strings 16 11.11 XML binary string item 16 11.12 Hexadecimal strings 16 11.13 XML hexadecimal string item. 16 11.14 Character strings 17 11.15 XML character string item 17 11.16 Assignment lexical item 19 11.17 Range separator. 19 11.18 Ellipsis . 19 ISO/IEC 8824-1:2
15、002(E) iv ISO/IEC 2002 All rights reserved11.19 Left version brackets. 19 11.20 Right version brackets. 19 11.21 XML end tag start item . 19 11.22 XML single tag end item. 20 11.23 XML boolean true item. 20 11.24 XML boolean false item 20 11.25 XML tag names for ASN.1 types 20 11.26 Single character
16、 lexical items 21 11.27 Reserved words . 22 12 Module definition. 22 13 Referencing type and value definitions 26 14 Notation to support references to ASN.1 components . 27 15 Assigning types and values 28 16 Definition of types and values 30 17 Notation for the boolean type. 32 18 Notation for the
17、integer type. 33 19 Notation for the enumerated type . 34 20 Notation for the real type 35 21 Notation for the bitstring type 36 22 Notation for the octetstring type. 37 23 Notation for the null type . 38 24 Notation for sequence types . 38 25 Notation for sequence-of types. 42 26 Notation for set t
18、ypes . 44 27 Notation for set-of types. 45 28 Notation for choice types 45 29 Notation for selection types 47 30 Notation for tagged types . 48 31 Notation for the object identifier type 49 32 Notation for the relative object identifier type . 50 33 Notation for the embedded-pdv type 51 34 Notation
19、for the external type. 53 35 The character string types. 54 36 Notation for character string types . 55 37 Definition of restricted character string types 55 38 Naming characters and collections defined in ISO/IEC 10646-1. 59 39 Canonical order of characters. 62 40 Definition of unrestricted charact
20、er string types 62 41 Notation for types defined in clauses 42 to 44 . 64 42 Generalized time. 64 43 Universal time 65 44 The object descriptor type 65 45 Constrained Types 66 46 Element set specification 67 47 Subtype elements 69 47.1 General 69 47.2 Single Value 70 47.3 Contained Subtype 70 ISO/IE
21、C 8824-1:2002(E) ISO/IEC 2002 All rights reserved v47.4 Value Range 71 47.5 Size Constraint 71 47.6 Type Constraint. 72 47.7 Permitted Alphabet 72 47.8 Inner Subtyping. 72 47.9 Pattern constraint. 73 48 The extension marker . 73 49 The exception identifier 75 Annex A ASN.1 regular expressions 77 A.1
22、 Definition 77 A.2 Metacharacters 77 Annex B Rules for Type and Value Compatibility. 80 B.1 The need for the value mapping concept (Tutorial introduction) 80 B.2 Value mappings. 82 B.3 Identical type definitions. 83 B.4 Specification of value mappings . 85 B.5 Additional value mappings defined for t
23、he character string types 85 B.6 Specific type and value compatibility requirements 86 B.7 Examples. 87 Annex C Assigned object identifier values. 89 C.1 Object identifiers assigned in this Recommendation | International Standard 89 C.2 Object identifiers in the ASN.1 and encoding rules standards 89
24、 Annex D Assignment of object identifier component values . 91 D.1 Root assignment of object identifier component values 91 D.2 ITU-T assignment of object identifier component values . 91 D.3 ISO assignment of object identifier component values. 92 D.4 Joint assignment of object identifier component
25、 values 92 Annex E Examples and hints 93 E.1 Example of a personnel record 93 E.1.1 Informal description of Personnel Record. 93 E.1.2 ASN.1 description of the record structure. 93 E.2 Guidelines for use of the notation . 94 E.2.1 Boolean . 95 E.2.2 Integer . 95 E.2.3 Enumerated . 95 E.2.4 Real . 96
26、 E.2.5 Bit string 97 E.2.6 Octet string 98 E.2.7 UniversalString, BMPString and UTF8String 99 E.2.10 Sequence and sequence-of 100 E.2.11 Set and set-of. 102 E.2.12 Tagged. 104 E.2.13 Choice . 105 E.2.14 Selection type 107 E.2.16 Embedded-pdv 108 E.2.17 External . 108 E.2.18 Instance-of. 108 E.2.19 R
27、elative Object Identifier 109 E.3 Identifying abstract syntaxes. 109 E.4 Subtypes 110 Annex F Tutorial annex on ASN.1 character strings 113 F.1 Character string support in ASN.1 113 F.2 The UniversalString, UTF8String and BMPString types 113 F.3 On ISO/IEC 10646-1 conformance requirements . 114 F.4
28、Recommendations for ASN.1 users on ISO/IEC 10646-1 conformance. 114 F.5 Adopted subsets as parameters of the abstract syntax. 115 ISO/IEC 8824-1:2002(E) vi ISO/IEC 2002 All rights reservedF.6 The CHARACTER STRING type 115 Annex G Tutorial annex on the ASN.1 model of type extension . 116 G.1 Overview
29、. 116 G.2 Meaning of version numbers. 117 G.3 Requirements on encoding rules . 118 G.4 Combination of (possibly extensible) constraints . 118 G.4.1 Model 118 G.4.2 Serial application of constraints 118 G.4.3 Use of set arithmetic 119 G.4.4 Use of the Contained Subtype notation. 120 Annex H Summary o
30、f the ASN.1 notation . 121 ISO/IEC 8824-1:2002(E) ISO/IEC 2002 All rights reserved viiForeword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members
31、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 organiz
32、ations, 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 D
33、irectives, 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
34、 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 8824-1 was prepared by Joint Technical Committee
35、 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 Rec. X.680. This third edition cancels and replaces the second edition (ISO/IEC 8824-1:1998), which has been t
36、echnically revised. It also incorporates the Amendments ISO/IEC 8824-1:1998/Amd.1:2000 and ISO/IEC 8824-1:1998/Amd.2:2000 and the Technical Corrigenda ISO/IEC 8824-1:1998/Cor.1:1999, ISO/IEC 8824-1:1998/Cor.2:2002, ISO/IEC 8824-1:1998/Cor.3:2002 and ISO/IEC 8824-1:1998/Cor.4:2002. ISO/IEC 8824 consi
37、sts of the following parts, under the general title Information technology Abstract Syntax Notation One (ASN.1): Part 1: Specification of basic notation Part 2: Information object specification Part 3: Constraint specification Part 4: Parameterization of ASN.1 specifications ISO/IEC 8824-1:2002(E) v
38、iii ISO/IEC 2002 All rights reservedIntroduction This Recommendation | International Standard presents a standard notation for the definition of data types and values. A data type (or type for short) is a category of information (for example, numeric, textual, still image or video information). A da
39、ta value (or value for short) is an instance of such a type. This Recommendation | International Standard defines several basic types and their corresponding values, and rules for combining them into more complex types and values. In some protocol architectures, each message is specified as the bina
40、ry value of a sequence of octets. However, standards-writers need to define quite complex data types to carry their messages, without concern for their binary representation. In order to specify these data types, they require a notation that does not necessarily determine the representation of each
41、value. ASN.1 is such a notation. This notation is supplemented by the specification of one or more algorithms called encoding rules that determine the value of the octets that carry the application semantics (called the transfer syntax). ITU-T Rec. X.690 | ISO/IEC 8825-1, ITU-T Rec. X.691 | ISO/IEC
42、8825-2 and ITU-T Rec. X.693 | ISO/IEC 8825-4 specify three families of standardized encoding rules, called Basic Encoding Rules (BER), Packed Encoding Rules (PER), and XML Encoding Rules (XER). Some users wish to redefine their legacy protocols using ASN.1, but cannot use standardized encoding rules
43、 because they need to retain their existing binary representations. Other users wish to have more complete control over the exact layout of the bits on the wire (the transfer syntax). These requirements are addressed by ITU-T Rec. X.692 | ISO/IEC 8825-3 which specifies an Encoding Control Notation (
44、ECN) for ASN.1. ECN enables designers to formally specify the abstract syntax of a protocol using ASN.1, but to then (if they so wish) take complete or partial control of the bits on the wire by writing an accompanying ECN specification (which may reference standardized Encoding Rules for some parts
45、 of the encoding). A very general technique for defining a complicated type at the abstract level is to define a small number of simple types by defining all possible values of the simple types, then combining these simple types in various ways. Some of the ways of defining new types are as follows:
46、 a) given an (ordered) list of existing types, a value can be formed as an (ordered) sequence of values, one from each of the existing types; the collection of all possible values obtained in this way is a new type (if the existing types in the list are all distinct, this mechanism can be extended t
47、o allow omission of some values from the list); b) given an unordered set of (distinct) existing types, a value can be formed as an (unordered) set of values, one from each of the existing types; the collection of all possible unordered sets of values obtained in this way is a new type (the mechanis
48、m can again be extended to allow omission of some values); c) given a single existing type, a value can be formed as an (ordered) list or (unordered) set of zero, one or more values of the existing type; the collection of all possible lists or sets of values obtained in this way is a new type; d) gi
49、ven a list of (distinct) types, a value can be chosen from any one of them; the set of all possible values obtained in this way is a new type; e) given a type, a new type can be formed as a subset of it by using some structure or order relationship among the values. An important aspect of combining types in this way is that encoding rules should recognize the combining constructs, providing unambiguous encodings of the collection of values of the basic types. Thus, every basic type define