7 Internet-Draft Kurt D. Zeilenga
8 Intended Category: Standard Track OpenLDAP Foundation
9 Expires in six months 30 September 2005
13 LDAP: Internationalized String Preparation
14 <draft-ietf-ldapbis-strprep-06.txt>
20 This document is intended to be published as a Standard Track RFC.
21 Distribution of this memo is unlimited. Technical discussion of this
22 document will take place on the IETF LDAP Revision Working Group
23 mailing list <ietf-ldapbis@openldap.org>. Please send editorial
24 comments directly to the editor <Kurt@OpenLDAP.org>.
26 By submitting this Internet-Draft, each author represents that any
27 applicable patent or other IPR claims of which he or she is aware have
28 been or will be disclosed, and any of which he or she becomes aware
29 will be disclosed, in accordance with Section 6 of BCP 79.
31 Internet-Drafts are working documents of the Internet Engineering Task
32 Force (IETF), its areas, and its working groups. Note that other
33 groups may also distribute working documents as Internet-Drafts.
35 Internet-Drafts are draft documents valid for a maximum of six months
36 and may be updated, replaced, or obsoleted by other documents at any
37 time. It is inappropriate to use Internet-Drafts as reference material
38 or to cite them other than as "work in progress."
40 The list of current Internet-Drafts can be accessed at
41 http://www.ietf.org/1id-abstracts.html
43 The list of Internet-Draft Shadow Directories can be accessed at
44 http://www.ietf.org/shadow.html
47 Copyright (C) The Internet Society (2005). All Rights Reserved.
49 Please see the Full Copyright section near the end of this document
58 Zeilenga LDAPprep [Page 1]
60 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
65 The previous Lightweight Directory Access Protocol (LDAP) technical
66 specifications did not precisely define how character string matching
67 is to be performed. This led to a number of usability and
68 interoperability problems. This document defines string preparation
69 algorithms for character-based matching rules defined for use in LDAP.
74 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
75 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
76 document are to be interpreted as described in BCP 14 [RFC2119].
78 Character names in this document use the notation for code points and
79 names from the Unicode Standard [Unicode]. For example, the letter
80 "a" may be represented as either <U+0061> or <LATIN SMALL LETTER A>.
81 In the lists of mappings and the prohibited characters, the "U+" is
82 left off to make the lists easier to read. The comments for character
83 ranges are shown in square brackets (such as "[CONTROL CHARACTERS]")
84 and do not come from the standard.
86 Note: a glossary of terms used in Unicode can be found in [Glossary].
87 Information on the Unicode character encoding model can be found in
90 The term "combining mark", as used in this specification, refers to
91 any Unicode [Unicode] code point which has a mark property (Mn, Mc,
92 Me). Appendix A provides a complete list of combining marks.
99 A Lightweight Directory Access Protocol (LDAP) [Roadmap] matching rule
100 [Syntaxes] defines an algorithm for determining whether a presented
101 value matches an attribute value in accordance with the criteria
102 defined for the rule. The proposition may be evaluated to True,
105 True - the attribute contains a matching value,
107 False - the attribute contains no matching value,
109 Undefined - it cannot be determined whether the attribute contains
110 a matching value or not.
114 Zeilenga LDAPprep [Page 2]
116 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
119 For instance, the caseIgnoreMatch matching rule may be used to compare
120 whether the commonName attribute contains a particular value without
121 regard for case and insignificant spaces.
124 1.2. X.500 String Matching Rules
126 "X.520: Selected attribute types" [X.520] provides (amongst other
127 things) value syntaxes and matching rules for comparing values
128 commonly used in the Directory. These specifications are inadequate
129 for strings composed of Unicode [Unicode] characters.
131 The caseIgnoreMatch matching rule [X.520], for example, is simply
132 defined as being a case insensitive comparison where insignificant
133 spaces are ignored. For printableString, there is only one space
134 character and case mapping is bijective, hence this definition is
135 sufficient. However, for Unicode string types such as
136 universalString, this is not sufficient. For example, a case
137 insensitive matching implementation which folded lower case characters
138 to upper case would yield different different results than an
139 implementation which used upper case to lower case folding. Or one
140 implementation may view space as referring to only SPACE (U+0020), a
141 second implementation may view any character with the space separator
142 (Zs) property as a space, and another implementation may view any
143 character with the whitespace (WS) category as a space.
145 The lack of precise specification for character string matching has
146 led to significant interoperability problems. When used in
147 certificate chain validation, security vulnerabilities can arise. To
148 address these problems, this document defines precise algorithms for
149 preparing character strings for matching.
152 1.3. Relationship to "stringprep"
154 The character string preparation algorithms described in this document
155 are based upon the "stringprep" approach [StringPrep]. In
156 "stringprep", presented and stored values are first prepared for
157 comparison and so that a character-by-character comparison yields the
160 The approach used here is a refinement of the "stringprep"
161 [StringPrep] approach. Each algorithm involves two additional
164 a) prior to applying the Unicode string preparation steps outlined in
165 "stringprep", the string is transcoded to Unicode;
170 Zeilenga LDAPprep [Page 3]
172 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
175 b) after applying the Unicode string preparation steps outlined in
176 "stringprep", the string is modified to appropriately handle
177 characters insignificant to the matching rule.
179 Hence, preparation of character strings for X.500 matching involves
186 5) Check Bidi (Bidirectional)
187 6) Insignificant Character Handling
189 These steps are described in Section 2.
192 1.4. Relationship to the LDAP Technical Specification
194 This document is a integral part of the LDAP technical specification
195 [Roadmap] which obsoletes the previously defined LDAP technical
196 specification [RFC3377] in its entirety.
198 This document details new LDAP internationalized character string
199 preparation algorithms used by [Syntaxes] and possible other technical
200 specifications defining LDAP syntaxes and/or matching rules.
203 1.5. Relationship to X.500
205 LDAP is defined [Roadmap] in X.500 terms as an X.500 access mechanism.
206 As such, there is a strong desire for alignment between LDAP and X.500
207 syntax and semantics. The character string preparation algorithms
208 described in this document are based upon "Internationalized String
209 Matching Rules for X.500" [XMATCH] proposal to ITU/ISO Joint Study
213 2. String Preparation
215 The following six-step process SHALL be applied to each presented and
216 attribute value in preparation for character string matching rule
226 Zeilenga LDAPprep [Page 4]
228 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
232 6) Insignificant Character Handling
234 Failure in any step causes the assertion to evaluate to Undefined.
236 The character repertoire of this process is Unicode 3.2 [Unicode].
241 Each non-Unicode string value is transcoded to Unicode.
243 PrintableString [X.680] value are transcoded directly to Unicode.
245 UniversalString, UTF8String, and bmpString [X.680] values need not be
246 transcoded as they are Unicode-based strings (in the case of
247 bmpString, a subset of Unicode).
249 TeletexString [X.680] values are transcoded to Unicode. As there is
250 no standard for mapping TelexString values to Unicode, the mapping is
253 For these and other reasons, use of TeletexString is NOT RECOMMENDED.
255 The output is the transcoded string.
260 SOFT HYPHEN (U+00AD) and MONGOLIAN TODO SOFT HYPHEN (U+1806) code
261 points are mapped to nothing. COMBINING GRAPHEME JOINER (U+034F) and
262 VARIATION SELECTORs (U+180B-180D, FF00-FE0F) code points are also
263 mapped to nothing. The OBJECT REPLACEMENT CHARACTER (U+FFFC) is
266 CHARACTER TABULATION (U+0009), LINE FEED (LF) (U+000A), LINE
267 TABULATION (U+000B), FORM FEED (FF) (U+000C), CARRIAGE RETURN (CR)
268 (U+000D), and NEXT LINE (NEL) (U+0085) are mapped to SPACE (U+0020).
270 All other control code (e.g., Cc) points or code points with a control
271 function (e.g., Cf) are mapped to nothing. The following is a
272 complete list of these code points: U+0000-0008, 000E-001F, 007F-0084,
273 0086-009F, 06DD, 070F, 180E, 200C-200F, 202A-202E, 2060-2063,
274 206A-206F, FEFF, FFF9-FFFB, 1D173-1D17A, E0001, E0020-E007F.
276 ZERO WIDTH SPACE (U+200B) is mapped to nothing. All other code points
277 with Separator (space, line, or paragraph) property (e.g, Zs, Zl, or
278 Zp) are mapped to SPACE (U+0020). The following is a complete list of
282 Zeilenga LDAPprep [Page 5]
284 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
287 these code points: U+0020, 00A0, 1680, 2000-200A, 2028-2029, 202F,
290 For case ignore, numeric, and stored prefix string matching rules,
291 characters are case folded per B.2 of [StringPrep].
293 The output is the mapped string.
298 The input string is be normalized to Unicode Form KC (compatibility
299 composed) as described in [UAX15]. The output is the normalized
305 All Unassigned code points are prohibited. Unassigned code points are
306 listed in Table A.1 of [StringPrep].
308 Characters which, per Section 5.8 of [Stringprep], change display
309 properties or are deprecated are prohibited. These characters are are
310 listed in Table C.8 of [StringPrep].
312 Private Use code points are prohibited. These characters are listed
313 in Table C.3 of [StringPrep].
315 All non-character code points are prohibited. These code points are
316 listed in Table C.4 of [StringPrep].
318 Surrogate codes are prohibited. These characters are listed in Table
321 The REPLACEMENT CHARACTER (U+FFFD) code point is prohibited.
323 The step fails if the input string contains any prohibited code point.
324 Otherwise, the output is the input string.
329 Bidirectional characters are ignored.
332 2.6. Insignificant Character Handling
334 In this step, the string is modified to ensure proper handling of
338 Zeilenga LDAPprep [Page 6]
340 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
343 characters insignificant to the matching rule. This modification
344 differs from matching rule to matching rule.
346 Section 2.6.1 applies to case ignore and exact string matching.
347 Section 2.6.2 applies to numericString matching.
348 Section 2.6.3 applies to telephoneNumber matching.
351 2.6.1. Insignificant Space Handling
353 For the purposes of this section, a space is defined to be the SPACE
354 (U+0020) code point followed by no combining marks.
356 NOTE - The previous steps ensure that the string cannot contain any
357 code points in the separator class, other than SPACE (U+0020).
359 If the input string contains at least one non-space character, then
360 the string is modified such that the string starts with exactly one
361 space character, ends with exactly one SPACE character, and that any
362 inner (non-empty) sequence of space characters is replaced with
363 exactly two SPACE characters. For instance, the input strings
364 "foo<SPACE>bar<SPACE><SPACE>", results in the output
365 "<SPACE>foo<SPACE><SPACE>bar<SPACE>".
367 Otherwise, if the string being prepared is an initial, any, or final
368 substring, then the output string is exactly one SPACE character, else
369 the output string is exactly two SPACEs.
371 Appendix B discusses the rationale for the behavior.
374 2.6.2. numericString Insignificant Character Handling
376 For the purposes of this section, a space is defined to be the SPACE
377 (U+0020) code point followed by no combining marks.
379 All spaces are regarded as insignificant and are to be removed.
381 For example, removal of spaces from the Form KC string:
382 "<SPACE><SPACE>123<SPACE><SPACE>456<SPACE><SPACE>"
383 would result in the output string:
385 and the Form KC string:
386 "<SPACE><SPACE><SPACE>"
387 would result in the output string:
388 "" (an empty string).
394 Zeilenga LDAPprep [Page 7]
396 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
399 2.6.3. telephoneNumber Insignificant Character Handling
401 For the purposes of this section, a hyphen is defined to be
402 HYPHEN-MINUS (U+002D), ARMENIAN HYPHEN (U+058A), HYPHEN (U+2010),
403 NON-BREAKING HYPHEN (U+2011), MINUS SIGN (U+2212), SMALL HYPHEN-MINUS
404 (U+FE63), or FULLWIDTH HYPHEN-MINUS (U+FF0D) code point followed by no
405 combining marks and a space is defined to be the SPACE (U+0020) code
406 point followed by no combining marks.
408 All hyphens and spaces are considered insignificant and are to be
411 For example, removal of hyphens and spaces from the Form KC string:
412 "<SPACE><HYPHEN>123<SPACE><SPACE>456<SPACE><HYPHEN>"
413 would result in the output string:
415 and the Form KC string:
416 "<HYPHEN><HYPHEN><HYPHEN>"
417 would result in the (empty) output string:
421 3. Security Considerations
423 "Preparation for International Strings ('stringprep')" [StringPrep]
424 security considerations generally apply to the algorithms described
430 The approach used in this document is based upon design principles and
431 algorithms described in "Preparation of Internationalized Strings
432 ('stringprep')" [StringPrep] by Paul Hoffman and Marc Blanchet. Some
433 additional guidance was drawn from Unicode Technical Standards,
434 Technical Reports, and Notes.
436 This document is a product of the IETF LDAP Revision (LDAPBIS) Working
445 Email: Kurt@OpenLDAP.org
450 Zeilenga LDAPprep [Page 8]
452 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
457 [[Note to the RFC Editor: please replace the citation tags used in
458 referencing Internet-Drafts with tags of the form RFCnnnn where
462 6.1. Normative References
464 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
465 Requirement Levels", BCP 14 (also RFC 2119), March 1997.
467 [Roadmap] Zeilenga, K. (editor), "LDAP: Technical Specification
468 Road Map", draft-ietf-ldapbis-roadmap-xx.txt, a work in
471 [StringPrep] Hoffman P. and M. Blanchet, "Preparation of
472 Internationalized Strings ('stringprep')",
473 draft-hoffman-rfc3454bis-xx.txt, a work in progress.
475 [Syntaxes] Legg, S. (editor), "LDAP: Syntaxes and Matching Rules",
476 draft-ietf-ldapbis-syntaxes-xx.txt, a work in progress.
478 [Unicode] The Unicode Consortium, "The Unicode Standard, Version
479 3.2.0" is defined by "The Unicode Standard, Version 3.0"
480 (Reading, MA, Addison-Wesley, 2000. ISBN 0-201-61633-5),
481 as amended by the "Unicode Standard Annex #27: Unicode
482 3.1" (http://www.unicode.org/reports/tr27/) and by the
483 "Unicode Standard Annex #28: Unicode 3.2"
484 (http://www.unicode.org/reports/tr28/).
486 [UAX15] Davis, M. and M. Duerst, "Unicode Standard Annex #15:
487 Unicode Normalization Forms, Version 3.2.0".
488 <http://www.unicode.org/unicode/reports/tr15/tr15-22.html>,
491 [X.680] International Telecommunication Union -
492 Telecommunication Standardization Sector, "Abstract
493 Syntax Notation One (ASN.1) - Specification of Basic
494 Notation", X.680(2002) (also ISO/IEC 8824-1:2002).
497 6.2. Informative References
499 [X.500] International Telecommunication Union -
500 Telecommunication Standardization Sector, "The Directory
501 -- Overview of concepts, models and services,"
502 X.500(1993) (also ISO/IEC 9594-1:1994).
506 Zeilenga LDAPprep [Page 9]
508 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
511 [X.501] International Telecommunication Union -
512 Telecommunication Standardization Sector, "The Directory
513 -- Models," X.501(1993) (also ISO/IEC 9594-2:1994).
515 [X.520] International Telecommunication Union -
516 Telecommunication Standardization Sector, "The
517 Directory: Selected Attribute Types", X.520(1993) (also
518 ISO/IEC 9594-6:1994).
520 [Glossary] The Unicode Consortium, "Unicode Glossary",
521 <http://www.unicode.org/glossary/>.
523 [CharModel] Whistler, K. and M. Davis, "Unicode Technical Report
524 #17, Character Encoding Model", UTR17,
525 <http://www.unicode.org/unicode/reports/tr17/>, August
528 [XMATCH] Zeilenga, K., "Internationalized String Matching Rules
529 for X.500", draft-zeilenga-ldapbis-strmatch-xx.txt, a
532 [RFC1345] Simonsen, K., "Character Mnemonics & Character Sets",
536 Appendix A. Combining Marks
538 This appendix is normative.
540 0300-034F 0360-036F 0483-0486 0488-0489 0591-05A1 05A3-05B9 05BB-05BC
541 05BF 05C1-05C2 05C4 064B-0655 0670 06D6-06DC 06DE-06E4 06E7-06E8
542 06EA-06ED 0711 0730-074A 07A6-07B0 0901-0903 093C 093E-094F 0951-0954
543 0962-0963 0981-0983 09BC 09BE-09C4 09C7-09C8 09CB-09CD 09D7 09E2-09E3
544 0A02 0A3C 0A3E-0A42 0A47-0A48 0A4B-0A4D 0A70-0A71 0A81-0A83 0ABC
545 0ABE-0AC5 0AC7-0AC9 0ACB-0ACD 0B01-0B03 0B3C 0B3E-0B43 0B47-0B48
546 0B4B-0B4D 0B56-0B57 0B82 0BBE-0BC2 0BC6-0BC8 0BCA-0BCD 0BD7 0C01-0C03
547 0C3E-0C44 0C46-0C48 0C4A-0C4D 0C55-0C56 0C82-0C83 0CBE-0CC4 0CC6-0CC8
548 0CCA-0CCD 0CD5-0CD6 0D02-0D03 0D3E-0D43 0D46-0D48 0D4A-0D4D 0D57
549 0D82-0D83 0DCA 0DCF-0DD4 0DD6 0DD8-0DDF 0DF2-0DF3 0E31 0E34-0E3A
550 0E47-0E4E 0EB1 0EB4-0EB9 0EBB-0EBC 0EC8-0ECD 0F18-0F19 0F35 0F37 0F39
551 0F3E-0F3F 0F71-0F84 0F86-0F87 0F90-0F97 0F99-0FBC 0FC6 102C-1032
552 1036-1039 1056-1059 1712-1714 1732-1734 1752-1753 1772-1773 17B4-17D3
553 180B-180D 18A9 20D0-20EA 302A-302F 3099-309A FB1E FE00-FE0F FE20-FE23
554 1D165-1D169 1D16D-1D172 1D17B-1D182 1D185-1D18B 1D1AA-1D1AD
558 Appendix B. Substrings Matching
562 Zeilenga LDAPprep [Page 10]
564 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
567 In absence of substrings matching, the insignificant space handling
568 for case ignore/exact matching could be simplified. Specifically,
569 the handling could be as require all sequences of one or more spaces
570 be replaced with one space and, if string contains non-space
571 characters, removal of all all leading spaces and trailing spaces.
573 In the presence of substrings matching, this simplified space handling
574 this simplified space handling would lead to unexpected and
575 undesirable matching behavior. For instance:
576 1) (CN=foo\20*\20bar) would match the CN value "foobar" but not
577 "foo<SPACE>bar" nor "foo<SPACE><SPACE>bar";
578 2) (CN=*\20foobar\20*) would match "foobar", but (CN=*\20*foobar*\20*)
580 3) (CN=foo\20*\20bar) would match "foo<SPACE>X<SPACE>bar" but not
581 "foo<SPACE><SPACE>bar".
583 The first case illustrates that this simplified space handling would
584 cause leading and trailing spaces in substrings of the string to be
585 regarded as insignificant. However, only leading and trailing (as
586 well as multiple consecutive spaces) of the string (as a whole) are
589 The second case illustrates that this simplified space handling would
590 cause sub-partitioning failures. That is, if a prepared any substring
591 matches a partition of the attribute value, then an assertion
592 constructed by subdividing that substring into multiple substrings
595 The third case illustrates that this simplified space handling causes
596 another partitioning failure. Though both the initial or final
597 strings match different portions of "foo<SPACE>X<SPACE>bar" with
598 neither matching the X portion, they don't match a string consisting
599 of the two matched portions less the unmatched X portion.
601 In designing an appropriate approach for space handling for substrings
602 matching, one must study key aspects of X.500 case exact/ignore
603 matching. X.520 [X.520] says:
604 The [substrings] rule returns TRUE if there is a partitioning of
605 the attribute value (into portions) such that:
606 - the specified substrings (initial, any, final) match different
607 portions of the value in the order of the strings sequence;
608 - initial, if present, matches the first portion of the value;
609 - final, if present, matches the last portion of the value;
610 - any, if present, matches some arbitrary portion of the value.
612 That is, the substrings assertion (CN=foo\20*\20bar) matches the
613 attribute value "foo<SPACE><SPACE>bar" as the value can be partitioned
614 into the portions "foo<SPACE>" and "<SPACE>bar" meeting the above
618 Zeilenga LDAPprep [Page 11]
620 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
626 [T]he following spaces are regarded as not significant:
627 - leading spaces (i.e. those preceding the first character that is
629 - trailing spaces (i.e. those following the last character that is
631 - multiple consecutive spaces (these are taken as equivalent to a
632 single space character).
634 This statement applies to the assertion values and attribute values
635 as whole strings, and not individually to substrings of an assertion
636 value. In particular, the statements should be taken to mean that
637 if an assertion value and attribute value match without any
638 consideration to insignificant characters, then that assertion value
639 should also match any attribute value which differs only by inclusion
640 or removal of insignificant characters.
642 Hence, the assertion (CN=foo\20*\20bar) matches
643 "foo<SPACE><SPACE><SPACE>bar" and "foo<SPACE>bar" as these values
644 only differ from "foo<SPACE><SPACE>bar" by the inclusion or removal
645 of insignificant spaces.
647 Astute readers of this text will also note that there are special
648 cases where the specified space handling does not ignore spaces
649 which could be considered insignificant. For instance, the assertion
650 (CN=\20*\20*\20) does not match "<SPACE><SPACE><SPACE>"
651 (insignificant spaces present in value) nor " " (insignificant
652 spaces not present in value). However, as these cases have no
653 practical application that cannot be met by simple assertions, e.g.
654 (cn=\20), and this minor anomaly can only be fully addressed by a
655 preparation algorithm to be used in conjunction with
656 character-by-character partitioning and matching, the anomaly is
657 considered acceptable.
661 Intellectual Property Rights
663 The IETF takes no position regarding the validity or scope of any
664 Intellectual Property Rights or other rights that might be claimed
665 to pertain to the implementation or use of the technology described
666 in this document or the extent to which any license under such
667 rights might or might not be available; nor does it represent that
668 it has made any independent effort to identify any such rights.
669 Information on the procedures with respect to rights in RFC documents
670 can be found in BCP 78 and BCP 79.
674 Zeilenga LDAPprep [Page 12]
676 Internet-Draft draft-ietf-ldapbis-strprep-06 30 September 2005
679 Copies of IPR disclosures made to the IETF Secretariat and any
680 assurances of licenses to be made available, or the result of an
681 attempt made to obtain a general license or permission for the use
682 of such proprietary rights by implementers or users of this
683 specification can be obtained from the IETF on-line IPR repository
684 at http://www.ietf.org/ipr.
686 The IETF invites any interested party to bring to its attention any
687 copyrights, patents or patent applications, or other proprietary
688 rights that may cover technology that may be required to implement
689 this standard. Please address the information to the IETF at
696 Copyright (C) The Internet Society (2005).
698 This document is subject to the rights, licenses and restrictions
699 contained in BCP 78, and except as set forth therein, the authors
700 retain all their rights.
702 This document and the information contained herein are provided on an
703 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE
704 REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE
705 INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR
706 IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
707 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
708 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
730 Zeilenga LDAPprep [Page 13]