1*ebfedea0SLionel SambucA Layman's Guide to a Subset of ASN.1, BER, and DER 2*ebfedea0SLionel Sambuc 3*ebfedea0SLionel SambucAn RSA Laboratories Technical Note 4*ebfedea0SLionel SambucBurton S. Kaliski Jr. 5*ebfedea0SLionel SambucRevised November 1, 1993 6*ebfedea0SLionel Sambuc 7*ebfedea0SLionel Sambuc 8*ebfedea0SLionel SambucSupersedes June 3, 1991 version, which was also published as 9*ebfedea0SLionel SambucNIST/OSI Implementors' Workshop document SEC-SIG-91-17. 10*ebfedea0SLionel SambucPKCS documents are available by electronic mail to 11*ebfedea0SLionel Sambuc<pkcs@rsa.com>. 12*ebfedea0SLionel Sambuc 13*ebfedea0SLionel SambucCopyright (C) 1991-1993 RSA Laboratories, a division of RSA 14*ebfedea0SLionel SambucData Security, Inc. License to copy this document is granted 15*ebfedea0SLionel Sambucprovided that it is identified as "RSA Data Security, Inc. 16*ebfedea0SLionel SambucPublic-Key Cryptography Standards (PKCS)" in all material 17*ebfedea0SLionel Sambucmentioning or referencing this document. 18*ebfedea0SLionel Sambuc003-903015-110-000-000 19*ebfedea0SLionel Sambuc 20*ebfedea0SLionel Sambuc 21*ebfedea0SLionel SambucAbstract. This note gives a layman's introduction to a 22*ebfedea0SLionel Sambucsubset of OSI's Abstract Syntax Notation One (ASN.1), Basic 23*ebfedea0SLionel SambucEncoding Rules (BER), and Distinguished Encoding Rules 24*ebfedea0SLionel Sambuc(DER). The particular purpose of this note is to provide 25*ebfedea0SLionel Sambucbackground material sufficient for understanding and 26*ebfedea0SLionel Sambucimplementing the PKCS family of standards. 27*ebfedea0SLionel Sambuc 28*ebfedea0SLionel Sambuc 29*ebfedea0SLionel Sambuc1. Introduction 30*ebfedea0SLionel Sambuc 31*ebfedea0SLionel SambucIt is a generally accepted design principle that abstraction 32*ebfedea0SLionel Sambucis a key to managing software development. With abstraction, 33*ebfedea0SLionel Sambuca designer can specify a part of a system without concern 34*ebfedea0SLionel Sambucfor how the part is actually implemented or represented. 35*ebfedea0SLionel SambucSuch a practice leaves the implementation open; it 36*ebfedea0SLionel Sambucsimplifies the specification; and it makes it possible to 37*ebfedea0SLionel Sambucstate "axioms" about the part that can be proved when the 38*ebfedea0SLionel Sambucpart is implemented, and assumed when the part is employed 39*ebfedea0SLionel Sambucin another, higher-level part. Abstraction is the hallmark 40*ebfedea0SLionel Sambucof most modern software specifications. 41*ebfedea0SLionel Sambuc 42*ebfedea0SLionel SambucOne of the most complex systems today, and one that also 43*ebfedea0SLionel Sambucinvolves a great deal of abstraction, is Open Systems 44*ebfedea0SLionel SambucInterconnection (OSI, described in X.200). OSI is an 45*ebfedea0SLionel Sambucinternationally standardized architecture that governs the 46*ebfedea0SLionel Sambucinterconnection of computers from the physical layer up to 47*ebfedea0SLionel Sambucthe user application layer. Objects at higher layers are 48*ebfedea0SLionel Sambucdefined abstractly and intended to be implemented with 49*ebfedea0SLionel Sambucobjects at lower layers. For instance, a service at one 50*ebfedea0SLionel Sambuclayer may require transfer of certain abstract objects 51*ebfedea0SLionel Sambucbetween computers; a lower layer may provide transfer 52*ebfedea0SLionel Sambucservices for strings of ones and zeroes, using encoding 53*ebfedea0SLionel Sambucrules to transform the abstract objects into such strings. 54*ebfedea0SLionel SambucOSI is called an open system because it supports many 55*ebfedea0SLionel Sambucdifferent implementations of the services at each layer. 56*ebfedea0SLionel Sambuc 57*ebfedea0SLionel SambucOSI's method of specifying abstract objects is called ASN.1 58*ebfedea0SLionel Sambuc(Abstract Syntax Notation One, defined in X.208), and one 59*ebfedea0SLionel Sambucset of rules for representing such objects as strings of 60*ebfedea0SLionel Sambucones and zeros is called the BER (Basic Encoding Rules, 61*ebfedea0SLionel Sambucdefined in X.209). ASN.1 is a flexible notation that allows 62*ebfedea0SLionel Sambucone to define a variety data types, from simple types such 63*ebfedea0SLionel Sambucas integers and bit strings to structured types such as sets 64*ebfedea0SLionel Sambucand sequences, as well as complex types defined in terms of 65*ebfedea0SLionel Sambucothers. BER describes how to represent or encode values of 66*ebfedea0SLionel Sambuceach ASN.1 type as a string of eight-bit octets. There is 67*ebfedea0SLionel Sambucgenerally more than one way to BER-encode a given value. 68*ebfedea0SLionel SambucAnother set of rules, called the Distinguished Encoding 69*ebfedea0SLionel SambucRules (DER), which is a subset of BER, gives a unique 70*ebfedea0SLionel Sambucencoding to each ASN.1 value. 71*ebfedea0SLionel Sambuc 72*ebfedea0SLionel SambucThe purpose of this note is to describe a subset of ASN.1, 73*ebfedea0SLionel SambucBER and DER sufficient to understand and implement one OSI- 74*ebfedea0SLionel Sambucbased application, RSA Data Security, Inc.'s Public-Key 75*ebfedea0SLionel SambucCryptography Standards. The features described include an 76*ebfedea0SLionel Sambucoverview of ASN.1, BER, and DER and an abridged list of 77*ebfedea0SLionel SambucASN.1 types and their BER and DER encodings. Sections 2-4 78*ebfedea0SLionel Sambucgive an overview of ASN.1, BER, and DER, in that order. 79*ebfedea0SLionel SambucSection 5 lists some ASN.1 types, giving their notation, 80*ebfedea0SLionel Sambucspecific encoding rules, examples, and comments about their 81*ebfedea0SLionel Sambucapplication to PKCS. Section 6 concludes with an example, 82*ebfedea0SLionel SambucX.500 distinguished names. 83*ebfedea0SLionel Sambuc 84*ebfedea0SLionel SambucAdvanced features of ASN.1, such as macros, are not 85*ebfedea0SLionel Sambucdescribed in this note, as they are not needed to implement 86*ebfedea0SLionel SambucPKCS. For information on the other features, and for more 87*ebfedea0SLionel Sambucdetail generally, the reader is referred to CCITT 88*ebfedea0SLionel SambucRecommendations X.208 and X.209, which define ASN.1 and BER. 89*ebfedea0SLionel Sambuc 90*ebfedea0SLionel SambucTerminology and notation. In this note, an octet is an eight- 91*ebfedea0SLionel Sambucbit unsigned integer. Bit 8 of the octet is the most 92*ebfedea0SLionel Sambucsignificant and bit 1 is the least significant. 93*ebfedea0SLionel Sambuc 94*ebfedea0SLionel SambucThe following meta-syntax is used for in describing ASN.1 95*ebfedea0SLionel Sambucnotation: 96*ebfedea0SLionel Sambuc 97*ebfedea0SLionel Sambuc BIT monospace denotes literal characters in the type 98*ebfedea0SLionel Sambuc and value notation; in examples, it generally 99*ebfedea0SLionel Sambuc denotes an octet value in hexadecimal 100*ebfedea0SLionel Sambuc 101*ebfedea0SLionel Sambuc n1 bold italics denotes a variable 102*ebfedea0SLionel Sambuc 103*ebfedea0SLionel Sambuc [] bold square brackets indicate that a term is 104*ebfedea0SLionel Sambuc optional 105*ebfedea0SLionel Sambuc 106*ebfedea0SLionel Sambuc {} bold braces group related terms 107*ebfedea0SLionel Sambuc 108*ebfedea0SLionel Sambuc | bold vertical bar delimits alternatives with a 109*ebfedea0SLionel Sambuc group 110*ebfedea0SLionel Sambuc 111*ebfedea0SLionel Sambuc ... bold ellipsis indicates repeated occurrences 112*ebfedea0SLionel Sambuc 113*ebfedea0SLionel Sambuc = bold equals sign expresses terms as subterms 114*ebfedea0SLionel Sambuc 115*ebfedea0SLionel Sambuc 116*ebfedea0SLionel Sambuc2. Abstract Syntax Notation One 117*ebfedea0SLionel Sambuc 118*ebfedea0SLionel SambucAbstract Syntax Notation One, abbreviated ASN.1, is a 119*ebfedea0SLionel Sambucnotation for describing abstract types and values. 120*ebfedea0SLionel Sambuc 121*ebfedea0SLionel SambucIn ASN.1, a type is a set of values. For some types, there 122*ebfedea0SLionel Sambucare a finite number of values, and for other types there are 123*ebfedea0SLionel Sambucan infinite number. A value of a given ASN.1 type is an 124*ebfedea0SLionel Sambucelement of the type's set. ASN.1 has four kinds of type: 125*ebfedea0SLionel Sambucsimple types, which are "atomic" and have no components; 126*ebfedea0SLionel Sambucstructured types, which have components; tagged types, which 127*ebfedea0SLionel Sambucare derived from other types; and other types, which include 128*ebfedea0SLionel Sambucthe CHOICE type and the ANY type. Types and values can be 129*ebfedea0SLionel Sambucgiven names with the ASN.1 assignment operator (::=) , and 130*ebfedea0SLionel Sambucthose names can be used in defining other types and values. 131*ebfedea0SLionel Sambuc 132*ebfedea0SLionel SambucEvery ASN.1 type other than CHOICE and ANY has a tag, which 133*ebfedea0SLionel Sambucconsists of a class and a nonnegative tag number. ASN.1 134*ebfedea0SLionel Sambuctypes are abstractly the same if and only if their tag 135*ebfedea0SLionel Sambucnumbers are the same. In other words, the name of an ASN.1 136*ebfedea0SLionel Sambuctype does not affect its abstract meaning, only the tag 137*ebfedea0SLionel Sambucdoes. There are four classes of tag: 138*ebfedea0SLionel Sambuc 139*ebfedea0SLionel Sambuc Universal, for types whose meaning is the same in all 140*ebfedea0SLionel Sambuc applications; these types are only defined in 141*ebfedea0SLionel Sambuc X.208. 142*ebfedea0SLionel Sambuc 143*ebfedea0SLionel Sambuc Application, for types whose meaning is specific to an 144*ebfedea0SLionel Sambuc application, such as X.500 directory services; 145*ebfedea0SLionel Sambuc types in two different applications may have the 146*ebfedea0SLionel Sambuc same application-specific tag and different 147*ebfedea0SLionel Sambuc meanings. 148*ebfedea0SLionel Sambuc 149*ebfedea0SLionel Sambuc Private, for types whose meaning is specific to a given 150*ebfedea0SLionel Sambuc enterprise. 151*ebfedea0SLionel Sambuc 152*ebfedea0SLionel Sambuc Context-specific, for types whose meaning is specific 153*ebfedea0SLionel Sambuc to a given structured type; context-specific tags 154*ebfedea0SLionel Sambuc are used to distinguish between component types 155*ebfedea0SLionel Sambuc with the same underlying tag within the context of 156*ebfedea0SLionel Sambuc a given structured type, and component types in 157*ebfedea0SLionel Sambuc two different structured types may have the same 158*ebfedea0SLionel Sambuc tag and different meanings. 159*ebfedea0SLionel Sambuc 160*ebfedea0SLionel SambucThe types with universal tags are defined in X.208, which 161*ebfedea0SLionel Sambucalso gives the types' universal tag numbers. Types with 162*ebfedea0SLionel Sambucother tags are defined in many places, and are always 163*ebfedea0SLionel Sambucobtained by implicit or explicit tagging (see Section 2.3). 164*ebfedea0SLionel SambucTable 1 lists some ASN.1 types and their universal-class 165*ebfedea0SLionel Sambuctags. 166*ebfedea0SLionel Sambuc 167*ebfedea0SLionel Sambuc Type Tag number Tag number 168*ebfedea0SLionel Sambuc (decimal) (hexadecimal) 169*ebfedea0SLionel Sambuc INTEGER 2 02 170*ebfedea0SLionel Sambuc BIT STRING 3 03 171*ebfedea0SLionel Sambuc OCTET STRING 4 04 172*ebfedea0SLionel Sambuc NULL 5 05 173*ebfedea0SLionel Sambuc OBJECT IDENTIFIER 6 06 174*ebfedea0SLionel Sambuc SEQUENCE and SEQUENCE OF 16 10 175*ebfedea0SLionel Sambuc SET and SET OF 17 11 176*ebfedea0SLionel Sambuc PrintableString 19 13 177*ebfedea0SLionel Sambuc T61String 20 14 178*ebfedea0SLionel Sambuc IA5String 22 16 179*ebfedea0SLionel Sambuc UTCTime 23 17 180*ebfedea0SLionel Sambuc 181*ebfedea0SLionel Sambuc Table 1. Some types and their universal-class tags. 182*ebfedea0SLionel Sambuc 183*ebfedea0SLionel SambucASN.1 types and values are expressed in a flexible, 184*ebfedea0SLionel Sambucprogramming-language-like notation, with the following 185*ebfedea0SLionel Sambucspecial rules: 186*ebfedea0SLionel Sambuc 187*ebfedea0SLionel Sambuc o Layout is not significant; multiple spaces and 188*ebfedea0SLionel Sambuc line breaks can be considered as a single space. 189*ebfedea0SLionel Sambuc 190*ebfedea0SLionel Sambuc o Comments are delimited by pairs of hyphens (--), 191*ebfedea0SLionel Sambuc or a pair of hyphens and a line break. 192*ebfedea0SLionel Sambuc 193*ebfedea0SLionel Sambuc o Identifiers (names of values and fields) and type 194*ebfedea0SLionel Sambuc references (names of types) consist of upper- and 195*ebfedea0SLionel Sambuc lower-case letters, digits, hyphens, and spaces; 196*ebfedea0SLionel Sambuc identifiers begin with lower-case letters; type 197*ebfedea0SLionel Sambuc references begin with upper-case letters. 198*ebfedea0SLionel Sambuc 199*ebfedea0SLionel SambucThe following four subsections give an overview of simple 200*ebfedea0SLionel Sambuctypes, structured types, implicitly and explicitly tagged 201*ebfedea0SLionel Sambuctypes, and other types. Section 5 describes specific types 202*ebfedea0SLionel Sambucin more detail. 203*ebfedea0SLionel Sambuc 204*ebfedea0SLionel Sambuc 205*ebfedea0SLionel Sambuc2.1 Simple types 206*ebfedea0SLionel Sambuc 207*ebfedea0SLionel SambucSimple types are those not consisting of components; they 208*ebfedea0SLionel Sambucare the "atomic" types. ASN.1 defines several; the types 209*ebfedea0SLionel Sambucthat are relevant to the PKCS standards are the following: 210*ebfedea0SLionel Sambuc 211*ebfedea0SLionel Sambuc BIT STRING, an arbitrary string of bits (ones and 212*ebfedea0SLionel Sambuc zeroes). 213*ebfedea0SLionel Sambuc 214*ebfedea0SLionel Sambuc IA5String, an arbitrary string of IA5 (ASCII) 215*ebfedea0SLionel Sambuc characters. 216*ebfedea0SLionel Sambuc 217*ebfedea0SLionel Sambuc INTEGER, an arbitrary integer. 218*ebfedea0SLionel Sambuc 219*ebfedea0SLionel Sambuc NULL, a null value. 220*ebfedea0SLionel Sambuc 221*ebfedea0SLionel Sambuc OBJECT IDENTIFIER, an object identifier, which is a 222*ebfedea0SLionel Sambuc sequence of integer components that identify an 223*ebfedea0SLionel Sambuc object such as an algorithm or attribute type. 224*ebfedea0SLionel Sambuc 225*ebfedea0SLionel Sambuc OCTET STRING, an arbitrary string of octets (eight-bit 226*ebfedea0SLionel Sambuc values). 227*ebfedea0SLionel Sambuc 228*ebfedea0SLionel Sambuc PrintableString, an arbitrary string of printable 229*ebfedea0SLionel Sambuc characters. 230*ebfedea0SLionel Sambuc 231*ebfedea0SLionel Sambuc T61String, an arbitrary string of T.61 (eight-bit) 232*ebfedea0SLionel Sambuc characters. 233*ebfedea0SLionel Sambuc 234*ebfedea0SLionel Sambuc UTCTime, a "coordinated universal time" or Greenwich 235*ebfedea0SLionel Sambuc Mean Time (GMT) value. 236*ebfedea0SLionel Sambuc 237*ebfedea0SLionel SambucSimple types fall into two categories: string types and non- 238*ebfedea0SLionel Sambucstring types. BIT STRING, IA5String, OCTET STRING, 239*ebfedea0SLionel SambucPrintableString, T61String, and UTCTime are string types. 240*ebfedea0SLionel Sambuc 241*ebfedea0SLionel SambucString types can be viewed, for the purposes of encoding, as 242*ebfedea0SLionel Sambucconsisting of components, where the components are 243*ebfedea0SLionel Sambucsubstrings. This view allows one to encode a value whose 244*ebfedea0SLionel Sambuclength is not known in advance (e.g., an octet string value 245*ebfedea0SLionel Sambucinput from a file stream) with a constructed, indefinite- 246*ebfedea0SLionel Sambuclength encoding (see Section 3). 247*ebfedea0SLionel Sambuc 248*ebfedea0SLionel SambucThe string types can be given size constraints limiting the 249*ebfedea0SLionel Sambuclength of values. 250*ebfedea0SLionel Sambuc 251*ebfedea0SLionel Sambuc 252*ebfedea0SLionel Sambuc2.2 Structured types 253*ebfedea0SLionel Sambuc 254*ebfedea0SLionel SambucStructured types are those consisting of components. ASN.1 255*ebfedea0SLionel Sambucdefines four, all of which are relevant to the PKCS 256*ebfedea0SLionel Sambucstandards: 257*ebfedea0SLionel Sambuc 258*ebfedea0SLionel Sambuc SEQUENCE, an ordered collection of one or more types. 259*ebfedea0SLionel Sambuc 260*ebfedea0SLionel Sambuc SEQUENCE OF, an ordered collection of zero or more 261*ebfedea0SLionel Sambuc occurrences of a given type. 262*ebfedea0SLionel Sambuc 263*ebfedea0SLionel Sambuc SET, an unordered collection of one or more types. 264*ebfedea0SLionel Sambuc 265*ebfedea0SLionel Sambuc SET OF, an unordered collection of zero or more 266*ebfedea0SLionel Sambuc occurrences of a given type. 267*ebfedea0SLionel Sambuc 268*ebfedea0SLionel SambucThe structured types can have optional components, possibly 269*ebfedea0SLionel Sambucwith default values. 270*ebfedea0SLionel Sambuc 271*ebfedea0SLionel Sambuc 272*ebfedea0SLionel Sambuc2.3 Implicitly and explicitly tagged types 273*ebfedea0SLionel Sambuc 274*ebfedea0SLionel SambucTagging is useful to distinguish types within an 275*ebfedea0SLionel Sambucapplication; it is also commonly used to distinguish 276*ebfedea0SLionel Sambuccomponent types within a structured type. For instance, 277*ebfedea0SLionel Sambucoptional components of a SET or SEQUENCE type are typically 278*ebfedea0SLionel Sambucgiven distinct context-specific tags to avoid ambiguity. 279*ebfedea0SLionel Sambuc 280*ebfedea0SLionel SambucThere are two ways to tag a type: implicitly and explicitly. 281*ebfedea0SLionel Sambuc 282*ebfedea0SLionel SambucImplicitly tagged types are derived from other types by 283*ebfedea0SLionel Sambucchanging the tag of the underlying type. Implicit tagging is 284*ebfedea0SLionel Sambucdenoted by the ASN.1 keywords [class number] IMPLICIT (see 285*ebfedea0SLionel SambucSection 5.1). 286*ebfedea0SLionel Sambuc 287*ebfedea0SLionel SambucExplicitly tagged types are derived from other types by 288*ebfedea0SLionel Sambucadding an outer tag to the underlying type. In effect, 289*ebfedea0SLionel Sambucexplicitly tagged types are structured types consisting of 290*ebfedea0SLionel Sambucone component, the underlying type. Explicit tagging is 291*ebfedea0SLionel Sambucdenoted by the ASN.1 keywords [class number] EXPLICIT (see 292*ebfedea0SLionel SambucSection 5.2). 293*ebfedea0SLionel Sambuc 294*ebfedea0SLionel SambucThe keyword [class number] alone is the same as explicit 295*ebfedea0SLionel Sambuctagging, except when the "module" in which the ASN.1 type is 296*ebfedea0SLionel Sambucdefined has implicit tagging by default. ("Modules" are 297*ebfedea0SLionel Sambucamong the advanced features not described in this note.) 298*ebfedea0SLionel Sambuc 299*ebfedea0SLionel SambucFor purposes of encoding, an implicitly tagged type is 300*ebfedea0SLionel Sambucconsidered the same as the underlying type, except that the 301*ebfedea0SLionel Sambuctag is different. An explicitly tagged type is considered 302*ebfedea0SLionel Sambuclike a structured type with one component, the underlying 303*ebfedea0SLionel Sambuctype. Implicit tags result in shorter encodings, but 304*ebfedea0SLionel Sambucexplicit tags may be necessary to avoid ambiguity if the tag 305*ebfedea0SLionel Sambucof the underlying type is indeterminate (e.g., the 306*ebfedea0SLionel Sambucunderlying type is CHOICE or ANY). 307*ebfedea0SLionel Sambuc 308*ebfedea0SLionel Sambuc 309*ebfedea0SLionel Sambuc2.4 Other types 310*ebfedea0SLionel Sambuc 311*ebfedea0SLionel SambucOther types in ASN.1 include the CHOICE and ANY types. The 312*ebfedea0SLionel SambucCHOICE type denotes a union of one or more alternatives; the 313*ebfedea0SLionel SambucANY type denotes an arbitrary value of an arbitrary type, 314*ebfedea0SLionel Sambucwhere the arbitrary type is possibly defined in the 315*ebfedea0SLionel Sambucregistration of an object identifier or integer value. 316*ebfedea0SLionel Sambuc 317*ebfedea0SLionel Sambuc 318*ebfedea0SLionel Sambuc3. Basic Encoding Rules 319*ebfedea0SLionel Sambuc 320*ebfedea0SLionel SambucThe Basic Encoding Rules for ASN.1, abbreviated BER, give 321*ebfedea0SLionel Sambucone or more ways to represent any ASN.1 value as an octet 322*ebfedea0SLionel Sambucstring. (There are certainly other ways to represent ASN.1 323*ebfedea0SLionel Sambucvalues, but BER is the standard for interchanging such 324*ebfedea0SLionel Sambucvalues in OSI.) 325*ebfedea0SLionel Sambuc 326*ebfedea0SLionel SambucThere are three methods to encode an ASN.1 value under BER, 327*ebfedea0SLionel Sambucthe choice of which depends on the type of value and whether 328*ebfedea0SLionel Sambucthe length of the value is known. The three methods are 329*ebfedea0SLionel Sambucprimitive, definite-length encoding; constructed, definite- 330*ebfedea0SLionel Sambuclength encoding; and constructed, indefinite-length 331*ebfedea0SLionel Sambucencoding. Simple non-string types employ the primitive, 332*ebfedea0SLionel Sambucdefinite-length method; structured types employ either of 333*ebfedea0SLionel Sambucthe constructed methods; and simple string types employ any 334*ebfedea0SLionel Sambucof the methods, depending on whether the length of the value 335*ebfedea0SLionel Sambucis known. Types derived by implicit tagging employ the 336*ebfedea0SLionel Sambucmethod of the underlying type and types derived by explicit 337*ebfedea0SLionel Sambuctagging employ the constructed methods. 338*ebfedea0SLionel Sambuc 339*ebfedea0SLionel SambucIn each method, the BER encoding has three or four parts: 340*ebfedea0SLionel Sambuc 341*ebfedea0SLionel Sambuc Identifier octets. These identify the class and tag 342*ebfedea0SLionel Sambuc number of the ASN.1 value, and indicate whether 343*ebfedea0SLionel Sambuc the method is primitive or constructed. 344*ebfedea0SLionel Sambuc 345*ebfedea0SLionel Sambuc Length octets. For the definite-length methods, these 346*ebfedea0SLionel Sambuc give the number of contents octets. For the 347*ebfedea0SLionel Sambuc constructed, indefinite-length method, these 348*ebfedea0SLionel Sambuc indicate that the length is indefinite. 349*ebfedea0SLionel Sambuc 350*ebfedea0SLionel Sambuc Contents octets. For the primitive, definite-length 351*ebfedea0SLionel Sambuc method, these give a concrete representation of 352*ebfedea0SLionel Sambuc the value. For the constructed methods, these 353*ebfedea0SLionel Sambuc give the concatenation of the BER encodings of the 354*ebfedea0SLionel Sambuc components of the value. 355*ebfedea0SLionel Sambuc 356*ebfedea0SLionel Sambuc End-of-contents octets. For the constructed, indefinite- 357*ebfedea0SLionel Sambuc length method, these denote the end of the 358*ebfedea0SLionel Sambuc contents. For the other methods, these are absent. 359*ebfedea0SLionel Sambuc 360*ebfedea0SLionel SambucThe three methods of encoding are described in the following 361*ebfedea0SLionel Sambucsections. 362*ebfedea0SLionel Sambuc 363*ebfedea0SLionel Sambuc 364*ebfedea0SLionel Sambuc3.1 Primitive, definite-length method 365*ebfedea0SLionel Sambuc 366*ebfedea0SLionel SambucThis method applies to simple types and types derived from 367*ebfedea0SLionel Sambucsimple types by implicit tagging. It requires that the 368*ebfedea0SLionel Sambuclength of the value be known in advance. The parts of the 369*ebfedea0SLionel SambucBER encoding are as follows: 370*ebfedea0SLionel Sambuc 371*ebfedea0SLionel SambucIdentifier octets. There are two forms: low tag number (for 372*ebfedea0SLionel Sambuctag numbers between 0 and 30) and high tag number (for tag 373*ebfedea0SLionel Sambucnumbers 31 and greater). 374*ebfedea0SLionel Sambuc 375*ebfedea0SLionel Sambuc Low-tag-number form. One octet. Bits 8 and 7 specify 376*ebfedea0SLionel Sambuc the class (see Table 2), bit 6 has value "0," 377*ebfedea0SLionel Sambuc indicating that the encoding is primitive, and 378*ebfedea0SLionel Sambuc bits 5-1 give the tag number. 379*ebfedea0SLionel Sambuc 380*ebfedea0SLionel Sambuc Class Bit Bit 381*ebfedea0SLionel Sambuc 8 7 382*ebfedea0SLionel Sambuc universal 0 0 383*ebfedea0SLionel Sambuc application 0 1 384*ebfedea0SLionel Sambuc context-specific 1 0 385*ebfedea0SLionel Sambuc private 1 1 386*ebfedea0SLionel Sambuc 387*ebfedea0SLionel Sambuc Table 2. Class encoding in identifier octets. 388*ebfedea0SLionel Sambuc 389*ebfedea0SLionel Sambuc High-tag-number form. Two or more octets. First octet 390*ebfedea0SLionel Sambuc is as in low-tag-number form, except that bits 5-1 391*ebfedea0SLionel Sambuc all have value "1." Second and following octets 392*ebfedea0SLionel Sambuc give the tag number, base 128, most significant 393*ebfedea0SLionel Sambuc digit first, with as few digits as possible, and 394*ebfedea0SLionel Sambuc with the bit 8 of each octet except the last set 395*ebfedea0SLionel Sambuc to "1." 396*ebfedea0SLionel Sambuc 397*ebfedea0SLionel SambucLength octets. There are two forms: short (for lengths 398*ebfedea0SLionel Sambucbetween 0 and 127), and long definite (for lengths between 0 399*ebfedea0SLionel Sambucand 21008-1). 400*ebfedea0SLionel Sambuc 401*ebfedea0SLionel Sambuc Short form. One octet. Bit 8 has value "0" and bits 7-1 402*ebfedea0SLionel Sambuc give the length. 403*ebfedea0SLionel Sambuc 404*ebfedea0SLionel Sambuc Long form. Two to 127 octets. Bit 8 of first octet has 405*ebfedea0SLionel Sambuc value "1" and bits 7-1 give the number of 406*ebfedea0SLionel Sambuc additional length octets. Second and following 407*ebfedea0SLionel Sambuc octets give the length, base 256, most significant 408*ebfedea0SLionel Sambuc digit first. 409*ebfedea0SLionel Sambuc 410*ebfedea0SLionel SambucContents octets. These give a concrete representation of the 411*ebfedea0SLionel Sambucvalue (or the value of the underlying type, if the type is 412*ebfedea0SLionel Sambucderived by implicit tagging). Details for particular types 413*ebfedea0SLionel Sambucare given in Section 5. 414*ebfedea0SLionel Sambuc 415*ebfedea0SLionel Sambuc 416*ebfedea0SLionel Sambuc3.2 Constructed, definite-length method 417*ebfedea0SLionel Sambuc 418*ebfedea0SLionel SambucThis method applies to simple string types, structured 419*ebfedea0SLionel Sambuctypes, types derived simple string types and structured 420*ebfedea0SLionel Sambuctypes by implicit tagging, and types derived from anything 421*ebfedea0SLionel Sambucby explicit tagging. It requires that the length of the 422*ebfedea0SLionel Sambucvalue be known in advance. The parts of the BER encoding are 423*ebfedea0SLionel Sambucas follows: 424*ebfedea0SLionel Sambuc 425*ebfedea0SLionel SambucIdentifier octets. As described in Section 3.1, except that 426*ebfedea0SLionel Sambucbit 6 has value "1," indicating that the encoding is 427*ebfedea0SLionel Sambucconstructed. 428*ebfedea0SLionel Sambuc 429*ebfedea0SLionel SambucLength octets. As described in Section 3.1. 430*ebfedea0SLionel Sambuc 431*ebfedea0SLionel SambucContents octets. The concatenation of the BER encodings of 432*ebfedea0SLionel Sambucthe components of the value: 433*ebfedea0SLionel Sambuc 434*ebfedea0SLionel Sambuc o For simple string types and types derived from 435*ebfedea0SLionel Sambuc them by implicit tagging, the concatenation of the 436*ebfedea0SLionel Sambuc BER encodings of consecutive substrings of the 437*ebfedea0SLionel Sambuc value (underlying value for implicit tagging). 438*ebfedea0SLionel Sambuc 439*ebfedea0SLionel Sambuc o For structured types and types derived from them 440*ebfedea0SLionel Sambuc by implicit tagging, the concatenation of the BER 441*ebfedea0SLionel Sambuc encodings of components of the value (underlying 442*ebfedea0SLionel Sambuc value for implicit tagging). 443*ebfedea0SLionel Sambuc 444*ebfedea0SLionel Sambuc o For types derived from anything by explicit 445*ebfedea0SLionel Sambuc tagging, the BER encoding of the underlying value. 446*ebfedea0SLionel Sambuc 447*ebfedea0SLionel SambucDetails for particular types are given in Section 5. 448*ebfedea0SLionel Sambuc 449*ebfedea0SLionel Sambuc 450*ebfedea0SLionel Sambuc3.3 Constructed, indefinite-length method 451*ebfedea0SLionel Sambuc 452*ebfedea0SLionel SambucThis method applies to simple string types, structured 453*ebfedea0SLionel Sambuctypes, types derived simple string types and structured 454*ebfedea0SLionel Sambuctypes by implicit tagging, and types derived from anything 455*ebfedea0SLionel Sambucby explicit tagging. It does not require that the length of 456*ebfedea0SLionel Sambucthe value be known in advance. The parts of the BER encoding 457*ebfedea0SLionel Sambucare as follows: 458*ebfedea0SLionel Sambuc 459*ebfedea0SLionel SambucIdentifier octets. As described in Section 3.2. 460*ebfedea0SLionel Sambuc 461*ebfedea0SLionel SambucLength octets. One octet, 80. 462*ebfedea0SLionel Sambuc 463*ebfedea0SLionel SambucContents octets. As described in Section 3.2. 464*ebfedea0SLionel Sambuc 465*ebfedea0SLionel SambucEnd-of-contents octets. Two octets, 00 00. 466*ebfedea0SLionel Sambuc 467*ebfedea0SLionel SambucSince the end-of-contents octets appear where an ordinary 468*ebfedea0SLionel SambucBER encoding might be expected (e.g., in the contents octets 469*ebfedea0SLionel Sambucof a sequence value), the 00 and 00 appear as identifier and 470*ebfedea0SLionel Sambuclength octets, respectively. Thus the end-of-contents octets 471*ebfedea0SLionel Sambucis really the primitive, definite-length encoding of a value 472*ebfedea0SLionel Sambucwith universal class, tag number 0, and length 0. 473*ebfedea0SLionel Sambuc 474*ebfedea0SLionel Sambuc 475*ebfedea0SLionel Sambuc4. Distinguished Encoding Rules 476*ebfedea0SLionel Sambuc 477*ebfedea0SLionel SambucThe Distinguished Encoding Rules for ASN.1, abbreviated DER, 478*ebfedea0SLionel Sambucare a subset of BER, and give exactly one way to represent 479*ebfedea0SLionel Sambucany ASN.1 value as an octet string. DER is intended for 480*ebfedea0SLionel Sambucapplications in which a unique octet string encoding is 481*ebfedea0SLionel Sambucneeded, as is the case when a digital signature is computed 482*ebfedea0SLionel Sambucon an ASN.1 value. DER is defined in Section 8.7 of X.509. 483*ebfedea0SLionel Sambuc 484*ebfedea0SLionel SambucDER adds the following restrictions to the rules given in 485*ebfedea0SLionel SambucSection 3: 486*ebfedea0SLionel Sambuc 487*ebfedea0SLionel Sambuc 1. When the length is between 0 and 127, the short 488*ebfedea0SLionel Sambuc form of length must be used 489*ebfedea0SLionel Sambuc 490*ebfedea0SLionel Sambuc 2. When the length is 128 or greater, the long form 491*ebfedea0SLionel Sambuc of length must be used, and the length must be 492*ebfedea0SLionel Sambuc encoded in the minimum number of octets. 493*ebfedea0SLionel Sambuc 494*ebfedea0SLionel Sambuc 3. For simple string types and implicitly tagged 495*ebfedea0SLionel Sambuc types derived from simple string types, the 496*ebfedea0SLionel Sambuc primitive, definite-length method must be 497*ebfedea0SLionel Sambuc employed. 498*ebfedea0SLionel Sambuc 499*ebfedea0SLionel Sambuc 4. For structured types, implicitly tagged types 500*ebfedea0SLionel Sambuc derived from structured types, and explicitly 501*ebfedea0SLionel Sambuc tagged types derived from anything, the 502*ebfedea0SLionel Sambuc constructed, definite-length method must be 503*ebfedea0SLionel Sambuc employed. 504*ebfedea0SLionel Sambuc 505*ebfedea0SLionel SambucOther restrictions are defined for particular types (such as 506*ebfedea0SLionel SambucBIT STRING, SEQUENCE, SET, and SET OF), and can be found in 507*ebfedea0SLionel SambucSection 5. 508*ebfedea0SLionel Sambuc 509*ebfedea0SLionel Sambuc 510*ebfedea0SLionel Sambuc5. Notation and encodings for some types 511*ebfedea0SLionel Sambuc 512*ebfedea0SLionel SambucThis section gives the notation for some ASN.1 types and 513*ebfedea0SLionel Sambucdescribes how to encode values of those types under both BER 514*ebfedea0SLionel Sambucand DER. 515*ebfedea0SLionel Sambuc 516*ebfedea0SLionel SambucThe types described are those presented in Section 2. They 517*ebfedea0SLionel Sambucare listed alphabetically here. 518*ebfedea0SLionel Sambuc 519*ebfedea0SLionel SambucEach description includes ASN.1 notation, BER encoding, and 520*ebfedea0SLionel SambucDER encoding. The focus of the encodings is primarily on the 521*ebfedea0SLionel Sambuccontents octets; the tag and length octets follow Sections 3 522*ebfedea0SLionel Sambucand 4. The descriptions also explain where each type is used 523*ebfedea0SLionel Sambucin PKCS and related standards. ASN.1 notation is generally 524*ebfedea0SLionel Sambuconly for types, although for the type OBJECT IDENTIFIER, 525*ebfedea0SLionel Sambucvalue notation is given as well. 526*ebfedea0SLionel Sambuc 527*ebfedea0SLionel Sambuc 528*ebfedea0SLionel Sambuc5.1 Implicitly tagged types 529*ebfedea0SLionel Sambuc 530*ebfedea0SLionel SambucAn implicitly tagged type is a type derived from another 531*ebfedea0SLionel Sambuctype by changing the tag of the underlying type. 532*ebfedea0SLionel Sambuc 533*ebfedea0SLionel SambucImplicit tagging is used for optional SEQUENCE components 534*ebfedea0SLionel Sambucwith underlying type other than ANY throughout PKCS, and for 535*ebfedea0SLionel Sambucthe extendedCertificate alternative of PKCS #7's 536*ebfedea0SLionel SambucExtendedCertificateOrCertificate type. 537*ebfedea0SLionel Sambuc 538*ebfedea0SLionel SambucASN.1 notation: 539*ebfedea0SLionel Sambuc 540*ebfedea0SLionel Sambuc[[class] number] IMPLICIT Type 541*ebfedea0SLionel Sambuc 542*ebfedea0SLionel Sambucclass = UNIVERSAL | APPLICATION | PRIVATE 543*ebfedea0SLionel Sambuc 544*ebfedea0SLionel Sambucwhere Type is a type, class is an optional class name, and 545*ebfedea0SLionel Sambucnumber is the tag number within the class, a nonnegative 546*ebfedea0SLionel Sambucinteger. 547*ebfedea0SLionel Sambuc 548*ebfedea0SLionel SambucIn ASN.1 "modules" whose default tagging method is implicit 549*ebfedea0SLionel Sambuctagging, the notation [[class] number] Type is also 550*ebfedea0SLionel Sambucacceptable, and the keyword IMPLICIT is implied. (See 551*ebfedea0SLionel SambucSection 2.3.) For definitions stated outside a module, the 552*ebfedea0SLionel Sambucexplicit inclusion of the keyword IMPLICIT is preferable to 553*ebfedea0SLionel Sambucprevent ambiguity. 554*ebfedea0SLionel Sambuc 555*ebfedea0SLionel SambucIf the class name is absent, then the tag is context- 556*ebfedea0SLionel Sambucspecific. Context-specific tags can only appear in a 557*ebfedea0SLionel Sambuccomponent of a structured or CHOICE type. 558*ebfedea0SLionel Sambuc 559*ebfedea0SLionel SambucExample: PKCS #8's PrivateKeyInfo type has an optional 560*ebfedea0SLionel Sambucattributes component with an implicit, context-specific tag: 561*ebfedea0SLionel Sambuc 562*ebfedea0SLionel SambucPrivateKeyInfo ::= SEQUENCE { 563*ebfedea0SLionel Sambuc version Version, 564*ebfedea0SLionel Sambuc privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, 565*ebfedea0SLionel Sambuc privateKey PrivateKey, 566*ebfedea0SLionel Sambuc attributes [0] IMPLICIT Attributes OPTIONAL } 567*ebfedea0SLionel Sambuc 568*ebfedea0SLionel SambucHere the underlying type is Attributes, the class is absent 569*ebfedea0SLionel Sambuc(i.e., context-specific), and the tag number within the 570*ebfedea0SLionel Sambucclass is 0. 571*ebfedea0SLionel Sambuc 572*ebfedea0SLionel SambucBER encoding. Primitive or constructed, depending on the 573*ebfedea0SLionel Sambucunderlying type. Contents octets are as for the BER encoding 574*ebfedea0SLionel Sambucof the underlying value. 575*ebfedea0SLionel Sambuc 576*ebfedea0SLionel SambucExample: The BER encoding of the attributes component of a 577*ebfedea0SLionel SambucPrivateKeyInfo value is as follows: 578*ebfedea0SLionel Sambuc 579*ebfedea0SLionel Sambuc o the identifier octets are 80 if the underlying 580*ebfedea0SLionel Sambuc Attributes value has a primitive BER encoding and 581*ebfedea0SLionel Sambuc a0 if the underlying Attributes value has a 582*ebfedea0SLionel Sambuc constructed BER encoding 583*ebfedea0SLionel Sambuc 584*ebfedea0SLionel Sambuc o the length and contents octets are the same as the 585*ebfedea0SLionel Sambuc length and contents octets of the BER encoding of 586*ebfedea0SLionel Sambuc the underlying Attributes value 587*ebfedea0SLionel Sambuc 588*ebfedea0SLionel SambucDER encoding. Primitive or constructed, depending on the 589*ebfedea0SLionel Sambucunderlying type. Contents octets are as for the DER encoding 590*ebfedea0SLionel Sambucof the underlying value. 591*ebfedea0SLionel Sambuc 592*ebfedea0SLionel Sambuc 593*ebfedea0SLionel Sambuc5.2 Explicitly tagged types 594*ebfedea0SLionel Sambuc 595*ebfedea0SLionel SambucExplicit tagging denotes a type derived from another type by 596*ebfedea0SLionel Sambucadding an outer tag to the underlying type. 597*ebfedea0SLionel Sambuc 598*ebfedea0SLionel SambucExplicit tagging is used for optional SEQUENCE components 599*ebfedea0SLionel Sambucwith underlying type ANY throughout PKCS, and for the 600*ebfedea0SLionel Sambucversion component of X.509's Certificate type. 601*ebfedea0SLionel Sambuc 602*ebfedea0SLionel SambucASN.1 notation: 603*ebfedea0SLionel Sambuc 604*ebfedea0SLionel Sambuc[[class] number] EXPLICIT Type 605*ebfedea0SLionel Sambuc 606*ebfedea0SLionel Sambucclass = UNIVERSAL | APPLICATION | PRIVATE 607*ebfedea0SLionel Sambuc 608*ebfedea0SLionel Sambucwhere Type is a type, class is an optional class name, and 609*ebfedea0SLionel Sambucnumber is the tag number within the class, a nonnegative 610*ebfedea0SLionel Sambucinteger. 611*ebfedea0SLionel Sambuc 612*ebfedea0SLionel SambucIf the class name is absent, then the tag is context- 613*ebfedea0SLionel Sambucspecific. Context-specific tags can only appear in a 614*ebfedea0SLionel Sambuccomponent of a SEQUENCE, SET or CHOICE type. 615*ebfedea0SLionel Sambuc 616*ebfedea0SLionel SambucIn ASN.1 "modules" whose default tagging method is explicit 617*ebfedea0SLionel Sambuctagging, the notation [[class] number] Type is also 618*ebfedea0SLionel Sambucacceptable, and the keyword EXPLICIT is implied. (See 619*ebfedea0SLionel SambucSection 2.3.) For definitions stated outside a module, the 620*ebfedea0SLionel Sambucexplicit inclusion of the keyword EXPLICIT is preferable to 621*ebfedea0SLionel Sambucprevent ambiguity. 622*ebfedea0SLionel Sambuc 623*ebfedea0SLionel SambucExample 1: PKCS #7's ContentInfo type has an optional 624*ebfedea0SLionel Sambuccontent component with an explicit, context-specific tag: 625*ebfedea0SLionel Sambuc 626*ebfedea0SLionel SambucContentInfo ::= SEQUENCE { 627*ebfedea0SLionel Sambuc contentType ContentType, 628*ebfedea0SLionel Sambuc content 629*ebfedea0SLionel Sambuc [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL } 630*ebfedea0SLionel Sambuc 631*ebfedea0SLionel SambucHere the underlying type is ANY DEFINED BY contentType, the 632*ebfedea0SLionel Sambucclass is absent (i.e., context-specific), and the tag number 633*ebfedea0SLionel Sambucwithin the class is 0. 634*ebfedea0SLionel Sambuc 635*ebfedea0SLionel SambucExample 2: X.509's Certificate type has a version component 636*ebfedea0SLionel Sambucwith an explicit, context-specific tag, where the EXPLICIT 637*ebfedea0SLionel Sambuckeyword is omitted: 638*ebfedea0SLionel Sambuc 639*ebfedea0SLionel SambucCertificate ::= ... 640*ebfedea0SLionel Sambuc version [0] Version DEFAULT v1988, 641*ebfedea0SLionel Sambuc... 642*ebfedea0SLionel Sambuc 643*ebfedea0SLionel SambucThe tag is explicit because the default tagging method for 644*ebfedea0SLionel Sambucthe ASN.1 "module" in X.509 that defines the Certificate 645*ebfedea0SLionel Sambuctype is explicit tagging. 646*ebfedea0SLionel Sambuc 647*ebfedea0SLionel SambucBER encoding. Constructed. Contents octets are the BER 648*ebfedea0SLionel Sambucencoding of the underlying value. 649*ebfedea0SLionel Sambuc 650*ebfedea0SLionel SambucExample: the BER encoding of the content component of a 651*ebfedea0SLionel SambucContentInfo value is as follows: 652*ebfedea0SLionel Sambuc 653*ebfedea0SLionel Sambuc o identifier octets are a0 654*ebfedea0SLionel Sambuc 655*ebfedea0SLionel Sambuc o length octets represent the length of the BER 656*ebfedea0SLionel Sambuc encoding of the underlying ANY DEFINED BY 657*ebfedea0SLionel Sambuc contentType value 658*ebfedea0SLionel Sambuc 659*ebfedea0SLionel Sambuc o contents octets are the BER encoding of the 660*ebfedea0SLionel Sambuc underlying ANY DEFINED BY contentType value 661*ebfedea0SLionel Sambuc 662*ebfedea0SLionel SambucDER encoding. Constructed. Contents octets are the DER 663*ebfedea0SLionel Sambucencoding of the underlying value. 664*ebfedea0SLionel Sambuc 665*ebfedea0SLionel Sambuc 666*ebfedea0SLionel Sambuc5.3 ANY 667*ebfedea0SLionel Sambuc 668*ebfedea0SLionel SambucThe ANY type denotes an arbitrary value of an arbitrary 669*ebfedea0SLionel Sambuctype, where the arbitrary type is possibly defined in the 670*ebfedea0SLionel Sambucregistration of an object identifier or associated with an 671*ebfedea0SLionel Sambucinteger index. 672*ebfedea0SLionel Sambuc 673*ebfedea0SLionel SambucThe ANY type is used for content of a particular content 674*ebfedea0SLionel Sambuctype in PKCS #7's ContentInfo type, for parameters of a 675*ebfedea0SLionel Sambucparticular algorithm in X.509's AlgorithmIdentifier type, 676*ebfedea0SLionel Sambucand for attribute values in X.501's Attribute and 677*ebfedea0SLionel SambucAttributeValueAssertion types. The Attribute type is used by 678*ebfedea0SLionel SambucPKCS #6, #7, #8, #9 and #10, and the AttributeValueAssertion 679*ebfedea0SLionel Sambuctype is used in X.501 distinguished names. 680*ebfedea0SLionel Sambuc 681*ebfedea0SLionel SambucASN.1 notation: 682*ebfedea0SLionel Sambuc 683*ebfedea0SLionel SambucANY [DEFINED BY identifier] 684*ebfedea0SLionel Sambuc 685*ebfedea0SLionel Sambucwhere identifier is an optional identifier. 686*ebfedea0SLionel Sambuc 687*ebfedea0SLionel SambucIn the ANY form, the actual type is indeterminate. 688*ebfedea0SLionel Sambuc 689*ebfedea0SLionel SambucThe ANY DEFINED BY identifier form can only appear in a 690*ebfedea0SLionel Sambuccomponent of a SEQUENCE or SET type for which identifier 691*ebfedea0SLionel Sambucidentifies some other component, and that other component 692*ebfedea0SLionel Sambuchas type INTEGER or OBJECT IDENTIFIER (or a type derived 693*ebfedea0SLionel Sambucfrom either of those by tagging). In that form, the actual 694*ebfedea0SLionel Sambuctype is determined by the value of the other component, 695*ebfedea0SLionel Sambuceither in the registration of the object identifier value, 696*ebfedea0SLionel Sambucor in a table of integer values. 697*ebfedea0SLionel Sambuc 698*ebfedea0SLionel SambucExample: X.509's AlgorithmIdentifier type has a component of 699*ebfedea0SLionel Sambuctype ANY: 700*ebfedea0SLionel Sambuc 701*ebfedea0SLionel SambucAlgorithmIdentifier ::= SEQUENCE { 702*ebfedea0SLionel Sambuc algorithm OBJECT IDENTIFIER, 703*ebfedea0SLionel Sambuc parameters ANY DEFINED BY algorithm OPTIONAL } 704*ebfedea0SLionel Sambuc 705*ebfedea0SLionel SambucHere the actual type of the parameter component depends on 706*ebfedea0SLionel Sambucthe value of the algorithm component. The actual type would 707*ebfedea0SLionel Sambucbe defined in the registration of object identifier values 708*ebfedea0SLionel Sambucfor the algorithm component. 709*ebfedea0SLionel Sambuc 710*ebfedea0SLionel SambucBER encoding. Same as the BER encoding of the actual value. 711*ebfedea0SLionel Sambuc 712*ebfedea0SLionel SambucExample: The BER encoding of the value of the parameter 713*ebfedea0SLionel Sambuccomponent is the BER encoding of the value of the actual 714*ebfedea0SLionel Sambuctype as defined in the registration of object identifier 715*ebfedea0SLionel Sambucvalues for the algorithm component. 716*ebfedea0SLionel Sambuc 717*ebfedea0SLionel SambucDER encoding. Same as the DER encoding of the actual value. 718*ebfedea0SLionel Sambuc 719*ebfedea0SLionel Sambuc 720*ebfedea0SLionel Sambuc5.4 BIT STRING 721*ebfedea0SLionel Sambuc 722*ebfedea0SLionel SambucThe BIT STRING type denotes an arbitrary string of bits 723*ebfedea0SLionel Sambuc(ones and zeroes). A BIT STRING value can have any length, 724*ebfedea0SLionel Sambucincluding zero. This type is a string type. 725*ebfedea0SLionel Sambuc 726*ebfedea0SLionel SambucThe BIT STRING type is used for digital signatures on 727*ebfedea0SLionel Sambucextended certificates in PKCS #6's ExtendedCertificate type, 728*ebfedea0SLionel Sambucfor digital signatures on certificates in X.509's 729*ebfedea0SLionel SambucCertificate type, and for public keys in certificates in 730*ebfedea0SLionel SambucX.509's SubjectPublicKeyInfo type. 731*ebfedea0SLionel Sambuc 732*ebfedea0SLionel SambucASN.1 notation: 733*ebfedea0SLionel Sambuc 734*ebfedea0SLionel SambucBIT STRING 735*ebfedea0SLionel Sambuc 736*ebfedea0SLionel SambucExample: X.509's SubjectPublicKeyInfo type has a component 737*ebfedea0SLionel Sambucof type BIT STRING: 738*ebfedea0SLionel Sambuc 739*ebfedea0SLionel SambucSubjectPublicKeyInfo ::= SEQUENCE { 740*ebfedea0SLionel Sambuc algorithm AlgorithmIdentifier, 741*ebfedea0SLionel Sambuc publicKey BIT STRING } 742*ebfedea0SLionel Sambuc 743*ebfedea0SLionel SambucBER encoding. Primitive or constructed. In a primitive 744*ebfedea0SLionel Sambucencoding, the first contents octet gives the number of bits 745*ebfedea0SLionel Sambucby which the length of the bit string is less than the next 746*ebfedea0SLionel Sambucmultiple of eight (this is called the "number of unused 747*ebfedea0SLionel Sambucbits"). The second and following contents octets give the 748*ebfedea0SLionel Sambucvalue of the bit string, converted to an octet string. The 749*ebfedea0SLionel Sambucconversion process is as follows: 750*ebfedea0SLionel Sambuc 751*ebfedea0SLionel Sambuc 1. The bit string is padded after the last bit with 752*ebfedea0SLionel Sambuc zero to seven bits of any value to make the length 753*ebfedea0SLionel Sambuc of the bit string a multiple of eight. If the 754*ebfedea0SLionel Sambuc length of the bit string is a multiple of eight 755*ebfedea0SLionel Sambuc already, no padding is done. 756*ebfedea0SLionel Sambuc 757*ebfedea0SLionel Sambuc 2. The padded bit string is divided into octets. The 758*ebfedea0SLionel Sambuc first eight bits of the padded bit string become 759*ebfedea0SLionel Sambuc the first octet, bit 8 to bit 1, and so on through 760*ebfedea0SLionel Sambuc the last eight bits of the padded bit string. 761*ebfedea0SLionel Sambuc 762*ebfedea0SLionel SambucIn a constructed encoding, the contents octets give the 763*ebfedea0SLionel Sambucconcatenation of the BER encodings of consecutive substrings 764*ebfedea0SLionel Sambucof the bit string, where each substring except the last has 765*ebfedea0SLionel Sambuca length that is a multiple of eight bits. 766*ebfedea0SLionel Sambuc 767*ebfedea0SLionel SambucExample: The BER encoding of the BIT STRING value 768*ebfedea0SLionel Sambuc"011011100101110111" can be any of the following, among 769*ebfedea0SLionel Sambucothers, depending on the choice of padding bits, the form of 770*ebfedea0SLionel Sambuclength octets, and whether the encoding is primitive or 771*ebfedea0SLionel Sambucconstructed: 772*ebfedea0SLionel Sambuc 773*ebfedea0SLionel Sambuc03 04 06 6e 5d c0 DER encoding 774*ebfedea0SLionel Sambuc 775*ebfedea0SLionel Sambuc03 04 06 6e 5d e0 padded with "100000" 776*ebfedea0SLionel Sambuc 777*ebfedea0SLionel Sambuc03 81 04 06 6e 5d c0 long form of length octets 778*ebfedea0SLionel Sambuc 779*ebfedea0SLionel Sambuc23 09 constructed encoding: "0110111001011101" + "11" 780*ebfedea0SLionel Sambuc 03 03 00 6e 5d 781*ebfedea0SLionel Sambuc 03 02 06 c0 782*ebfedea0SLionel Sambuc 783*ebfedea0SLionel SambucDER encoding. Primitive. The contents octects are as for a 784*ebfedea0SLionel Sambucprimitive BER encoding, except that the bit string is padded 785*ebfedea0SLionel Sambucwith zero-valued bits. 786*ebfedea0SLionel Sambuc 787*ebfedea0SLionel SambucExample: The DER encoding of the BIT STRING value 788*ebfedea0SLionel Sambuc"011011100101110111" is 789*ebfedea0SLionel Sambuc 790*ebfedea0SLionel Sambuc03 04 06 6e 5d c0 791*ebfedea0SLionel Sambuc 792*ebfedea0SLionel Sambuc 793*ebfedea0SLionel Sambuc5.5 CHOICE 794*ebfedea0SLionel Sambuc 795*ebfedea0SLionel SambucThe CHOICE type denotes a union of one or more alternatives. 796*ebfedea0SLionel Sambuc 797*ebfedea0SLionel SambucThe CHOICE type is used to represent the union of an 798*ebfedea0SLionel Sambucextended certificate and an X.509 certificate in PKCS #7's 799*ebfedea0SLionel SambucExtendedCertificateOrCertificate type. 800*ebfedea0SLionel Sambuc 801*ebfedea0SLionel SambucASN.1 notation: 802*ebfedea0SLionel Sambuc 803*ebfedea0SLionel SambucCHOICE { 804*ebfedea0SLionel Sambuc [identifier1] Type1, 805*ebfedea0SLionel Sambuc ..., 806*ebfedea0SLionel Sambuc [identifiern] Typen } 807*ebfedea0SLionel Sambuc 808*ebfedea0SLionel Sambucwhere identifier1 , ..., identifiern are optional, distinct 809*ebfedea0SLionel Sambucidentifiers for the alternatives, and Type1, ..., Typen are 810*ebfedea0SLionel Sambucthe types of the alternatives. The identifiers are primarily 811*ebfedea0SLionel Sambucfor documentation; they do not affect values of the type or 812*ebfedea0SLionel Sambuctheir encodings in any way. 813*ebfedea0SLionel Sambuc 814*ebfedea0SLionel SambucThe types must have distinct tags. This requirement is 815*ebfedea0SLionel Sambuctypically satisfied with explicit or implicit tagging on 816*ebfedea0SLionel Sambucsome of the alternatives. 817*ebfedea0SLionel Sambuc 818*ebfedea0SLionel SambucExample: PKCS #7's ExtendedCertificateOrCertificate type is 819*ebfedea0SLionel Sambuca CHOICE type: 820*ebfedea0SLionel Sambuc 821*ebfedea0SLionel SambucExtendedCertificateOrCertificate ::= CHOICE { 822*ebfedea0SLionel Sambuc certificate Certificate, -- X.509 823*ebfedea0SLionel Sambuc extendedCertificate [0] IMPLICIT ExtendedCertificate 824*ebfedea0SLionel Sambuc} 825*ebfedea0SLionel Sambuc 826*ebfedea0SLionel SambucHere the identifiers for the alternatives are certificate 827*ebfedea0SLionel Sambucand extendedCertificate, and the types of the alternatives 828*ebfedea0SLionel Sambucare Certificate and [0] IMPLICIT ExtendedCertificate. 829*ebfedea0SLionel Sambuc 830*ebfedea0SLionel SambucBER encoding. Same as the BER encoding of the chosen 831*ebfedea0SLionel Sambucalternative. The fact that the alternatives have distinct 832*ebfedea0SLionel Sambuctags makes it possible to distinguish between their BER 833*ebfedea0SLionel Sambucencodings. 834*ebfedea0SLionel Sambuc 835*ebfedea0SLionel SambucExample: The identifier octets for the BER encoding are 30 836*ebfedea0SLionel Sambucif the chosen alternative is certificate, and a0 if the 837*ebfedea0SLionel Sambucchosen alternative is extendedCertificate. 838*ebfedea0SLionel Sambuc 839*ebfedea0SLionel SambucDER encoding. Same as the DER encoding of the chosen 840*ebfedea0SLionel Sambucalternative. 841*ebfedea0SLionel Sambuc 842*ebfedea0SLionel Sambuc 843*ebfedea0SLionel Sambuc5.6 IA5String 844*ebfedea0SLionel Sambuc 845*ebfedea0SLionel SambucThe IA5String type denotes an arbtrary string of IA5 846*ebfedea0SLionel Sambuccharacters. IA5 stands for International Alphabet 5, which 847*ebfedea0SLionel Sambucis the same as ASCII. The character set includes non- 848*ebfedea0SLionel Sambucprinting control characters. An IA5String value can have any 849*ebfedea0SLionel Sambuclength, including zero. This type is a string type. 850*ebfedea0SLionel Sambuc 851*ebfedea0SLionel SambucThe IA5String type is used in PKCS #9's electronic-mail 852*ebfedea0SLionel Sambucaddress, unstructured-name, and unstructured-address 853*ebfedea0SLionel Sambucattributes. 854*ebfedea0SLionel Sambuc 855*ebfedea0SLionel SambucASN.1 notation: 856*ebfedea0SLionel Sambuc 857*ebfedea0SLionel SambucIA5String 858*ebfedea0SLionel Sambuc 859*ebfedea0SLionel SambucBER encoding. Primitive or constructed. In a primitive 860*ebfedea0SLionel Sambucencoding, the contents octets give the characters in the IA5 861*ebfedea0SLionel Sambucstring, encoded in ASCII. In a constructed encoding, the 862*ebfedea0SLionel Sambuccontents octets give the concatenation of the BER encodings 863*ebfedea0SLionel Sambucof consecutive substrings of the IA5 string. 864*ebfedea0SLionel Sambuc 865*ebfedea0SLionel SambucExample: The BER encoding of the IA5String value 866*ebfedea0SLionel Sambuc"test1@rsa.com" can be any of the following, among others, 867*ebfedea0SLionel Sambucdepending on the form of length octets and whether the 868*ebfedea0SLionel Sambucencoding is primitive or constructed: 869*ebfedea0SLionel Sambuc 870*ebfedea0SLionel Sambuc16 0d 74 65 73 74 31 40 72 73 61 2e 63 6f 6d DER encoding 871*ebfedea0SLionel Sambuc 872*ebfedea0SLionel Sambuc16 81 0d long form of length octets 873*ebfedea0SLionel Sambuc 74 65 73 74 31 40 72 73 61 2e 63 6f 6d 874*ebfedea0SLionel Sambuc 875*ebfedea0SLionel Sambuc36 13 constructed encoding: "test1" + "@" + "rsa.com" 876*ebfedea0SLionel Sambuc 16 05 74 65 73 74 31 877*ebfedea0SLionel Sambuc 16 01 40 878*ebfedea0SLionel Sambuc 16 07 72 73 61 2e 63 6f 6d 879*ebfedea0SLionel Sambuc 880*ebfedea0SLionel SambucDER encoding. Primitive. Contents octets are as for a 881*ebfedea0SLionel Sambucprimitive BER encoding. 882*ebfedea0SLionel Sambuc 883*ebfedea0SLionel SambucExample: The DER encoding of the IA5String value 884*ebfedea0SLionel Sambuc"test1@rsa.com" is 885*ebfedea0SLionel Sambuc 886*ebfedea0SLionel Sambuc16 0d 74 65 73 74 31 40 72 73 61 2e 63 6f 6d 887*ebfedea0SLionel Sambuc 888*ebfedea0SLionel Sambuc 889*ebfedea0SLionel Sambuc5.7 INTEGER 890*ebfedea0SLionel Sambuc 891*ebfedea0SLionel SambucThe INTEGER type denotes an arbitrary integer. INTEGER 892*ebfedea0SLionel Sambucvalues can be positive, negative, or zero, and can have any 893*ebfedea0SLionel Sambucmagnitude. 894*ebfedea0SLionel Sambuc 895*ebfedea0SLionel SambucThe INTEGER type is used for version numbers throughout 896*ebfedea0SLionel SambucPKCS, cryptographic values such as modulus, exponent, and 897*ebfedea0SLionel Sambucprimes in PKCS #1's RSAPublicKey and RSAPrivateKey types and 898*ebfedea0SLionel SambucPKCS #3's DHParameter type, a message-digest iteration count 899*ebfedea0SLionel Sambucin PKCS #5's PBEParameter type, and version numbers and 900*ebfedea0SLionel Sambucserial numbers in X.509's Certificate type. 901*ebfedea0SLionel Sambuc 902*ebfedea0SLionel SambucASN.1 notation: 903*ebfedea0SLionel Sambuc 904*ebfedea0SLionel SambucINTEGER [{ identifier1(value1) ... identifiern(valuen) }] 905*ebfedea0SLionel Sambuc 906*ebfedea0SLionel Sambucwhere identifier1, ..., identifiern are optional distinct 907*ebfedea0SLionel Sambucidentifiers and value1, ..., valuen are optional integer 908*ebfedea0SLionel Sambucvalues. The identifiers, when present, are associated with 909*ebfedea0SLionel Sambucvalues of the type. 910*ebfedea0SLionel Sambuc 911*ebfedea0SLionel SambucExample: X.509's Version type is an INTEGER type with 912*ebfedea0SLionel Sambucidentified values: 913*ebfedea0SLionel Sambuc 914*ebfedea0SLionel SambucVersion ::= INTEGER { v1988(0) } 915*ebfedea0SLionel Sambuc 916*ebfedea0SLionel SambucThe identifier v1988 is associated with the value 0. X.509's 917*ebfedea0SLionel SambucCertificate type uses the identifier v1988 to give a default 918*ebfedea0SLionel Sambucvalue of 0 for the version component: 919*ebfedea0SLionel Sambuc 920*ebfedea0SLionel SambucCertificate ::= ... 921*ebfedea0SLionel Sambuc version Version DEFAULT v1988, 922*ebfedea0SLionel Sambuc... 923*ebfedea0SLionel Sambuc 924*ebfedea0SLionel SambucBER encoding. Primitive. Contents octets give the value of 925*ebfedea0SLionel Sambucthe integer, base 256, in two's complement form, most 926*ebfedea0SLionel Sambucsignificant digit first, with the minimum number of octets. 927*ebfedea0SLionel SambucThe value 0 is encoded as a single 00 octet. 928*ebfedea0SLionel Sambuc 929*ebfedea0SLionel SambucSome example BER encodings (which also happen to be DER 930*ebfedea0SLionel Sambucencodings) are given in Table 3. 931*ebfedea0SLionel Sambuc 932*ebfedea0SLionel Sambuc Integer BER encoding 933*ebfedea0SLionel Sambuc value 934*ebfedea0SLionel Sambuc 0 02 01 00 935*ebfedea0SLionel Sambuc 127 02 01 7F 936*ebfedea0SLionel Sambuc 128 02 02 00 80 937*ebfedea0SLionel Sambuc 256 02 02 01 00 938*ebfedea0SLionel Sambuc -128 02 01 80 939*ebfedea0SLionel Sambuc -129 02 02 FF 7F 940*ebfedea0SLionel Sambuc 941*ebfedea0SLionel Sambuc Table 3. Example BER encodings of INTEGER values. 942*ebfedea0SLionel Sambuc 943*ebfedea0SLionel SambucDER encoding. Primitive. Contents octets are as for a 944*ebfedea0SLionel Sambucprimitive BER encoding. 945*ebfedea0SLionel Sambuc 946*ebfedea0SLionel Sambuc 947*ebfedea0SLionel Sambuc5.8 NULL 948*ebfedea0SLionel Sambuc 949*ebfedea0SLionel SambucThe NULL type denotes a null value. 950*ebfedea0SLionel Sambuc 951*ebfedea0SLionel SambucThe NULL type is used for algorithm parameters in several 952*ebfedea0SLionel Sambucplaces in PKCS. 953*ebfedea0SLionel Sambuc 954*ebfedea0SLionel SambucASN.1 notation: 955*ebfedea0SLionel Sambuc 956*ebfedea0SLionel SambucNULL 957*ebfedea0SLionel Sambuc 958*ebfedea0SLionel SambucBER encoding. Primitive. Contents octets are empty. 959*ebfedea0SLionel Sambuc 960*ebfedea0SLionel SambucExample: The BER encoding of a NULL value can be either of 961*ebfedea0SLionel Sambucthe following, as well as others, depending on the form of 962*ebfedea0SLionel Sambucthe length octets: 963*ebfedea0SLionel Sambuc 964*ebfedea0SLionel Sambuc05 00 965*ebfedea0SLionel Sambuc 966*ebfedea0SLionel Sambuc05 81 00 967*ebfedea0SLionel Sambuc 968*ebfedea0SLionel SambucDER encoding. Primitive. Contents octets are empty; the DER 969*ebfedea0SLionel Sambucencoding of a NULL value is always 05 00. 970*ebfedea0SLionel Sambuc 971*ebfedea0SLionel Sambuc 972*ebfedea0SLionel Sambuc5.9 OBJECT IDENTIFIER 973*ebfedea0SLionel Sambuc 974*ebfedea0SLionel SambucThe OBJECT IDENTIFIER type denotes an object identifier, a 975*ebfedea0SLionel Sambucsequence of integer components that identifies an object 976*ebfedea0SLionel Sambucsuch as an algorithm, an attribute type, or perhaps a 977*ebfedea0SLionel Sambucregistration authority that defines other object 978*ebfedea0SLionel Sambucidentifiers. An OBJECT IDENTIFIER value can have any number 979*ebfedea0SLionel Sambucof components, and components can generally have any 980*ebfedea0SLionel Sambucnonnegative value. This type is a non-string type. 981*ebfedea0SLionel Sambuc 982*ebfedea0SLionel SambucOBJECT IDENTIFIER values are given meanings by registration 983*ebfedea0SLionel Sambucauthorities. Each registration authority is responsible for 984*ebfedea0SLionel Sambucall sequences of components beginning with a given sequence. 985*ebfedea0SLionel SambucA registration authority typically delegates responsibility 986*ebfedea0SLionel Sambucfor subsets of the sequences in its domain to other 987*ebfedea0SLionel Sambucregistration authorities, or for particular types of object. 988*ebfedea0SLionel SambucThere are always at least two components. 989*ebfedea0SLionel Sambuc 990*ebfedea0SLionel SambucThe OBJECT IDENTIFIER type is used to identify content in 991*ebfedea0SLionel SambucPKCS #7's ContentInfo type, to identify algorithms in 992*ebfedea0SLionel SambucX.509's AlgorithmIdentifier type, and to identify attributes 993*ebfedea0SLionel Sambucin X.501's Attribute and AttributeValueAssertion types. The 994*ebfedea0SLionel SambucAttribute type is used by PKCS #6, #7, #8, #9, and #10, and 995*ebfedea0SLionel Sambucthe AttributeValueAssertion type is used in X.501 996*ebfedea0SLionel Sambucdistinguished names. OBJECT IDENTIFIER values are defined 997*ebfedea0SLionel Sambucthroughout PKCS. 998*ebfedea0SLionel Sambuc 999*ebfedea0SLionel SambucASN.1 notation: 1000*ebfedea0SLionel Sambuc 1001*ebfedea0SLionel SambucOBJECT IDENTIFIER 1002*ebfedea0SLionel Sambuc 1003*ebfedea0SLionel SambucThe ASN.1 notation for values of the OBJECT IDENTIFIER type 1004*ebfedea0SLionel Sambucis 1005*ebfedea0SLionel Sambuc 1006*ebfedea0SLionel Sambuc{ [identifier] component1 ... componentn } 1007*ebfedea0SLionel Sambuc 1008*ebfedea0SLionel Sambuccomponenti = identifieri | identifieri (valuei) | valuei 1009*ebfedea0SLionel Sambuc 1010*ebfedea0SLionel Sambucwhere identifier, identifier1, ..., identifiern are 1011*ebfedea0SLionel Sambucidentifiers, and value1, ..., valuen are optional integer 1012*ebfedea0SLionel Sambucvalues. 1013*ebfedea0SLionel Sambuc 1014*ebfedea0SLionel SambucThe form without identifier is the "complete" value with all 1015*ebfedea0SLionel Sambucits components; the form with identifier abbreviates the 1016*ebfedea0SLionel Sambucbeginning components with another object identifier value. 1017*ebfedea0SLionel SambucThe identifiers identifier1, ..., identifiern are intended 1018*ebfedea0SLionel Sambucprimarily for documentation, but they must correspond to the 1019*ebfedea0SLionel Sambucinteger value when both are present. These identifiers can 1020*ebfedea0SLionel Sambucappear without integer values only if they are among a small 1021*ebfedea0SLionel Sambucset of identifiers defined in X.208. 1022*ebfedea0SLionel Sambuc 1023*ebfedea0SLionel SambucExample: The following values both refer to the object 1024*ebfedea0SLionel Sambucidentifier assigned to RSA Data Security, Inc.: 1025*ebfedea0SLionel Sambuc 1026*ebfedea0SLionel Sambuc{ iso(1) member-body(2) 840 113549 } 1027*ebfedea0SLionel Sambuc{ 1 2 840 113549 } 1028*ebfedea0SLionel Sambuc 1029*ebfedea0SLionel Sambuc(In this example, which gives ASN.1 value notation, the 1030*ebfedea0SLionel Sambucobject identifier values are decimal, not hexadecimal.) 1031*ebfedea0SLionel SambucTable 4 gives some other object identifier values and their 1032*ebfedea0SLionel Sambucmeanings. 1033*ebfedea0SLionel Sambuc 1034*ebfedea0SLionel Sambuc Object identifier value Meaning 1035*ebfedea0SLionel Sambuc { 1 2 } ISO member bodies 1036*ebfedea0SLionel Sambuc { 1 2 840 } US (ANSI) 1037*ebfedea0SLionel Sambuc { 1 2 840 113549 } RSA Data Security, Inc. 1038*ebfedea0SLionel Sambuc { 1 2 840 113549 1 } RSA Data Security, Inc. PKCS 1039*ebfedea0SLionel Sambuc { 2 5 } directory services (X.500) 1040*ebfedea0SLionel Sambuc { 2 5 8 } directory services-algorithms 1041*ebfedea0SLionel Sambuc 1042*ebfedea0SLionel Sambuc Table 4. Some object identifier values and their meanings. 1043*ebfedea0SLionel Sambuc 1044*ebfedea0SLionel SambucBER encoding. Primitive. Contents octets are as follows, 1045*ebfedea0SLionel Sambucwhere value1, ..., valuen denote the integer values of the 1046*ebfedea0SLionel Sambuccomponents in the complete object identifier: 1047*ebfedea0SLionel Sambuc 1048*ebfedea0SLionel Sambuc 1. The first octet has value 40 * value1 + value2. 1049*ebfedea0SLionel Sambuc (This is unambiguous, since value1 is limited to 1050*ebfedea0SLionel Sambuc values 0, 1, and 2; value2 is limited to the range 1051*ebfedea0SLionel Sambuc 0 to 39 when value1 is 0 or 1; and, according to 1052*ebfedea0SLionel Sambuc X.208, n is always at least 2.) 1053*ebfedea0SLionel Sambuc 1054*ebfedea0SLionel Sambuc 2. The following octets, if any, encode value3, ..., 1055*ebfedea0SLionel Sambuc valuen. Each value is encoded base 128, most 1056*ebfedea0SLionel Sambuc significant digit first, with as few digits as 1057*ebfedea0SLionel Sambuc possible, and the most significant bit of each 1058*ebfedea0SLionel Sambuc octet except the last in the value's encoding set 1059*ebfedea0SLionel Sambuc to "1." 1060*ebfedea0SLionel Sambuc 1061*ebfedea0SLionel SambucExample: The first octet of the BER encoding of RSA Data 1062*ebfedea0SLionel SambucSecurity, Inc.'s object identifier is 40 * 1 + 2 = 42 = 1063*ebfedea0SLionel Sambuc2a16. The encoding of 840 = 6 * 128 + 4816 is 86 48 and the 1064*ebfedea0SLionel Sambucencoding of 113549 = 6 * 1282 + 7716 * 128 + d16 is 86 f7 1065*ebfedea0SLionel Sambuc0d. This leads to the following BER encoding: 1066*ebfedea0SLionel Sambuc 1067*ebfedea0SLionel Sambuc06 06 2a 86 48 86 f7 0d 1068*ebfedea0SLionel Sambuc 1069*ebfedea0SLionel SambucDER encoding. Primitive. Contents octets are as for a 1070*ebfedea0SLionel Sambucprimitive BER encoding. 1071*ebfedea0SLionel Sambuc 1072*ebfedea0SLionel Sambuc 1073*ebfedea0SLionel Sambuc5.10 OCTET STRING 1074*ebfedea0SLionel Sambuc 1075*ebfedea0SLionel SambucThe OCTET STRING type denotes an arbitrary string of octets 1076*ebfedea0SLionel Sambuc(eight-bit values). An OCTET STRING value can have any 1077*ebfedea0SLionel Sambuclength, including zero. This type is a string type. 1078*ebfedea0SLionel Sambuc 1079*ebfedea0SLionel SambucThe OCTET STRING type is used for salt values in PKCS #5's 1080*ebfedea0SLionel SambucPBEParameter type, for message digests, encrypted message 1081*ebfedea0SLionel Sambucdigests, and encrypted content in PKCS #7, and for private 1082*ebfedea0SLionel Sambuckeys and encrypted private keys in PKCS #8. 1083*ebfedea0SLionel Sambuc 1084*ebfedea0SLionel SambucASN.1 notation: 1085*ebfedea0SLionel Sambuc 1086*ebfedea0SLionel SambucOCTET STRING [SIZE ({size | size1..size2})] 1087*ebfedea0SLionel Sambuc 1088*ebfedea0SLionel Sambucwhere size, size1, and size2 are optional size constraints. 1089*ebfedea0SLionel SambucIn the OCTET STRING SIZE (size) form, the octet string must 1090*ebfedea0SLionel Sambuchave size octets. In the OCTET STRING SIZE (size1..size2) 1091*ebfedea0SLionel Sambucform, the octet string must have between size1 and size2 1092*ebfedea0SLionel Sambucoctets. In the OCTET STRING form, the octet string can have 1093*ebfedea0SLionel Sambucany size. 1094*ebfedea0SLionel Sambuc 1095*ebfedea0SLionel SambucExample: PKCS #5's PBEParameter type has a component of type 1096*ebfedea0SLionel SambucOCTET STRING: 1097*ebfedea0SLionel Sambuc 1098*ebfedea0SLionel SambucPBEParameter ::= SEQUENCE { 1099*ebfedea0SLionel Sambuc salt OCTET STRING SIZE(8), 1100*ebfedea0SLionel Sambuc iterationCount INTEGER } 1101*ebfedea0SLionel Sambuc 1102*ebfedea0SLionel SambucHere the size of the salt component is always eight octets. 1103*ebfedea0SLionel Sambuc 1104*ebfedea0SLionel SambucBER encoding. Primitive or constructed. In a primitive 1105*ebfedea0SLionel Sambucencoding, the contents octets give the value of the octet 1106*ebfedea0SLionel Sambucstring, first octet to last octet. In a constructed 1107*ebfedea0SLionel Sambucencoding, the contents octets give the concatenation of the 1108*ebfedea0SLionel SambucBER encodings of substrings of the OCTET STRING value. 1109*ebfedea0SLionel Sambuc 1110*ebfedea0SLionel SambucExample: The BER encoding of the OCTET STRING value 01 23 45 1111*ebfedea0SLionel Sambuc67 89 ab cd ef can be any of the following, among others, 1112*ebfedea0SLionel Sambucdepending on the form of length octets and whether the 1113*ebfedea0SLionel Sambucencoding is primitive or constructed: 1114*ebfedea0SLionel Sambuc 1115*ebfedea0SLionel Sambuc04 08 01 23 45 67 89 ab cd ef DER encoding 1116*ebfedea0SLionel Sambuc 1117*ebfedea0SLionel Sambuc04 81 08 01 23 45 67 89 ab cd ef long form of length octets 1118*ebfedea0SLionel Sambuc 1119*ebfedea0SLionel Sambuc24 0c constructed encoding: 01 ... 67 + 89 ... ef 1120*ebfedea0SLionel Sambuc 04 04 01 23 45 67 1121*ebfedea0SLionel Sambuc 04 04 89 ab cd ef 1122*ebfedea0SLionel Sambuc 1123*ebfedea0SLionel SambucDER encoding. Primitive. Contents octets are as for a 1124*ebfedea0SLionel Sambucprimitive BER encoding. 1125*ebfedea0SLionel Sambuc 1126*ebfedea0SLionel SambucExample: The BER encoding of the OCTET STRING value 01 23 45 1127*ebfedea0SLionel Sambuc67 89 ab cd ef is 1128*ebfedea0SLionel Sambuc 1129*ebfedea0SLionel Sambuc04 08 01 23 45 67 89 ab cd ef 1130*ebfedea0SLionel Sambuc 1131*ebfedea0SLionel Sambuc 1132*ebfedea0SLionel Sambuc5.11 PrintableString 1133*ebfedea0SLionel Sambuc 1134*ebfedea0SLionel SambucThe PrintableString type denotes an arbitrary string of 1135*ebfedea0SLionel Sambucprintable characters from the following character set: 1136*ebfedea0SLionel Sambuc 1137*ebfedea0SLionel Sambuc A, B, ..., Z 1138*ebfedea0SLionel Sambuc a, b, ..., z 1139*ebfedea0SLionel Sambuc 0, 1, ..., 9 1140*ebfedea0SLionel Sambuc (space) ' ( ) + , - . / : = ? 1141*ebfedea0SLionel Sambuc 1142*ebfedea0SLionel SambucThis type is a string type. 1143*ebfedea0SLionel Sambuc 1144*ebfedea0SLionel SambucThe PrintableString type is used in PKCS #9's challenge- 1145*ebfedea0SLionel Sambucpassword and unstructuerd-address attributes, and in several 1146*ebfedea0SLionel SambucX.521 distinguished names attributes. 1147*ebfedea0SLionel Sambuc 1148*ebfedea0SLionel SambucASN.1 notation: 1149*ebfedea0SLionel Sambuc 1150*ebfedea0SLionel SambucPrintableString 1151*ebfedea0SLionel Sambuc 1152*ebfedea0SLionel SambucBER encoding. Primitive or constructed. In a primitive 1153*ebfedea0SLionel Sambucencoding, the contents octets give the characters in the 1154*ebfedea0SLionel Sambucprintable string, encoded in ASCII. In a constructed 1155*ebfedea0SLionel Sambucencoding, the contents octets give the concatenation of the 1156*ebfedea0SLionel SambucBER encodings of consecutive substrings of the string. 1157*ebfedea0SLionel Sambuc 1158*ebfedea0SLionel SambucExample: The BER encoding of the PrintableString value "Test 1159*ebfedea0SLionel SambucUser 1" can be any of the following, among others, depending 1160*ebfedea0SLionel Sambucon the form of length octets and whether the encoding is 1161*ebfedea0SLionel Sambucprimitive or constructed: 1162*ebfedea0SLionel Sambuc 1163*ebfedea0SLionel Sambuc13 0b 54 65 73 74 20 55 73 65 72 20 31 DER encoding 1164*ebfedea0SLionel Sambuc 1165*ebfedea0SLionel Sambuc13 81 0b long form of length octets 1166*ebfedea0SLionel Sambuc 54 65 73 74 20 55 73 65 72 20 31 1167*ebfedea0SLionel Sambuc 1168*ebfedea0SLionel Sambuc33 0f constructed encoding: "Test " + "User 1" 1169*ebfedea0SLionel Sambuc 13 05 54 65 73 74 20 1170*ebfedea0SLionel Sambuc 13 06 55 73 65 72 20 31 1171*ebfedea0SLionel Sambuc 1172*ebfedea0SLionel SambucDER encoding. Primitive. Contents octets are as for a 1173*ebfedea0SLionel Sambucprimitive BER encoding. 1174*ebfedea0SLionel Sambuc 1175*ebfedea0SLionel SambucExample: The DER encoding of the PrintableString value "Test 1176*ebfedea0SLionel SambucUser 1" is 1177*ebfedea0SLionel Sambuc 1178*ebfedea0SLionel Sambuc13 0b 54 65 73 74 20 55 73 65 72 20 31 1179*ebfedea0SLionel Sambuc 1180*ebfedea0SLionel Sambuc 1181*ebfedea0SLionel Sambuc5.12 SEQUENCE 1182*ebfedea0SLionel Sambuc 1183*ebfedea0SLionel SambucThe SEQUENCE type denotes an ordered collection of one or 1184*ebfedea0SLionel Sambucmore types. 1185*ebfedea0SLionel Sambuc 1186*ebfedea0SLionel SambucThe SEQUENCE type is used throughout PKCS and related 1187*ebfedea0SLionel Sambucstandards. 1188*ebfedea0SLionel Sambuc 1189*ebfedea0SLionel SambucASN.1 notation: 1190*ebfedea0SLionel Sambuc 1191*ebfedea0SLionel SambucSEQUENCE { 1192*ebfedea0SLionel Sambuc [identifier1] Type1 [{OPTIONAL | DEFAULT value1}], 1193*ebfedea0SLionel Sambuc ..., 1194*ebfedea0SLionel Sambuc [identifiern] Typen [{OPTIONAL | DEFAULT valuen}]} 1195*ebfedea0SLionel Sambuc 1196*ebfedea0SLionel Sambucwhere identifier1 , ..., identifiern are optional, distinct 1197*ebfedea0SLionel Sambucidentifiers for the components, Type1, ..., Typen are the 1198*ebfedea0SLionel Sambuctypes of the components, and value1, ..., valuen are optional 1199*ebfedea0SLionel Sambucdefault values for the components. The identifiers are 1200*ebfedea0SLionel Sambucprimarily for documentation; they do not affect values of 1201*ebfedea0SLionel Sambucthe type or their encodings in any way. 1202*ebfedea0SLionel Sambuc 1203*ebfedea0SLionel SambucThe OPTIONAL qualifier indicates that the value of a 1204*ebfedea0SLionel Sambuccomponent is optional and need not be present in the 1205*ebfedea0SLionel Sambucsequence. The DEFAULT qualifier also indicates that the 1206*ebfedea0SLionel Sambucvalue of a component is optional, and assigns a default 1207*ebfedea0SLionel Sambucvalue to the component when the component is absent. 1208*ebfedea0SLionel Sambuc 1209*ebfedea0SLionel SambucThe types of any consecutive series of components with the 1210*ebfedea0SLionel SambucOPTIONAL or DEFAULT qualifier, as well as of any component 1211*ebfedea0SLionel Sambucimmediately following that series, must have distinct tags. 1212*ebfedea0SLionel SambucThis requirement is typically satisfied with explicit or 1213*ebfedea0SLionel Sambucimplicit tagging on some of the components. 1214*ebfedea0SLionel Sambuc 1215*ebfedea0SLionel SambucExample: X.509's Validity type is a SEQUENCE type with two 1216*ebfedea0SLionel Sambuccomponents: 1217*ebfedea0SLionel Sambuc 1218*ebfedea0SLionel SambucValidity ::= SEQUENCE { 1219*ebfedea0SLionel Sambuc start UTCTime, 1220*ebfedea0SLionel Sambuc end UTCTime } 1221*ebfedea0SLionel Sambuc 1222*ebfedea0SLionel SambucHere the identifiers for the components are start and end, 1223*ebfedea0SLionel Sambucand the types of the components are both UTCTime. 1224*ebfedea0SLionel Sambuc 1225*ebfedea0SLionel SambucBER encoding. Constructed. Contents octets are the 1226*ebfedea0SLionel Sambucconcatenation of the BER encodings of the values of the 1227*ebfedea0SLionel Sambuccomponents of the sequence, in order of definition, with the 1228*ebfedea0SLionel Sambucfollowing rules for components with the OPTIONAL and DEFAULT 1229*ebfedea0SLionel Sambucqualifiers: 1230*ebfedea0SLionel Sambuc 1231*ebfedea0SLionel Sambuc o if the value of a component with the OPTIONAL or 1232*ebfedea0SLionel Sambuc DEFAULT qualifier is absent from the sequence, 1233*ebfedea0SLionel Sambuc then the encoding of that component is not 1234*ebfedea0SLionel Sambuc included in the contents octets 1235*ebfedea0SLionel Sambuc 1236*ebfedea0SLionel Sambuc o if the value of a component with the DEFAULT 1237*ebfedea0SLionel Sambuc qualifier is the default value, then the encoding 1238*ebfedea0SLionel Sambuc of that component may or may not be included in 1239*ebfedea0SLionel Sambuc the contents octets 1240*ebfedea0SLionel Sambuc 1241*ebfedea0SLionel SambucDER encoding. Constructed. Contents octets are the same as 1242*ebfedea0SLionel Sambucthe BER encoding, except that if the value of a component 1243*ebfedea0SLionel Sambucwith the DEFAULT qualifier is the default value, the 1244*ebfedea0SLionel Sambucencoding of that component is not included in the contents 1245*ebfedea0SLionel Sambucoctets. 1246*ebfedea0SLionel Sambuc 1247*ebfedea0SLionel Sambuc 1248*ebfedea0SLionel Sambuc5.13 SEQUENCE OF 1249*ebfedea0SLionel Sambuc 1250*ebfedea0SLionel SambucThe SEQUENCE OF type denotes an ordered collection of zero 1251*ebfedea0SLionel Sambucor more occurrences of a given type. 1252*ebfedea0SLionel Sambuc 1253*ebfedea0SLionel SambucThe SEQUENCE OF type is used in X.501 distinguished names. 1254*ebfedea0SLionel Sambuc 1255*ebfedea0SLionel SambucASN.1 notation: 1256*ebfedea0SLionel Sambuc 1257*ebfedea0SLionel SambucSEQUENCE OF Type 1258*ebfedea0SLionel Sambuc 1259*ebfedea0SLionel Sambucwhere Type is a type. 1260*ebfedea0SLionel Sambuc 1261*ebfedea0SLionel SambucExample: X.501's RDNSequence type consists of zero or more 1262*ebfedea0SLionel Sambucoccurences of the RelativeDistinguishedName type, most 1263*ebfedea0SLionel Sambucsignificant occurrence first: 1264*ebfedea0SLionel Sambuc 1265*ebfedea0SLionel SambucRDNSequence ::= SEQUENCE OF RelativeDistinguishedName 1266*ebfedea0SLionel Sambuc 1267*ebfedea0SLionel SambucBER encoding. Constructed. Contents octets are the 1268*ebfedea0SLionel Sambucconcatenation of the BER encodings of the values of the 1269*ebfedea0SLionel Sambucoccurrences in the collection, in order of occurence. 1270*ebfedea0SLionel Sambuc 1271*ebfedea0SLionel SambucDER encoding. Constructed. Contents octets are the 1272*ebfedea0SLionel Sambucconcatenation of the DER encodings of the values of the 1273*ebfedea0SLionel Sambucoccurrences in the collection, in order of occurence. 1274*ebfedea0SLionel Sambuc 1275*ebfedea0SLionel Sambuc 1276*ebfedea0SLionel Sambuc5.14 SET 1277*ebfedea0SLionel Sambuc 1278*ebfedea0SLionel SambucThe SET type denotes an unordered collection of one or more 1279*ebfedea0SLionel Sambuctypes. 1280*ebfedea0SLionel Sambuc 1281*ebfedea0SLionel SambucThe SET type is not used in PKCS. 1282*ebfedea0SLionel Sambuc 1283*ebfedea0SLionel SambucASN.1 notation: 1284*ebfedea0SLionel Sambuc 1285*ebfedea0SLionel SambucSET { 1286*ebfedea0SLionel Sambuc [identifier1] Type1 [{OPTIONAL | DEFAULT value1}], 1287*ebfedea0SLionel Sambuc ..., 1288*ebfedea0SLionel Sambuc [identifiern] Typen [{OPTIONAL | DEFAULT valuen}]} 1289*ebfedea0SLionel Sambuc 1290*ebfedea0SLionel Sambucwhere identifier1, ..., identifiern are optional, distinct 1291*ebfedea0SLionel Sambucidentifiers for the components, Type1, ..., Typen are the 1292*ebfedea0SLionel Sambuctypes of the components, and value1, ..., valuen are 1293*ebfedea0SLionel Sambucoptional default values for the components. The identifiers 1294*ebfedea0SLionel Sambucare primarily for documentation; they do not affect values 1295*ebfedea0SLionel Sambucof the type or their encodings in any way. 1296*ebfedea0SLionel Sambuc 1297*ebfedea0SLionel SambucThe OPTIONAL qualifier indicates that the value of a 1298*ebfedea0SLionel Sambuccomponent is optional and need not be present in the set. 1299*ebfedea0SLionel SambucThe DEFAULT qualifier also indicates that the value of a 1300*ebfedea0SLionel Sambuccomponent is optional, and assigns a default value to the 1301*ebfedea0SLionel Sambuccomponent when the component is absent. 1302*ebfedea0SLionel Sambuc 1303*ebfedea0SLionel SambucThe types must have distinct tags. This requirement is 1304*ebfedea0SLionel Sambuctypically satisfied with explicit or implicit tagging on 1305*ebfedea0SLionel Sambucsome of the components. 1306*ebfedea0SLionel Sambuc 1307*ebfedea0SLionel SambucBER encoding. Constructed. Contents octets are the 1308*ebfedea0SLionel Sambucconcatenation of the BER encodings of the values of the 1309*ebfedea0SLionel Sambuccomponents of the set, in any order, with the following 1310*ebfedea0SLionel Sambucrules for components with the OPTIONAL and DEFAULT 1311*ebfedea0SLionel Sambucqualifiers: 1312*ebfedea0SLionel Sambuc 1313*ebfedea0SLionel Sambuc o if the value of a component with the OPTIONAL or 1314*ebfedea0SLionel Sambuc DEFAULT qualifier is absent from the set, then the 1315*ebfedea0SLionel Sambuc encoding of that component is not included in the 1316*ebfedea0SLionel Sambuc contents octets 1317*ebfedea0SLionel Sambuc 1318*ebfedea0SLionel Sambuc o if the value of a component with the DEFAULT 1319*ebfedea0SLionel Sambuc qualifier is the default value, then the encoding 1320*ebfedea0SLionel Sambuc of that component may or may not be included in 1321*ebfedea0SLionel Sambuc the contents octets 1322*ebfedea0SLionel Sambuc 1323*ebfedea0SLionel SambucDER encoding. Constructed. Contents octets are the same as 1324*ebfedea0SLionel Sambucfor the BER encoding, except that: 1325*ebfedea0SLionel Sambuc 1326*ebfedea0SLionel Sambuc 1. If the value of a component with the DEFAULT 1327*ebfedea0SLionel Sambuc qualifier is the default value, the encoding of 1328*ebfedea0SLionel Sambuc that component is not included. 1329*ebfedea0SLionel Sambuc 1330*ebfedea0SLionel Sambuc 2. There is an order to the components, namely 1331*ebfedea0SLionel Sambuc ascending order by tag. 1332*ebfedea0SLionel Sambuc 1333*ebfedea0SLionel Sambuc 1334*ebfedea0SLionel Sambuc5.15 SET OF 1335*ebfedea0SLionel Sambuc 1336*ebfedea0SLionel SambucThe SET OF type denotes an unordered collection of zero or 1337*ebfedea0SLionel Sambucmore occurrences of a given type. 1338*ebfedea0SLionel Sambuc 1339*ebfedea0SLionel SambucThe SET OF type is used for sets of attributes in PKCS #6, 1340*ebfedea0SLionel Sambuc#7, #8, #9 and #10, for sets of message-digest algorithm 1341*ebfedea0SLionel Sambucidentifiers, signer information, and recipient information 1342*ebfedea0SLionel Sambucin PKCS #7, and in X.501 distinguished names. 1343*ebfedea0SLionel Sambuc 1344*ebfedea0SLionel SambucASN.1 notation: 1345*ebfedea0SLionel Sambuc 1346*ebfedea0SLionel SambucSET OF Type 1347*ebfedea0SLionel Sambuc 1348*ebfedea0SLionel Sambucwhere Type is a type. 1349*ebfedea0SLionel Sambuc 1350*ebfedea0SLionel SambucExample: X.501's RelativeDistinguishedName type consists of 1351*ebfedea0SLionel Sambuczero or more occurrences of the AttributeValueAssertion 1352*ebfedea0SLionel Sambuctype, where the order is unimportant: 1353*ebfedea0SLionel Sambuc 1354*ebfedea0SLionel SambucRelativeDistinguishedName ::= 1355*ebfedea0SLionel Sambuc SET OF AttributeValueAssertion 1356*ebfedea0SLionel Sambuc 1357*ebfedea0SLionel SambucBER encoding. Constructed. Contents octets are the 1358*ebfedea0SLionel Sambucconcatenation of the BER encodings of the values of the 1359*ebfedea0SLionel Sambucoccurrences in the collection, in any order. 1360*ebfedea0SLionel Sambuc 1361*ebfedea0SLionel SambucDER encoding. Constructed. Contents octets are the same as 1362*ebfedea0SLionel Sambucfor the BER encoding, except that there is an order, namely 1363*ebfedea0SLionel Sambucascending lexicographic order of BER encoding. Lexicographic 1364*ebfedea0SLionel Sambuccomparison of two different BER encodings is done as 1365*ebfedea0SLionel Sambucfollows: Logically pad the shorter BER encoding after the 1366*ebfedea0SLionel Sambuclast octet with dummy octets that are smaller in value than 1367*ebfedea0SLionel Sambucany normal octet. Scan the BER encodings from left to right 1368*ebfedea0SLionel Sambucuntil a difference is found. The smaller-valued BER encoding 1369*ebfedea0SLionel Sambucis the one with the smaller-valued octet at the point of 1370*ebfedea0SLionel Sambucdifference. 1371*ebfedea0SLionel Sambuc 1372*ebfedea0SLionel Sambuc 1373*ebfedea0SLionel Sambuc5.16 T61String 1374*ebfedea0SLionel Sambuc 1375*ebfedea0SLionel SambucThe T61String type denotes an arbtrary string of T.61 1376*ebfedea0SLionel Sambuccharacters. T.61 is an eight-bit extension to the ASCII 1377*ebfedea0SLionel Sambuccharacter set. Special "escape" sequences specify the 1378*ebfedea0SLionel Sambucinterpretation of subsequent character values as, for 1379*ebfedea0SLionel Sambucexample, Japanese; the initial interpretation is Latin. The 1380*ebfedea0SLionel Sambuccharacter set includes non-printing control characters. The 1381*ebfedea0SLionel SambucT61String type allows only the Latin and Japanese character 1382*ebfedea0SLionel Sambucinterepretations, and implementors' agreements for directory 1383*ebfedea0SLionel Sambucnames exclude control characters [NIST92]. A T61String value 1384*ebfedea0SLionel Sambuccan have any length, including zero. This type is a string 1385*ebfedea0SLionel Sambuctype. 1386*ebfedea0SLionel Sambuc 1387*ebfedea0SLionel SambucThe T61String type is used in PKCS #9's unstructured-address 1388*ebfedea0SLionel Sambucand challenge-password attributes, and in several X.521 1389*ebfedea0SLionel Sambucattributes. 1390*ebfedea0SLionel Sambuc 1391*ebfedea0SLionel SambucASN.1 notation: 1392*ebfedea0SLionel Sambuc 1393*ebfedea0SLionel SambucT61String 1394*ebfedea0SLionel Sambuc 1395*ebfedea0SLionel SambucBER encoding. Primitive or constructed. In a primitive 1396*ebfedea0SLionel Sambucencoding, the contents octets give the characters in the 1397*ebfedea0SLionel SambucT.61 string, encoded in ASCII. In a constructed encoding, 1398*ebfedea0SLionel Sambucthe contents octets give the concatenation of the BER 1399*ebfedea0SLionel Sambucencodings of consecutive substrings of the T.61 string. 1400*ebfedea0SLionel Sambuc 1401*ebfedea0SLionel SambucExample: The BER encoding of the T61String value "cl'es 1402*ebfedea0SLionel Sambucpubliques" (French for "public keys") can be any of the 1403*ebfedea0SLionel Sambucfollowing, among others, depending on the form of length 1404*ebfedea0SLionel Sambucoctets and whether the encoding is primitive or constructed: 1405*ebfedea0SLionel Sambuc 1406*ebfedea0SLionel Sambuc14 0f DER encoding 1407*ebfedea0SLionel Sambuc 63 6c c2 65 73 20 70 75 62 6c 69 71 75 65 73 1408*ebfedea0SLionel Sambuc 1409*ebfedea0SLionel Sambuc14 81 0f long form of length octets 1410*ebfedea0SLionel Sambuc 63 6c c2 65 73 20 70 75 62 6c 69 71 75 65 73 1411*ebfedea0SLionel Sambuc 1412*ebfedea0SLionel Sambuc34 15 constructed encoding: "cl'es" + " " + "publiques" 1413*ebfedea0SLionel Sambuc 14 05 63 6c c2 65 73 1414*ebfedea0SLionel Sambuc 14 01 20 1415*ebfedea0SLionel Sambuc 14 09 70 75 62 6c 69 71 75 65 73 1416*ebfedea0SLionel Sambuc 1417*ebfedea0SLionel SambucThe eight-bit character c2 is a T.61 prefix that adds an 1418*ebfedea0SLionel Sambucacute accent (') to the next character. 1419*ebfedea0SLionel Sambuc 1420*ebfedea0SLionel SambucDER encoding. Primitive. Contents octets are as for a 1421*ebfedea0SLionel Sambucprimitive BER encoding. 1422*ebfedea0SLionel Sambuc 1423*ebfedea0SLionel SambucExample: The DER encoding of the T61String value "cl'es 1424*ebfedea0SLionel Sambucpubliques" is 1425*ebfedea0SLionel Sambuc 1426*ebfedea0SLionel Sambuc14 0f 63 6c c2 65 73 20 70 75 62 6c 69 71 75 65 73 1427*ebfedea0SLionel Sambuc 1428*ebfedea0SLionel Sambuc 1429*ebfedea0SLionel Sambuc5.17 UTCTime 1430*ebfedea0SLionel Sambuc 1431*ebfedea0SLionel SambucThe UTCTime type denotes a "coordinated universal time" or 1432*ebfedea0SLionel SambucGreenwich Mean Time (GMT) value. A UTCTime value includes 1433*ebfedea0SLionel Sambucthe local time precise to either minutes or seconds, and an 1434*ebfedea0SLionel Sambucoffset from GMT in hours and minutes. It takes any of the 1435*ebfedea0SLionel Sambucfollowing forms: 1436*ebfedea0SLionel Sambuc 1437*ebfedea0SLionel SambucYYMMDDhhmmZ 1438*ebfedea0SLionel SambucYYMMDDhhmm+hh'mm' 1439*ebfedea0SLionel SambucYYMMDDhhmm-hh'mm' 1440*ebfedea0SLionel SambucYYMMDDhhmmssZ 1441*ebfedea0SLionel SambucYYMMDDhhmmss+hh'mm' 1442*ebfedea0SLionel SambucYYMMDDhhmmss-hh'mm' 1443*ebfedea0SLionel Sambuc 1444*ebfedea0SLionel Sambucwhere: 1445*ebfedea0SLionel Sambuc 1446*ebfedea0SLionel Sambuc YY is the least significant two digits of the year 1447*ebfedea0SLionel Sambuc 1448*ebfedea0SLionel Sambuc MM is the month (01 to 12) 1449*ebfedea0SLionel Sambuc 1450*ebfedea0SLionel Sambuc DD is the day (01 to 31) 1451*ebfedea0SLionel Sambuc 1452*ebfedea0SLionel Sambuc hh is the hour (00 to 23) 1453*ebfedea0SLionel Sambuc 1454*ebfedea0SLionel Sambuc mm are the minutes (00 to 59) 1455*ebfedea0SLionel Sambuc 1456*ebfedea0SLionel Sambuc ss are the seconds (00 to 59) 1457*ebfedea0SLionel Sambuc 1458*ebfedea0SLionel Sambuc Z indicates that local time is GMT, + indicates that 1459*ebfedea0SLionel Sambuc local time is later than GMT, and - indicates that 1460*ebfedea0SLionel Sambuc local time is earlier than GMT 1461*ebfedea0SLionel Sambuc 1462*ebfedea0SLionel Sambuc hh' is the absolute value of the offset from GMT in 1463*ebfedea0SLionel Sambuc hours 1464*ebfedea0SLionel Sambuc 1465*ebfedea0SLionel Sambuc mm' is the absolute value of the offset from GMT in 1466*ebfedea0SLionel Sambuc minutes 1467*ebfedea0SLionel Sambuc 1468*ebfedea0SLionel SambucThis type is a string type. 1469*ebfedea0SLionel Sambuc 1470*ebfedea0SLionel SambucThe UTCTime type is used for signing times in PKCS #9's 1471*ebfedea0SLionel Sambucsigning-time attribute and for certificate validity periods 1472*ebfedea0SLionel Sambucin X.509's Validity type. 1473*ebfedea0SLionel Sambuc 1474*ebfedea0SLionel SambucASN.1 notation: 1475*ebfedea0SLionel Sambuc 1476*ebfedea0SLionel SambucUTCTime 1477*ebfedea0SLionel Sambuc 1478*ebfedea0SLionel SambucBER encoding. Primitive or constructed. In a primitive 1479*ebfedea0SLionel Sambucencoding, the contents octets give the characters in the 1480*ebfedea0SLionel Sambucstring, encoded in ASCII. In a constructed encoding, the 1481*ebfedea0SLionel Sambuccontents octets give the concatenation of the BER encodings 1482*ebfedea0SLionel Sambucof consecutive substrings of the string. (The constructed 1483*ebfedea0SLionel Sambucencoding is not particularly interesting, since UTCTime 1484*ebfedea0SLionel Sambucvalues are so short, but the constructed encoding is 1485*ebfedea0SLionel Sambucpermitted.) 1486*ebfedea0SLionel Sambuc 1487*ebfedea0SLionel SambucExample: The time this sentence was originally written was 1488*ebfedea0SLionel Sambuc4:45:40 p.m. Pacific Daylight Time on May 6, 1991, which can 1489*ebfedea0SLionel Sambucbe represented with either of the following UTCTime values, 1490*ebfedea0SLionel Sambucamong others: 1491*ebfedea0SLionel Sambuc 1492*ebfedea0SLionel Sambuc"910506164540-0700" 1493*ebfedea0SLionel Sambuc 1494*ebfedea0SLionel Sambuc"910506234540Z" 1495*ebfedea0SLionel Sambuc 1496*ebfedea0SLionel SambucThese values have the following BER encodings, among others: 1497*ebfedea0SLionel Sambuc 1498*ebfedea0SLionel Sambuc17 0d 39 31 30 35 30 36 32 33 34 35 34 30 5a 1499*ebfedea0SLionel Sambuc 1500*ebfedea0SLionel Sambuc17 11 39 31 30 35 30 36 31 36 34 35 34 30 2D 30 37 30 1501*ebfedea0SLionel Sambuc 30 1502*ebfedea0SLionel Sambuc 1503*ebfedea0SLionel SambucDER encoding. Primitive. Contents octets are as for a 1504*ebfedea0SLionel Sambucprimitive BER encoding. 1505*ebfedea0SLionel Sambuc 1506*ebfedea0SLionel Sambuc 1507*ebfedea0SLionel Sambuc6. An example 1508*ebfedea0SLionel Sambuc 1509*ebfedea0SLionel SambucThis section gives an example of ASN.1 notation and DER 1510*ebfedea0SLionel Sambucencoding: the X.501 type Name. 1511*ebfedea0SLionel Sambuc 1512*ebfedea0SLionel Sambuc 1513*ebfedea0SLionel Sambuc6.1 Abstract notation 1514*ebfedea0SLionel Sambuc 1515*ebfedea0SLionel SambucThis section gives the ASN.1 notation for the X.501 type 1516*ebfedea0SLionel SambucName. 1517*ebfedea0SLionel Sambuc 1518*ebfedea0SLionel SambucName ::= CHOICE { 1519*ebfedea0SLionel Sambuc RDNSequence } 1520*ebfedea0SLionel Sambuc 1521*ebfedea0SLionel SambucRDNSequence ::= SEQUENCE OF RelativeDistinguishedName 1522*ebfedea0SLionel Sambuc 1523*ebfedea0SLionel SambucRelativeDistinguishedName ::= 1524*ebfedea0SLionel Sambuc SET OF AttributeValueAssertion 1525*ebfedea0SLionel Sambuc 1526*ebfedea0SLionel SambucAttributeValueAssertion ::= SEQUENCE { 1527*ebfedea0SLionel Sambuc AttributeType, 1528*ebfedea0SLionel Sambuc AttributeValue } 1529*ebfedea0SLionel Sambuc 1530*ebfedea0SLionel SambucAttributeType ::= OBJECT IDENTIFIER 1531*ebfedea0SLionel Sambuc 1532*ebfedea0SLionel SambucAttributeValue ::= ANY 1533*ebfedea0SLionel Sambuc 1534*ebfedea0SLionel SambucThe Name type identifies an object in an X.500 directory. 1535*ebfedea0SLionel SambucName is a CHOICE type consisting of one alternative: 1536*ebfedea0SLionel SambucRDNSequence. (Future revisions of X.500 may have other 1537*ebfedea0SLionel Sambucalternatives.) 1538*ebfedea0SLionel Sambuc 1539*ebfedea0SLionel SambucThe RDNSequence type gives a path through an X.500 directory 1540*ebfedea0SLionel Sambuctree starting at the root. RDNSequence is a SEQUENCE OF type 1541*ebfedea0SLionel Sambucconsisting of zero or more occurences of 1542*ebfedea0SLionel SambucRelativeDistinguishedName. 1543*ebfedea0SLionel Sambuc 1544*ebfedea0SLionel SambucThe RelativeDistinguishedName type gives a unique name to an 1545*ebfedea0SLionel Sambucobject relative to the object superior to it in the 1546*ebfedea0SLionel Sambucdirectory tree. RelativeDistinguishedName is a SET OF type 1547*ebfedea0SLionel Sambucconsisting of zero or more occurrences of 1548*ebfedea0SLionel SambucAttributeValueAssertion. 1549*ebfedea0SLionel Sambuc 1550*ebfedea0SLionel SambucThe AttributeValueAssertion type assigns a value to some 1551*ebfedea0SLionel Sambucattribute of a relative distinguished name, such as country 1552*ebfedea0SLionel Sambucname or common name. AttributeValueAssertion is a SEQUENCE 1553*ebfedea0SLionel Sambuctype consisting of two components, an AttributeType type and 1554*ebfedea0SLionel Sambucan AttributeValue type. 1555*ebfedea0SLionel Sambuc 1556*ebfedea0SLionel SambucThe AttributeType type identifies an attribute by object 1557*ebfedea0SLionel Sambucidentifier. The AttributeValue type gives an arbitrary 1558*ebfedea0SLionel Sambucattribute value. The actual type of the attribute value is 1559*ebfedea0SLionel Sambucdetermined by the attribute type. 1560*ebfedea0SLionel Sambuc 1561*ebfedea0SLionel Sambuc 1562*ebfedea0SLionel Sambuc6.2 DER encoding 1563*ebfedea0SLionel Sambuc 1564*ebfedea0SLionel SambucThis section gives an example of a DER encoding of a value 1565*ebfedea0SLionel Sambucof type Name, working from the bottom up. 1566*ebfedea0SLionel Sambuc 1567*ebfedea0SLionel SambucThe name is that of the Test User 1 from the PKCS examples 1568*ebfedea0SLionel Sambuc[Kal93]. The name is represented by the following path: 1569*ebfedea0SLionel Sambuc 1570*ebfedea0SLionel Sambuc (root) 1571*ebfedea0SLionel Sambuc | 1572*ebfedea0SLionel Sambuc countryName = "US" 1573*ebfedea0SLionel Sambuc | 1574*ebfedea0SLionel Sambuc organizationName = "Example Organization" 1575*ebfedea0SLionel Sambuc | 1576*ebfedea0SLionel Sambuc commonName = "Test User 1" 1577*ebfedea0SLionel Sambuc 1578*ebfedea0SLionel SambucEach level corresponds to one RelativeDistinguishedName 1579*ebfedea0SLionel Sambucvalue, each of which happens for this name to consist of one 1580*ebfedea0SLionel SambucAttributeValueAssertion value. The AttributeType value is 1581*ebfedea0SLionel Sambucbefore the equals sign, and the AttributeValue value (a 1582*ebfedea0SLionel Sambucprintable string for the given attribute types) is after the 1583*ebfedea0SLionel Sambucequals sign. 1584*ebfedea0SLionel Sambuc 1585*ebfedea0SLionel SambucThe countryName, organizationName, and commonUnitName are 1586*ebfedea0SLionel Sambucattribute types defined in X.520 as: 1587*ebfedea0SLionel Sambuc 1588*ebfedea0SLionel SambucattributeType OBJECT IDENTIFIER ::= 1589*ebfedea0SLionel Sambuc { joint-iso-ccitt(2) ds(5) 4 } 1590*ebfedea0SLionel Sambuc 1591*ebfedea0SLionel SambuccountryName OBJECT IDENTIFIER ::= { attributeType 6 } 1592*ebfedea0SLionel SambucorganizationName OBJECT IDENTIFIER ::= 1593*ebfedea0SLionel Sambuc { attributeType 10 } 1594*ebfedea0SLionel SambuccommonUnitName OBJECT IDENTIFIER ::= 1595*ebfedea0SLionel Sambuc { attributeType 3 } 1596*ebfedea0SLionel Sambuc 1597*ebfedea0SLionel Sambuc 1598*ebfedea0SLionel Sambuc6.2.1 AttributeType 1599*ebfedea0SLionel Sambuc 1600*ebfedea0SLionel SambucThe three AttributeType values are OCTET STRING values, so 1601*ebfedea0SLionel Sambuctheir DER encoding follows the primitive, definite-length 1602*ebfedea0SLionel Sambucmethod: 1603*ebfedea0SLionel Sambuc 1604*ebfedea0SLionel Sambuc06 03 55 04 06 countryName 1605*ebfedea0SLionel Sambuc 1606*ebfedea0SLionel Sambuc06 03 55 04 0a organizationName 1607*ebfedea0SLionel Sambuc 1608*ebfedea0SLionel Sambuc06 03 55 04 03 commonName 1609*ebfedea0SLionel Sambuc 1610*ebfedea0SLionel SambucThe identifier octets follow the low-tag form, since the tag 1611*ebfedea0SLionel Sambucis 6 for OBJECT IDENTIFIER. Bits 8 and 7 have value "0," 1612*ebfedea0SLionel Sambucindicating universal class, and bit 6 has value "0," 1613*ebfedea0SLionel Sambucindicating that the encoding is primitive. The length octets 1614*ebfedea0SLionel Sambucfollow the short form. The contents octets are the 1615*ebfedea0SLionel Sambucconcatenation of three octet strings derived from 1616*ebfedea0SLionel Sambucsubidentifiers (in decimal): 40 * 2 + 5 = 85 = 5516; 4; and 1617*ebfedea0SLionel Sambuc6, 10, or 3. 1618*ebfedea0SLionel Sambuc 1619*ebfedea0SLionel Sambuc 1620*ebfedea0SLionel Sambuc6.2.2 AttributeValue 1621*ebfedea0SLionel Sambuc 1622*ebfedea0SLionel SambucThe three AttributeValue values are PrintableString values, 1623*ebfedea0SLionel Sambucso their encodings follow the primitive, definite-length 1624*ebfedea0SLionel Sambucmethod: 1625*ebfedea0SLionel Sambuc 1626*ebfedea0SLionel Sambuc13 02 55 53 "US" 1627*ebfedea0SLionel Sambuc 1628*ebfedea0SLionel Sambuc13 14 "Example Organization" 1629*ebfedea0SLionel Sambuc 45 78 61 6d 70 6c 65 20 4f 72 67 61 6e 69 7a 61 1630*ebfedea0SLionel Sambuc 74 69 6f 6e 1631*ebfedea0SLionel Sambuc 1632*ebfedea0SLionel Sambuc13 0b "Test User 1" 1633*ebfedea0SLionel Sambuc 54 65 73 74 20 55 73 65 72 20 31 1634*ebfedea0SLionel Sambuc 1635*ebfedea0SLionel SambucThe identifier octets follow the low-tag-number form, since 1636*ebfedea0SLionel Sambucthe tag for PrintableString, 19 (decimal), is between 0 and 1637*ebfedea0SLionel Sambuc30. Bits 8 and 7 have value "0" since PrintableString is in 1638*ebfedea0SLionel Sambucthe universal class. Bit 6 has value "0" since the encoding 1639*ebfedea0SLionel Sambucis primitive. The length octets follow the short form, and 1640*ebfedea0SLionel Sambucthe contents octets are the ASCII representation of the 1641*ebfedea0SLionel Sambucattribute value. 1642*ebfedea0SLionel Sambuc 1643*ebfedea0SLionel Sambuc 1644*ebfedea0SLionel Sambuc6.2.3 AttributeValueAssertion 1645*ebfedea0SLionel Sambuc 1646*ebfedea0SLionel SambucThe three AttributeValueAssertion values are SEQUENCE 1647*ebfedea0SLionel Sambucvalues, so their DER encodings follow the constructed, 1648*ebfedea0SLionel Sambucdefinite-length method: 1649*ebfedea0SLionel Sambuc 1650*ebfedea0SLionel Sambuc30 09 countryName = "US" 1651*ebfedea0SLionel Sambuc 06 03 55 04 06 1652*ebfedea0SLionel Sambuc 13 02 55 53 1653*ebfedea0SLionel Sambuc 1654*ebfedea0SLionel Sambuc30 1b organizationName = "Example Organizaiton" 1655*ebfedea0SLionel Sambuc 06 03 55 04 0a 1656*ebfedea0SLionel Sambuc 13 14 ... 6f 6e 1657*ebfedea0SLionel Sambuc 1658*ebfedea0SLionel Sambuc30 12 commonName = "Test User 1" 1659*ebfedea0SLionel Sambuc 06 03 55 04 0b 1660*ebfedea0SLionel Sambuc 13 0b ... 20 31 1661*ebfedea0SLionel Sambuc 1662*ebfedea0SLionel SambucThe identifier octets follow the low-tag-number form, since 1663*ebfedea0SLionel Sambucthe tag for SEQUENCE, 16 (decimal), is between 0 and 30. 1664*ebfedea0SLionel SambucBits 8 and 7 have value "0" since SEQUENCE is in the 1665*ebfedea0SLionel Sambucuniversal class. Bit 6 has value "1" since the encoding is 1666*ebfedea0SLionel Sambucconstructed. The length octets follow the short form, and 1667*ebfedea0SLionel Sambucthe contents octets are the concatenation of the DER 1668*ebfedea0SLionel Sambucencodings of the attributeType and attributeValue 1669*ebfedea0SLionel Sambuccomponents. 1670*ebfedea0SLionel Sambuc 1671*ebfedea0SLionel Sambuc 1672*ebfedea0SLionel Sambuc6.2.4 RelativeDistinguishedName 1673*ebfedea0SLionel Sambuc 1674*ebfedea0SLionel SambucThe three RelativeDistinguishedName values are SET OF 1675*ebfedea0SLionel Sambucvalues, so their DER encodings follow the constructed, 1676*ebfedea0SLionel Sambucdefinite-length method: 1677*ebfedea0SLionel Sambuc 1678*ebfedea0SLionel Sambuc31 0b 1679*ebfedea0SLionel Sambuc 30 09 ... 55 53 1680*ebfedea0SLionel Sambuc 1681*ebfedea0SLionel Sambuc31 1d 1682*ebfedea0SLionel Sambuc 30 1b ... 6f 6e 1683*ebfedea0SLionel Sambuc 1684*ebfedea0SLionel Sambuc31 14 1685*ebfedea0SLionel Sambuc 30 12 ... 20 31 1686*ebfedea0SLionel Sambuc 1687*ebfedea0SLionel SambucThe identifier octets follow the low-tag-number form, since 1688*ebfedea0SLionel Sambucthe tag for SET OF, 17 (decimal), is between 0 and 30. Bits 1689*ebfedea0SLionel Sambuc8 and 7 have value "0" since SET OF is in the universal 1690*ebfedea0SLionel Sambucclass Bit 6 has value "1" since the encoding is constructed. 1691*ebfedea0SLionel SambucThe lengths octets follow the short form, and the contents 1692*ebfedea0SLionel Sambucoctets are the DER encodings of the respective 1693*ebfedea0SLionel SambucAttributeValueAssertion values, since there is only one 1694*ebfedea0SLionel Sambucvalue in each set. 1695*ebfedea0SLionel Sambuc 1696*ebfedea0SLionel Sambuc 1697*ebfedea0SLionel Sambuc6.2.5 RDNSequence 1698*ebfedea0SLionel Sambuc 1699*ebfedea0SLionel SambucThe RDNSequence value is a SEQUENCE OF value, so its DER 1700*ebfedea0SLionel Sambucencoding follows the constructed, definite-length method: 1701*ebfedea0SLionel Sambuc 1702*ebfedea0SLionel Sambuc30 42 1703*ebfedea0SLionel Sambuc 31 0b ... 55 53 1704*ebfedea0SLionel Sambuc 31 1d ... 6f 6e 1705*ebfedea0SLionel Sambuc 31 14 ... 20 31 1706*ebfedea0SLionel Sambuc 1707*ebfedea0SLionel SambucThe identifier octets follow the low-tag-number form, since 1708*ebfedea0SLionel Sambucthe tag for SEQUENCE OF, 16 (decimal), is between 0 and 30. 1709*ebfedea0SLionel SambucBits 8 and 7 have value "0" since SEQUENCE OF is in the 1710*ebfedea0SLionel Sambucuniversal class. Bit 6 has value "1" since the encoding is 1711*ebfedea0SLionel Sambucconstructed. The lengths octets follow the short form, and 1712*ebfedea0SLionel Sambucthe contents octets are the concatenation of the DER 1713*ebfedea0SLionel Sambucencodings of the three RelativeDistinguishedName values, in 1714*ebfedea0SLionel Sambucorder of occurrence. 1715*ebfedea0SLionel Sambuc 1716*ebfedea0SLionel Sambuc 1717*ebfedea0SLionel Sambuc6.2.6 Name 1718*ebfedea0SLionel Sambuc 1719*ebfedea0SLionel SambucThe Name value is a CHOICE value, so its DER encoding is the 1720*ebfedea0SLionel Sambucsame as that of the RDNSequence value: 1721*ebfedea0SLionel Sambuc 1722*ebfedea0SLionel Sambuc30 42 1723*ebfedea0SLionel Sambuc 31 0b 1724*ebfedea0SLionel Sambuc 30 09 1725*ebfedea0SLionel Sambuc 06 03 55 04 06 attributeType = countryName 1726*ebfedea0SLionel Sambuc 13 02 55 53 attributeValue = "US" 1727*ebfedea0SLionel Sambuc 31 1d 1728*ebfedea0SLionel Sambuc 30 1b 1729*ebfedea0SLionel Sambuc 06 03 55 04 0a attributeType = organizationName 1730*ebfedea0SLionel Sambuc 13 14 attributeValue = "Example Organization" 1731*ebfedea0SLionel Sambuc 45 78 61 6d 70 6c 65 20 4f 72 67 61 6e 69 7a 61 1732*ebfedea0SLionel Sambuc 74 69 6f 6e 1733*ebfedea0SLionel Sambuc 1734*ebfedea0SLionel Sambuc 31 14 1735*ebfedea0SLionel Sambuc 30 12 1736*ebfedea0SLionel Sambuc 06 03 55 04 03 attributeType = commonName 1737*ebfedea0SLionel Sambuc 13 0b attributeValue = "Test User 1" 1738*ebfedea0SLionel Sambuc 54 65 73 74 20 55 73 65 72 20 31 1739*ebfedea0SLionel Sambuc 1740*ebfedea0SLionel Sambuc 1741*ebfedea0SLionel SambucReferences 1742*ebfedea0SLionel Sambuc 1743*ebfedea0SLionel SambucPKCS #1 RSA Laboratories. PKCS #1: RSA Encryption 1744*ebfedea0SLionel Sambuc Standard. Version 1.5, November 1993. 1745*ebfedea0SLionel Sambuc 1746*ebfedea0SLionel SambucPKCS #3 RSA Laboratories. PKCS #3: Diffie-Hellman Key- 1747*ebfedea0SLionel Sambuc Agreement Standard. Version 1.4, November 1993. 1748*ebfedea0SLionel Sambuc 1749*ebfedea0SLionel SambucPKCS #5 RSA Laboratories. PKCS #5: Password-Based 1750*ebfedea0SLionel Sambuc Encryption Standard. Version 1.5, November 1993. 1751*ebfedea0SLionel Sambuc 1752*ebfedea0SLionel SambucPKCS #6 RSA Laboratories. PKCS #6: Extended-Certificate 1753*ebfedea0SLionel Sambuc Syntax Standard. Version 1.5, November 1993. 1754*ebfedea0SLionel Sambuc 1755*ebfedea0SLionel SambucPKCS #7 RSA Laboratories. PKCS #7: Cryptographic Message 1756*ebfedea0SLionel Sambuc Syntax Standard. Version 1.5, November 1993. 1757*ebfedea0SLionel Sambuc 1758*ebfedea0SLionel SambucPKCS #8 RSA Laboratories. PKCS #8: Private-Key Information 1759*ebfedea0SLionel Sambuc Syntax Standard. Version 1.2, November 1993. 1760*ebfedea0SLionel Sambuc 1761*ebfedea0SLionel SambucPKCS #9 RSA Laboratories. PKCS #9: Selected Attribute 1762*ebfedea0SLionel Sambuc Types. Version 1.1, November 1993. 1763*ebfedea0SLionel Sambuc 1764*ebfedea0SLionel SambucPKCS #10 RSA Laboratories. PKCS #10: Certification Request 1765*ebfedea0SLionel Sambuc Syntax Standard. Version 1.0, November 1993. 1766*ebfedea0SLionel Sambuc 1767*ebfedea0SLionel SambucX.200 CCITT. Recommendation X.200: Reference Model of 1768*ebfedea0SLionel Sambuc Open Systems Interconnection for CCITT 1769*ebfedea0SLionel Sambuc Applications. 1984. 1770*ebfedea0SLionel Sambuc 1771*ebfedea0SLionel SambucX.208 CCITT. Recommendation X.208: Specification of 1772*ebfedea0SLionel Sambuc Abstract Syntax Notation One (ASN.1). 1988. 1773*ebfedea0SLionel Sambuc 1774*ebfedea0SLionel SambucX.209 CCITT. Recommendation X.209: Specification of 1775*ebfedea0SLionel Sambuc Basic Encoding Rules for Abstract Syntax Notation 1776*ebfedea0SLionel Sambuc One (ASN.1). 1988. 1777*ebfedea0SLionel Sambuc 1778*ebfedea0SLionel SambucX.500 CCITT. Recommendation X.500: The 1779*ebfedea0SLionel Sambuc Directory--Overview of Concepts, Models and 1780*ebfedea0SLionel Sambuc Services. 1988. 1781*ebfedea0SLionel Sambuc 1782*ebfedea0SLionel SambucX.501 CCITT. Recommendation X.501: The Directory-- 1783*ebfedea0SLionel Sambuc Models. 1988. 1784*ebfedea0SLionel Sambuc 1785*ebfedea0SLionel SambucX.509 CCITT. Recommendation X.509: The Directory-- 1786*ebfedea0SLionel Sambuc Authentication Framework. 1988. 1787*ebfedea0SLionel Sambuc 1788*ebfedea0SLionel SambucX.520 CCITT. Recommendation X.520: The Directory-- 1789*ebfedea0SLionel Sambuc Selected Attribute Types. 1988. 1790*ebfedea0SLionel Sambuc 1791*ebfedea0SLionel Sambuc[Kal93] Burton S. Kaliski Jr. Some Examples of the PKCS 1792*ebfedea0SLionel Sambuc Standards. RSA Laboratories, November 1993. 1793*ebfedea0SLionel Sambuc 1794*ebfedea0SLionel Sambuc[NIST92] NIST. Special Publication 500-202: Stable 1795*ebfedea0SLionel Sambuc Implementation Agreements for Open Systems 1796*ebfedea0SLionel Sambuc Interconnection Protocols. Part 11 (Directory 1797*ebfedea0SLionel Sambuc Services Protocols). December 1992. 1798*ebfedea0SLionel Sambuc 1799*ebfedea0SLionel Sambuc 1800*ebfedea0SLionel SambucRevision history 1801*ebfedea0SLionel Sambuc 1802*ebfedea0SLionel Sambuc 1803*ebfedea0SLionel SambucJune 3, 1991 version 1804*ebfedea0SLionel Sambuc 1805*ebfedea0SLionel SambucThe June 3, 1991 version is part of the initial public 1806*ebfedea0SLionel Sambucrelease of PKCS. It was published as NIST/OSI Implementors' 1807*ebfedea0SLionel SambucWorkshop document SEC-SIG-91-17. 1808*ebfedea0SLionel Sambuc 1809*ebfedea0SLionel Sambuc 1810*ebfedea0SLionel SambucNovember 1, 1993 version 1811*ebfedea0SLionel Sambuc 1812*ebfedea0SLionel SambucThe November 1, 1993 version incorporates several editorial 1813*ebfedea0SLionel Sambucchanges, including the addition of a revision history. It is 1814*ebfedea0SLionel Sambucupdated to be consistent with the following versions of the 1815*ebfedea0SLionel SambucPKCS documents: 1816*ebfedea0SLionel Sambuc 1817*ebfedea0SLionel Sambuc PKCS #1: RSA Encryption Standard. Version 1.5, November 1818*ebfedea0SLionel Sambuc 1993. 1819*ebfedea0SLionel Sambuc 1820*ebfedea0SLionel Sambuc PKCS #3: Diffie-Hellman Key-Agreement Standard. Version 1821*ebfedea0SLionel Sambuc 1.4, November 1993. 1822*ebfedea0SLionel Sambuc 1823*ebfedea0SLionel Sambuc PKCS #5: Password-Based Encryption Standard. Version 1824*ebfedea0SLionel Sambuc 1.5, November 1993. 1825*ebfedea0SLionel Sambuc 1826*ebfedea0SLionel Sambuc PKCS #6: Extended-Certificate Syntax Standard. Version 1827*ebfedea0SLionel Sambuc 1.5, November 1993. 1828*ebfedea0SLionel Sambuc 1829*ebfedea0SLionel Sambuc PKCS #7: Cryptographic Message Syntax Standard. Version 1830*ebfedea0SLionel Sambuc 1.5, November 1993. 1831*ebfedea0SLionel Sambuc 1832*ebfedea0SLionel Sambuc PKCS #8: Private-Key Information Syntax Standard. 1833*ebfedea0SLionel Sambuc Version 1.2, November 1993. 1834*ebfedea0SLionel Sambuc 1835*ebfedea0SLionel Sambuc PKCS #9: Selected Attribute Types. Version 1.1, 1836*ebfedea0SLionel Sambuc November 1993. 1837*ebfedea0SLionel Sambuc 1838*ebfedea0SLionel Sambuc PKCS #10: Certification Request Syntax Standard. 1839*ebfedea0SLionel Sambuc Version 1.0, November 1993. 1840*ebfedea0SLionel Sambuc 1841*ebfedea0SLionel SambucThe following substantive changes were made: 1842*ebfedea0SLionel Sambuc 1843*ebfedea0SLionel Sambuc Section 5: Description of T61String type is added. 1844*ebfedea0SLionel Sambuc 1845*ebfedea0SLionel Sambuc Section 6: Names are changed, consistent with other 1846*ebfedea0SLionel Sambuc PKCS examples. 1847*ebfedea0SLionel Sambuc 1848*ebfedea0SLionel Sambuc 1849*ebfedea0SLionel SambucAuthor's address 1850*ebfedea0SLionel Sambuc 1851*ebfedea0SLionel SambucBurton S. Kaliski Jr., Ph.D. 1852*ebfedea0SLionel SambucChief Scientist 1853*ebfedea0SLionel SambucRSA Laboratories (415) 595-7703 1854*ebfedea0SLionel Sambuc100 Marine Parkway (415) 595-4126 (fax) 1855*ebfedea0SLionel SambucRedwood City, CA 94065 USA burt@rsa.com 1856