1、)45 4 8 TELECOMMUNICATIONSTANDARDIZATION SECTOROF ITU/0%. 3934%-3 ).4%2#/%#4)/.-/$%, !.$ ./4!4)/.30%#)(b) the need for a high-level notation for specifying such information objects;(c) the value of isolating and standardizing the rules for encoding such information objects,unanimously recommends(1)
2、that the notation for defining the abstract syntax of information objects is defined in Section 1;(2) that character string types are defined in Section 2;(3) that other useful types are defined in Section 3;(4) that subtypes are defined in Section 4.CONTENTS0 Introduction1 Scope and field of applic
3、ation2 References3 Definitions4 Abbreviations5 Notation used in this Recommendation5.1 Productions5.2 The alternative collections5.3 Example of a production5.4 Layout5.5 Recursion5.6 References to a collection of sequences5.7 References to an item5.8 Tags_1Recommendation X.208 and ISO 8824 Informati
4、on processing systems - Open Systems Interconnection - Specification of AbstractSyntax Notation One (ASN.1) as extended by Addendum 1 to ISO 8824, were developed in close cooperation and are technicallyaligned.2 Fascicle VIII.4 Rec. X.2086 Use of the ASN.1 notationSECTION 1 SPECIFICATION OF ASN.1 NO
5、TATION7 The ASN.1 character set8 ASN.1 items8.1 General rules8.2 Type references8.3 Identifiers8.4 Value references8.5 Module reference8.6 Comment8.7 Empty item8.8 Number item8.9 Binary string item8.10 Hexadecimal string item8.11 Character string item8.12 Assignment item8.13 Single character items8.
6、14 Keyword items9 Module definition10 Referencing type and value definitions11 Assigning types and values12 Definition of types and values13 Notation for the Boolean type14 Notation for the integer type15 Notation for the enumerated type16 Notation for the real type17 Notation for the bitstring type
7、18 Notation for the octetstring type19 Notation for the null type20 Notation for sequence types21 Notation for sequence-of types22 Notation for set types23 Notation for set-of typesFascicle VIII.4 Rec. X.208 324 Notation for choice types25 Notation for selection types26 Notation for tagged types27 N
8、otation for the any type28 Notation for the object identifier type29 Notation for character string types30 Notation for types defined in Section 3SECTION 2 CHARACTER STRING TYPES31 Definition of character string typesSECTION 3 USEFUL DEFINITIONS32 Generalized time33 Universal time34 The external typ
9、e35 The object descriptor typeSECTION 4 SUBTYPES36 Subtype notation37 Subtype Value Sets37.1 Single Value37.2 Contained Subtype37.3 Value Range37.4 Size Constraint37.5 Permitted Alphabet37.6 Inner SubtypingAnnex A The macro notationA.1 IntroductionA.2 Extensions to the ASN.1 character set and itemsA
10、.2.1 MacroreferenceA.2.2 ProductionreferenceA.2.3 LocaltypereferenceA.2.4 LocalvaluereferenceA.2.5 Alternation itemA.2.6 Definition terminator itemA.2.7 Syntactic terminal item4 Fascicle VIII.4 Rec. X.208A.2.8 Syntactic category keyword itemsA.2.9 Additional keyword itemsA.3 Macro definition notatio
11、nA.4 Use of the new notationAnnex B ISO assignment of OBJECT IDENTIFIERAnnex C CCITT assignment of OBJECT IDENTIFIERAnnex D Joint assignment of OBJECT IDENTIFIERAppendix I Examples and hintsI.1Example of a personnel recordI.1.1 Informal Description of Personnel RecordI.1.2 ASN.1 description of the r
12、ecord structureI.1.3 ASN.1 description of a record valueI.2Guidelines for use of the notationI.2.1 BooleanI.2.2 IntegerI.2.3 EnumeratedI.2.4 RealI.2.5 Bit stringI.2.6 Octet stringI.2.7 NullI.2.8 Sequence and sequence-ofI.2.9 SetI.2.10 TaggedI.2.11 ChoiceI.2.12 Selection typeI.2.13 AnyI.2.14 External
13、I.2.15 EncryptedI.3An example of the use of the macro notationI.4Use in identifying abstract syntaxesI.5SubtypesAppendix II Summary of the ASN.1 notation0 IntroductionIn the lower layers of the Basic Reference Model (see Recommendation X.200), each user data parameter of aservice primitive is specif
14、ied as the binary value of a sequence octets.In the presentation layer, the nature of user data parameters changes. Application layer specifications requirethe presentation service user data (see Recommendation X.216) to carry the value of quite complex types, possiblyincluding strings of characters
15、 from a variety of character sets. In order to specify the value which is carried, they requireFascicle VIII.4 Rec. X.208 5a defined notation which does not determine the representation of the value. This is supplemented by the specification ofone or more algorithms called encoding rules which deter
16、mine the value of the session layer octets carrying suchapplication layer values (called the transfer syntax). The presentation layer protocol (see Recommendation X.226) cannegotiate which transfer syntaxes are to be used.The purpose of specifying a value is to distinguish it from other possible val
17、ues. The collection of the valuetogether with the values from which it is distinguished is called a type, and one specific instance is a value of that type.More generally, a value or type can often be considered as composed of several simpler values or types, together withthe relationships between t
18、hem. The term datatype is often used as a synonym for type.In order to correctly interpret the representation of a value (whether by marks on paper or bits oncommunication line), it is necessary to know (usually from the context), the type of the value being represented. Thusthe identification of a
19、type is an important part of this Recommendation.A very general technique for defining a complicated type is to define a small number of simple types bydefining all possible values of the simple types, then combining these simple types in various ways. Some of the ways ofdefining new types are as fo
20、llows:a) given an (ordered) list of existing types, a value can be formed as an (ordered) sequence of values, onefrom each of the existing types; the collection of all possible values obtained in this way is a new type; (ifthe existing types in the list are all distinct, this mechanism can be extend
21、ed to allow omission of somevalues from the list);b) given a list of (distinct) existing types, a value can be formed as an (unordered) set of values, one fromeach of the existing types; the collection of all possible values obtained in this way is a new type; (themechanism can again be extended to
22、allow omission of some values);c) given a single existing type, a value can be formed (ordered) sequence or (unordered) set of zero, one ormore values of the existing type; the (infinite) collection of all possible values obtained in this way is anew type;d) given a list of (distinct) types, a value
23、 can be chosen from any one of them; the set of all possible valuesobtained 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 relationshipamong the values;Types which are defined in this way are called structured types.Every type d
24、efined using the notation specified in this Recommendation is assigned a tag. The tag is definedeither by this Recommendation or by the user of the notation.It is common for the same tag to be assigned to many different types, the particular type being identified by thecontext in which the tag is us
25、ed.The user of the notation may choose to assign distinct tags to two occurrences of a single type, therebycreating two distinct types. This can be necessary when it is required to distinguish which choice has been made insituations such as d) above.Four classes of tag are specified in the notation.
26、The first is the universal class. Universal class tags are only used as specified within this Recommendation,and each tag is eithera) assigned to a single type; orb) assigned to a construction mechanism.The second class of tag is the application class. Application class tags are assigned to types by
27、 other standardsor Recommendations. Within a particular standard or Recommendation, an application class tag is assigned to only onetype.The third class is the private class. Private class tags are never assigned by ISO Standards or CCITTRecommendations. Their use is enterprise specific.The final cl
28、ass of tag is the context-specific class. This is freely assigned within any use of this notation, andis interpreted according to the context in which it is used.6 Fascicle VIII.4 Rec. X.208Tags are mainly intended for machine use, and are not essential for the human notation defined in thisRecommen
29、dation. Where, however, it is necessary to require that certain types be distinct, this is expressed by requiringthat they have distinct tags. The allocation of tags is therefore an important part of the use of this notation.Note 1 All types which can be defined in the notation of this Recommendatio
30、n have a tag. Given any type,the user of the notation can define a new type with a different tag.Note 2 Encoding rules always carry the tag of a type, explicitly or implicitly, with any representation of avalue of the type. The restrictions placed on the use of the notation are designed to ensure th
31、at the tag is sufficient tounambiguously determine the actual type, provided the applicable type of definitions are available.This Recommendation specifies a notation which both enables complicated types to be defined and alsoenables values of these types to be specified. This is done without determ
32、ining the way an instance of this type is to berepresented (by a sequence of octets) during transfer. A notation which provides this facility is called a notation forabstract syntax definition.The purpose of this Recommendation is to specify a notation for abstract syntax definition called AbstractS
33、yntax Notation One, or ASN.1. Abstract Syntax Notation One is used as a semi-formal tool to define protocols. Theuse of the notation does not necessarily preclude ambiguous specifications. It is the responsibility of the users of thenotation to ensure that their specifications are not ambiguous.This
34、 Recommendation is supported by other standards and Recommendations which specify encoding rules.The application of encoding rules to the value of a type defined by ASN.1 results in a complete specification of therepresentation of values of that type during transfer (a transfer syntax).This Recommen
35、dation is technically and editorially aligned with ISO 8824 plus Addendum 1 to ISO 8824.Section one of this Recommendation defines the simple types supported by ASN.1, and specifies the notationto be used for referencing simple types and defining structured types. Section one also specifies the nota
36、tion to be usedfor specifying values of types defined using ASN.1.Section two of this Recommendation defines additional types (character string types) which, by the applicationof encoding rules for character sets, can be equated with the octetstring type.Section three of this Recommendation defines
37、certain structured types which are considered to be of generalutility, but which require no additional encoding rules.Section four of this Recommendation defines a notation which enables subtypes to be defined from the valuesof a parent type.Annex A is part of this Recommendation, and specifies a no
38、tation for extending the basic ASN.1 notation.This is called the macro facility.Annex B is part of this Recommendation, and defines the object identifier tree for authorities supported byISO.Annex C is part of this Recommendation and defines the object identifier tree for authorities supported byCCI
39、TT.Annex D is part of this Recommendation and defines the object identifier tree for joint use by ISO and CCITT.Appendix I is not part of this Recommendation, and provides examples and hints on the use of the ASN.1notation.Appendix II is not part of this Recommendation, and provides a summary of ASN
40、.1 using the notation of 5.The text of this Recommendation, and in particular the annexes B to D, are the subject of joint ISO-CCITTagreement.1 Scope and field of applicationThis Recommendation specifies a notation for abstract syntax definition called V Abstract Syntax Notation One(ASN.1).This Reco
41、mmendation defines a number of simple types, with their tags, and specifies a notation forreferencing these types and for specifying values of these types.Fascicle VIII.4 Rec. X.208 7This Recommendation defines mechanisms for constructing new types from more basic types, and specifies anotation for
42、defining such structured types and assigning them tags, and for specifying values of these types.This Recommendation defines character sets for use within ASN.1.This Recommendation defines a number of useful types (using ASN.1), which can be referenced by users ofASN.1.The ASN.1 notation can be appl
43、ied whenever it is necessary to define the abstract syntax of information. It isparticularly, but not exclusively, applicable to application protocols.The ASN.1 notation is also referenced by other presentation layer standards and Recommendations whichdefine encoding rules for the simple types, the
44、structured types, the character string types and the useful types defined inASN.1.2 References1 Recommendation X.200, Reference Model of Open Systems Interconnection for CCITT Applications (see alsoISO 7498).2 Recommendation X.209, Specification of Basic Encoding Rules for Abstract Syntax Notation O
45、ne (ASN.1) (seealso ISO 8825).3 Recommendation X.216, (see also ISO 8822), Presentation Service Definition for Open SystemsInterconnection for CCITT Applications.4 Recommendation X.226, Presentation Protocol Specification for Open Systems Interconnection for CCITTApplications (see also ISO 8823).5 I
46、SO 2014, Writing of calendar dates in all-numeric form.6 ISO 2375, Data processing Procedure for registration of escape sequences.7 ISO 3166, Codes for the representation of names of countries.8 ISO 3307, Information interchange Representations of time of the day.9 ISO 4031, Information interchange
47、Representation of local time differentials.10 ISO 6523, Data interchange Structure for identification of organizations.11 Recommendation X.121, International numbering plan for public data networks.3 DefinitionsThe definitions in Recommendation X.200 are used in this Recommendation.3.1 valueA distin
48、guished member of a set of values.3.2 typeA named set of values.3.3 simple typeA type defined by directly specifying the set of its values.3.4 structured typeA type defined by reference to one or more other types.3.5 component typeOne of the types referenced when defining a structured type.8 Fascicl
49、e VIII.4 Rec. X.2083.6 tagA type denotation which is associated with every ASN.1 type.3.7 taggingReplacing the existing (possibly the default) tag of a type by a specified tag.3.8 ASN.1 character setThe set of characters, specified in 7, used in the ASN.1 notation.3.9 itemsNamed sequences of characters from the ASN.1 character set, specified in 8, which are used to form theASN.1 notation.3.10 type (or value) reference nameA name associated uniquely with a type (or value) within some context.Note Refere