INTERNET-DRAFT S. Legg draft-legg-ldap-gser-abnf-00.txt Adacel Technologies Intended Category: Informational November 12, 2001 Common Elements of GSER Encodings Copyright (C) The Internet Society (2001). All Rights Reserved. Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress". The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. Distribution of this document is unlimited. Comments should be sent to the LDAPEXT working group mailing list or to the author. This Internet-Draft expires on 12 May 2002. 1. Abstract The Generic String Encoding Rules (GSER) defined in Section 8 of [CMR] define a human readable text encoding for an ASN.1 value of any ASN.1 type. Specifications making use of GSER may wish to provide an equivalent ABNF description of the GSER encoding for a particular ASN.1 type as a convenience for implementors. This document supports such specifications by providing equivalent ABNF for the GSER encoding of ASN.1 types commonly occuring in LDAP syntaxes. Legg Expires 12 May 2002 [Page 1] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. 2. Table of Contents 1. Abstract 1 2. Table of Contents 2 3. Introduction 2 4. Separators 2 5. ASN.1 Built-in Types 3 6. ASN.1 Restricted String Types 6 7. Directory ASN.1 Types 7 8. Security Considerations 8 9. References 8 10. Intellectual Property Notice 9 11. Copyright Notice 9 12. Author's Address 10 3. Introduction The Generic String Encoding Rules (GSER) defined in Section 8 of [CMR] define a human readable text encoding, based on ASN.1 [X680] value notation, for an ASN.1 value of any ASN.1 type. Specifications making use of GSER may wish to provide a non-normative equivalent ABNF [RFC2234] description of the GSER encoding for a particular ASN.1 type as a convenience for implementors unfamiliar with ASN.1. This document supports such specifications by providing equivalent ABNF for the GSER encoding of ASN.1 types commonly occuring in LDAP [RFC2251] or X.500 [X500] attribute and assertion syntaxes, as well as equivalent ABNF for the GSER encoding of the ASN.1 built-in types. The ABNF given in this document does not replace or alter GSER in any way. If there is a discrepancy between the ABNF specified here and the encoding defined by GSER in [CMR] then [CMR] is to be taken as definitive. 4. Separators Certain separators are commonly used in constructing equivalent ABNF for SET and SEQUENCE types. sp = *%x20 ; zero, one or more space characters msp = 1*%x20 ; one or more space characters Legg Expires 12 May 2002 [Page 2] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 sep = [ "," ] The rule is used in the ABNF description of the encoding of ASN.1 SET or SEQUENCE types where all the components are OPTIONAL or DEFAULT. It encodes to an empty string if and only if the immediately preceding character in the encoding is "{", i.e. it is only empty for the first optional component actually present in the SET or SEQUENCE value being encoded. 5. ASN.1 Built-in Types This section describes the GSER encoding of values of the ASN.1 built-in types, except for the restricted character string types. The rule describes the GSER encoding of values of the BIT STRING type without a named bit list. BIT-STRING = bstring / hstring If the number of bits in a BIT STRING value is a multiple of four the form of MAY be used. The form of is used otherwise. The rule encodes each bit as the character "0" or "1" in order from the first bit to the last bit. The rule encodes each group of four bits as a hexadecimal number where the first bit is the most significant. An odd number of hexadecimal digits is permitted. hstring = squote *hexadecimal-digit squote %x48 ; '...'H hexadecimal-digit = %x30-39 / ; "0" to "9" %x41-46 ; "A" to "F" bstring = squote *binary-digit squote %x42 ; '...'B binary-digit = "0" / "1" squote = %x27 ; ' (single quote) The rule describes the GSER encoding of values of the BOOLEAN type. BOOLEAN = %x54.52.55.45 / ; "TRUE" %x46.41.4C.53.45 ; "FALSE" The rule describes the GSER encoding of values of the associated type for the unrestricted CHARACTER STRING type. CHARACTER-STRING = "{" sp id-identification msp Identification "," sp id-data-value msp OCTET-STRING Legg Expires 12 May 2002 [Page 3] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 sp "}" id-identification = %x69.64.65.6E.74.69.66.69.63.61.74.69.6F.6E ; "identification" id-data-value = %x64.61.74.61.2D.76.61.6C.75.65 ; "data-value" Identification = ( id-syntaxes ":" Syntaxes ) / ( id-syntax ":" OBJECT-IDENTIFIER ) / ( id-presentation-context-id ":" INTEGER ) / ( id-context-negotiation ":" ContextNegotiation ) / ( id-transfer-syntax ":" OBJECT-IDENTIFIER ) / ( id-fixed ":" NULL ) id-syntaxes = %x73.79.6E.74.61.78.65.73 ; "syntaxes" id-syntax = %x73.79.6E.74.61.78 ; "syntax" id-presentation-context-id = %x70.72.65.73.65.6E.74.61.74.69.6F.6E.2D %x63.6F.6E.74.65.78.74.2D.69.64 ; "presentation-context-id" id-context-negotiation = %x63.6F.6E.74.65.78.74.2D.6E.65.67.6F.74 %x69.61.74.69.6F.6E ; "context-negotiation" id-transfer-syntax = %x74.72.61.6E.73.66.65.72.2D.73.79.6E.74 %x61.78 ; "transfer-syntax" id-fixed = %x66.69.78.65.64 ; "fixed" Syntaxes = "{" sp id-abstract msp OBJECT-IDENTIFIER "," sp id-transfer msp OBJECT-IDENTIFIER sp "}" id-abstract = %x61.62.73.74.72.61.63.74 ; "abstract" id-transfer = %x74.72.61.6E.73.66.65.72 ; "transfer" ContextNegotiation = "{" sp id-presentation-context-id msp INTEGER "," sp id-transfer-syntax msp OBJECT-IDENTIFIER sp "}" The rule describes the GSER encoding of values of the INTEGER type without a named number list. The rule describes the GSER encoding of values of the constrained type INTEGER (0..MAX). The rule describes the GSER encoding of values of the constrained type INTEGER (1..MAX). INTEGER = "0" / positive-number / ("-" positive-number) INTEGER-0-MAX = "0" / positive-number INTEGER-1-MAX = positive-number positive-number = non-zero-digit *decimal-digit decimal-digit = %x30-39 ; "0" to "9" non-zero-digit = %x31-39 ; "1" to "9" Legg Expires 12 May 2002 [Page 4] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 The rule describes the GSER encoding of values of the associated type for the EMBEDDED PDV type. EMBEDDED-PDV = "{" sp id-identification msp Identification [ "," sp id-data-value-descriptor msp ObjectDescriptor ] "," sp id-data-value msp OCTET-STRING sp "}" id-data-value-descriptor = %x64.61.74.61.2D.76.61.6C.75.65.2D.64.65 %x73.63.72.69.70.74.6F.72 ; "data-value-descriptor" The rule describes the GSER encoding of values of the associated type for the EXTERNAL type. EXTERNAL = "{" sp id-identification msp E-Identification [ "," sp id-data-value-descriptor msp ObjectDescriptor ] "," sp id-data-value msp OCTET-STRING sp "}" E-Identification = ( id-syntax ":" OBJECT-IDENTIFIER ) / ( id-presentation-context-id ":" INTEGER ) / ( id-context-negotiation ":" ContextNegotiation ) The rule describes the GSER encoding of values of the NULL type. NULL = %x4E.55.4C.4C ; "NULL" The rule describes the GSER encoding of values of the OBJECT IDENTIFIER type. OBJECT-IDENTIFIER = oid An OBJECT IDENTIFIER value is encoded using the string representation described by the rule in [RFC2252]. The rule allows either a dotted decimal representation of the OBJECT IDENTIFIER value or an object descriptor name, i.e. . An object descriptor name is potentially ambiguous and should be used with care. The rule describes the GSER encoding of values of the OCTET STRING type. OCTET-STRING = hstring The octets are encoded in order from the first octet to the last Legg Expires 12 May 2002 [Page 5] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 octet. Each octet is encoded as a pair of hexadecimal digits where the first digit corresponds to the four most significant bits of the octet. If the hexadecimal string does not have an even number of digits the four least significant bits in the last octet are assumed to be zero. The rule describes the GSER encoding of values of the REAL type. REAL = "0" / non-zero-real non-zero-real = "{" sp id-mantissa msp INTEGER "," sp id-base msp ( "2" / "10" ) "," sp id-exponent msp INTEGER sp "}" id-mantissa = %x6D.61.6E.74.69.73.73.61 ; "mantissa" id-base = %x62.61.73.65 ; "base" id-exponent = %x65.78.70.6F.6E.65.6E.74 ; "exponent" 6. ASN.1 Restricted String Types This section describes the GSER encoding of values of the ASN.1 restricted character string types. The characters of a value of a restricted character string type are encoded as a UTF8 character string between double quotes. Any double quote characters in the character string are escaped by being repeated. StringValue = dquote *SafeUTF8Character dquote dquote = %x22 ; " (double quote) SafeUTF8Character = %x00-21 / %x23-7F / ; ASCII minus dquote dquote dquote / ; escaped double quote %xC0-DF %x80-BF / ; 2 byte UTF8 character %xE0-EF 2(%x80-BF) / ; 3 byte UTF8 character %xF0-F7 3(%x80-BF) / ; 4 byte UTF8 character %xF8-FB 4(%x80-BF) / ; 5 byte UTF8 character %xFC-FD 5(%x80-BF) ; 6 byte UTF8 character The , , , , , , and rules describe the GSER encoding of values of the correspondingly named ASN.1 types. These contents of these string types are compatible with UTF8 and do not require any translation before being encoded. The GeneralizedTime and UTCTime types use the VisibleString character set. NumericString = StringValue PrintableString = StringValue Legg Expires 12 May 2002 [Page 6] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 VisibleString = StringValue ISO646String = StringValue IA5String = StringValue UTF8String = StringValue GeneralizedTime = VisibleString UTCTime = VisibleString The and rules describe the GSER encoding of values of the BMPString and UniversalString types respectively. BMPString (UCS-2) and UniversalString (UCS-4) values are translated into UTF8 [RFC2279] character strings before being encoded according to . BMPString = StringValue UniversalString = StringValue The , , , , and rules describe the GSER encoding of values of the correspondingly named ASN.1 types. Values of these string types are translated into UTF8 character strings before being encoded according to . The ObjectDescriptor type uses the GraphicString character set. TeletexString = StringValue T61String = StringValue VideotexString = StringValue GraphicString = StringValue GeneralString = StringValue ObjectDescriptor = GraphicString 7. Directory ASN.1 Types This section describes the GSER encoding of values of selected ASN.1 types defined for LDAP and X.500. The ABNF rule names beginning with uppercase letters describe the GSER encoding of values of the ASN.1 type with the same name. AttributeType = OBJECT-IDENTIFIER The characters of a DirectoryString are translated into UTF8 characters as required before being encoded between double quotes with any embedded double quotes escaped by being repeated. DirectoryString = dquote *SafeUTF8Character dquote The rule describes the GSER encoding of values of the RDNSequence type, which is syntactically equivalent to the Legg Expires 12 May 2002 [Page 7] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 DistinguishedName and LocalName types. The rule encodes a name as an LDAPDN character string between double quotes. The character string is first derived according to the rule in Section 3 of [RFC2253], and then it is encoded between double quotes with any embedded double quotes escaped by being repeated. DistinguishedName = RDNSequence LocalName = RDNSequence RDNSequence = dquote *SafeUTF8Character dquote 8. Security Considerations GSER, and therefore the ABNF encodings described in this document, do not necessarily enable the exact octet encoding of values of the TeletexString, VideotexString, GraphicString or GeneralString types to be reconstructed, so a transformation from DER to GSER and back to DER may not reproduce the original DER encoding. This has consequences for the verification of digital signatures. 9. References [BCP-11] - R. Hovey, S. Bradner, "The Organizations Involved in the IETF Standards Process", BCP 11, RFC 2028, October 1996. [RFC2119] - S. Bradner, "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119. [RFC2234] - D. Crocker, P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997. [RFC2251] - M. Wahl, T. Howes, S. Kille, "Lightweight Directory Access Protocol (v3)", RFC 2251, December 1997. [RFC2252] - M. Wahl, A. Coulbeck, T. Howes, S. Kille, "Lightweight Directory Access Protocol (v3): Attribute Syntax Definitions", RFC 2252, December 1997. [RFC2253] M. Wahl, S. Kille, T. Howes. "Lightweight Directory Access Protocol (v3): UTF-8 String Representation of Distinguished Names", RFC2253, December 1997. [RFC2279] - F. Yergeau, "UTF-8, a transformation format of ISO 10646", RFC 2279, January 1998. [CMR] - S. Legg, "LDAP & X.500 Component Matching Rules", draft-legg- Legg Expires 12 May 2002 [Page 8] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 ldapext-component-matching-04.txt, November 2001. [X500] - ITU-T Recommendation X.500 (1993) | ISO/IEC 9594-1:1994, Information Technology - Open Systems Interconnection - The Directory: Overview of concepts, models and services [X680] - ITU-T Recommendation X.680 (1997) | ISO/IEC 8824-1:1998 Information Technology - Abstract Syntax Notation One (ASN.1): Specification of basic notation 10. Intellectual Property Notice The IETF takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on the IETF's procedures with respect to rights in standards-track and standards-related documentation can be found in BCP-11. [BCP-11] Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementors or users of this specification can be obtained from the IETF Secretariat. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to practice this standard. Please address the information to the IETF Executive Director. 11. Copyright Notice Copyright (C) The Internet Society (2001). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for Legg Expires 12 May 2002 [Page 9] INTERNET-DRAFT Common Elements of GSER Encodings November 12, 2001 copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 12. Author's Address Steven Legg Adacel Technologies Ltd. 405-409 Ferntree Gully Road Mount Waverley, Victoria 3149 AUSTRALIA Phone: +61 3 9451 2107 Fax: +61 3 9541 2121 EMail: steven.legg@adacel.com.au Legg Expires 12 May 2002 [Page 10]