draft-ietf-ldapbis-strprep-00.txt   draft-ietf-ldapbis-strprep-01.txt 
Internet-Draft Kurt D. Zeilenga Internet-Draft Kurt D. Zeilenga
Intended Category: Standard Track OpenLDAP Foundation Intended Category: Standard Track OpenLDAP Foundation
Expires in six months 26 May 2003 Expires in six months 30 June 2003
LDAP: Internationalized String Preparation LDAP: Internationalized String Preparation
<draft-ietf-ldapbis-strprep-00.txt> <draft-ietf-ldapbis-strprep-01.txt>
Status of this Memo Status of this Memo
This document is an Internet-Draft and is in full conformance with all This document is an Internet-Draft and is in full conformance with all
provisions of Section 10 of RFC2026. provisions of Section 10 of RFC2026.
Distribution of this memo is unlimited. Technical discussion of this Distribution of this memo is unlimited. Technical discussion of this
document will take place on the IETF LDAP Revision Working Group document will take place on the IETF LDAP Revision Working Group
mailing list <ietf-ldapbis@openldap.org>. Please send editorial mailing list <ietf-ldapbis@openldap.org>. Please send editorial
comments directly to the author <Kurt@OpenLDAP.org>. comments directly to the author <Kurt@OpenLDAP.org>.
skipping to change at page 1, line 41 skipping to change at page 1, line 41
<http://www.ietf.org/shadow.html>. <http://www.ietf.org/shadow.html>.
Copyright (C) The Internet Society (2003). All Rights Reserved. Copyright (C) The Internet Society (2003). All Rights Reserved.
Please see the Full Copyright section near the end of this document Please see the Full Copyright section near the end of this document
for more information. for more information.
Abstract Abstract
The previous Lightweight Directory Access Protocol (LDAP) technical The previous Lightweight Directory Access Protocol (LDAP) technical
specifications did not precisely define how string matching is to be specifications did not precisely define how character string matching
performed. This lead to a number of usability and interoperability is to be performed. This lead to a number of usability and
problems. This document defines string preparation algorithms for interoperability problems. This document defines string preparation
matching rules defined for use in LDAP. algorithms for character-based matching rules defined for use in LDAP.
Conventions Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in BCP 14 [RFC2119]. document are to be interpreted as described in BCP 14 [RFC2119].
Character names in this document use the notation for code points and Character names in this document use the notation for code points and
names from the Unicode Standard [Unicode]. For example, the letter names from the Unicode Standard [Unicode]. For example, the letter
"a" may be represented as either <U+0061> or <LATIN SMALL LETTER A>. "a" may be represented as either <U+0061> or <LATIN SMALL LETTER A>.
skipping to change at page 3, line 19 skipping to change at page 3, line 19
sufficient. However, for UCS-based string types such as sufficient. However, for UCS-based string types such as
universalString, this is not sufficient. For example, a case universalString, this is not sufficient. For example, a case
insensitive matching implementation which folded lower case characters insensitive matching implementation which folded lower case characters
to upper case would yield different different results than an to upper case would yield different different results than an
implementation which used upper case to lower case folding. Or one implementation which used upper case to lower case folding. Or one
implementation may view space as referring to only SPACE (U+0020), a implementation may view space as referring to only SPACE (U+0020), a
second implementation may view any character with the space separator second implementation may view any character with the space separator
(Zs) property as a space, and another implementation may view any (Zs) property as a space, and another implementation may view any
character with the whitespace (WS) category as a space. character with the whitespace (WS) category as a space.
The lack of precise specification for string matching has led to The lack of precise specification for character string matching has
significant interoperability problems. When used in certificate chain led to significant interoperability problems. When used in
validation, security vulnerabilities can arise. To address these certificate chain validation, security vulnerabilities can arise. To
problems, this document defines precise algorithms for preparing address these problems, this document defines precise algorithms for
strings for matching. preparing character strings for matching.
1.3. Relationship to "stringprep" 1.3. Relationship to "stringprep"
The string preparation algorithms described in this document are based The character string preparation algorithms described in this document
upon the "stringprep" approach [RFC3454]. In "stringprep", presented are based upon the "stringprep" approach [RFC3454]. In "stringprep",
and stored values are first prepared for comparison and so that a presented and stored values are first prepared for comparison and so
character-by-character comparison yields the "correct" result. that a character-by-character comparison yields the "correct" result.
The approach used here is a refinement of the "stringprep" [RFC3454] The approach used here is a refinement of the "stringprep" [RFC3454]
approach. Each algorithm involves two additional preparation steps. approach. Each algorithm involves two additional preparation steps.
a) prior to applying the Unicode string preparation steps outlined in a) prior to applying the Unicode string preparation steps outlined in
"stringprep", the string is transcoded to Unicode; "stringprep", the string is transcoded to Unicode;
b) after applying the Unicode string preparation steps outlined in b) after applying the Unicode string preparation steps outlined in
"stringprep", characters insignificant to the matching rules are "stringprep", characters insignificant to the matching rules are
removed. removed.
Hence, preparation of strings for X.500 matching involves the Hence, preparation of character strings for X.500 matching involves
following steps: the following steps:
1) Transcode 1) Transcode
2) Map 2) Map
3) Normalize 3) Normalize
4) Prohibit 4) Prohibit
5) Check Bidi (Bidirectional) 5) Check Bidi (Bidirectional)
6) Insignificant Character Removal 6) Insignificant Character Removal
These steps are described in Section 2. These steps are described in Section 2.
1.4. Relationship to the LDAP Technical Specification 1.4. Relationship to the LDAP Technical Specification
This document is a integral part of the LDAP technical specification This document is a integral part of the LDAP technical specification
[Roadmap] which obsoletes the previously defined LDAP technical [Roadmap] which obsoletes the previously defined LDAP technical
specification [RFC3377] in its entirety. specification [RFC3377] in its entirety.
This document details new LDAP internationalized string preparation This document details new LDAP internationalized character string
algorithms used by [Syntaxes] and possible other technical preparation algorithms used by [Syntaxes] and possible other technical
specifications defining LDAP syntaxes and/or matching rules. specifications defining LDAP syntaxes and/or matching rules.
1.5. Relationship to X.500 1.5. Relationship to X.500
LDAP is defined [Roadmap] in X.500 terms as an X.500 access mechanism. LDAP is defined [Roadmap] in X.500 terms as an X.500 access mechanism.
As such, there is a strong desire for alignment between LDAP and X.500 As such, there is a strong desire for alignment between LDAP and X.500
syntax and semantics. The string preparation algorithms described in syntax and semantics. The character string preparation algorithms
this document are based upon "Internationalized String Matching Rules described in this document are based upon "Internationalized String
for X.500" [XMATCH] proposal to ITU/ISO Joint Study Group 2. Matching Rules for X.500" [XMATCH] proposal to ITU/ISO Joint Study
Group 2.
2. String Preparation 2. String Preparation
The following six-step process SHALL be applied to each presented and The following six-step process SHALL be applied to each presented and
attribute value in preparation for string match rule evaluation. attribute value in preparation for character string matching rule
evaluation.
1) Transcode 1) Transcode
2) Map 2) Map
3) Normalize 3) Normalize
4) Prohibit 4) Prohibit
5) Check bidi 5) Check bidi
6) Insignificant Character Removal 6) Insignificant Character Removal
Failure in any step is be cause the assertion to be Undefined. Failure in any step causes the assertion to evaluate to Undefined.
This process is intended to act upon non-empty character strings. If
the string to prepare is empty, this process is not applied and the
assertion is evaluated to Undefined.
The character repertoire of this process is Unicode 3.2 [Unicode]. The character repertoire of this process is Unicode 3.2 [Unicode].
2.1. Transcode 2.1. Transcode
Each non-Unicode string value is transcoded to Unicode. Each non-Unicode string value is transcoded to Unicode.
TeletexString [X.680][T.61] values are transcoded to Unicode as TeletexString [X.680][T.61] values are transcoded to Unicode as
described in Appendix A. described in Appendix A.
PrintableString [X.680] value are transcoded directly to Unicode. PrintableString [X.680] value are transcoded directly to Unicode.
UniversalString, UTF8String, and bmpString [X.680] values need not be UniversalString, UTF8String, and bmpString [X.680] values need not be
transcoded as they are Unicode-based strings (in the case of transcoded as they are Unicode-based strings (in the case of
bmpString, a subset of Unicode). bmpString, a subset of Unicode).
skipping to change at page 5, line 43 skipping to change at page 6, line 4
For case ignore, numeric, and stored prefix string matching rules, For case ignore, numeric, and stored prefix string matching rules,
characters are case folded per B.2 of [RFC3454]. characters are case folded per B.2 of [RFC3454].
2.3. Normalize 2.3. Normalize
The input string is be normalized to Unicode Form KC (compatibility The input string is be normalized to Unicode Form KC (compatibility
composed) as described in [UAX15]. composed) as described in [UAX15].
2.4. Prohibit 2.4. Prohibit
All Unassigned, Private Use, and non-character code points are All Unassigned, Private Use, and non-character code points are
prohibited. Surrogate codes (U+D800-DFFFF) are prohibited. prohibited. Surrogate codes (U+D800-DFFFF) are prohibited.
The REPLACEMENT CHARACTER (U+FFFD) code point is prohibited. The REPLACEMENT CHARACTER (U+FFFD) code point is prohibited.
The first code point of a string is prohibited from being a combining The first code point of a string is prohibited from being a combining
character. character.
Empty strings are prohibited.
The step fails and the assertion is evaluated to Undefined if the The step fails and the assertion is evaluated to Undefined if the
input string contains any prohibited code point. The output string is input string contains any prohibited code point. The output string is
the input string. the input string.
2.5. Check bidi 2.5. Check bidi
There are no bidirectional restrictions. The output string is the There are no bidirectional restrictions. The output string is the
input string. input string.
2.5. Insignificant Character Removal 2.5. Insignificant Character Removal
In this step, characters insignificant to the matching rule are to be In this step, characters insignificant to the matching rule are to be
removed. The characters to be removed differ from matching rule to removed. The characters to be removed differ from matching rule to
matching rule. matching rule.
Section 2.6.1 applies to case ignore and exact string matching. Section 2.5.1 applies to case ignore and exact string matching.
Section 2.6.2 applies to numericString matching. Section 2.5.2 applies to numericString matching.
Section 2.6.3 applies to telephoneNumber matching Section 2.5.3 applies to telephoneNumber matching
2.6.1. Insignificant Space Removal 2.5.1. Insignificant Space Removal
For the purposes of this section, a space is defined to be the SPACE For the purposes of this section, a space is defined to be the SPACE
(U+0020) code point followed by no combining marks. (U+0020) code point followed by no combining marks.
NOTE - The previous steps ensure that the string cannot contain any NOTE - The previous steps ensure that the string cannot contain any
code points in the separator class, other than SPACE (U+0020). code points in the separator class, other than SPACE (U+0020).
The following spaces are regarded as not significant and are to be If the input string consists entirely of spaces or is empty, the
removed: output is a string consisting of exactly one space (e.g. " ").
Otherwise, the following spaces are removed:
- leading spaces (i.e. those preceding the first character that is - leading spaces (i.e. those preceding the first character that is
not a space); not a space);
- trailing spaces (i.e. those following the last character that is - trailing spaces (i.e. those following the last character that is
not a space); not a space);
- multiple consecutive spaces (these are taken as equivalent to a - multiple consecutive spaces (these are taken as equivalent to a
single space character). single space character).
A string consisting entirely of spaces is equivalent to a string
containing exactly one space.
For example, removal of spaces from the Form KC string: For example, removal of spaces from the Form KC string:
"<SPACE><SPACE>foo<SPACE><SPACE>bar<SPACE><SPACE>" "<SPACE><SPACE>foo<SPACE><SPACE>bar<SPACE><SPACE>"
would result in the output string: would result in the output string:
"foo<SPACE>bar" "foo<SPACE>bar"
and the Form KC string: and the Form KC string:
"<SPACE><SPACE><SPACE>" "<SPACE><SPACE><SPACE>"
would result in the output string: would result in the output string:
"<SPACE>". "<SPACE>".
2.6.2. numericString Insignificant Character Removal 2.5.2. numericString Insignificant Character Removal
For the purposes of this section, a space is defined to be the SPACE For the purposes of this section, a space is defined to be the SPACE
(U+0020) code point followed by no combining marks. (U+0020) code point followed by no combining marks.
All spaces are regarded as not significant and are to be removed. All spaces are regarded as not significant. If the input string
consists entirely of spaces or is empty, the output is a string
consisting of exactly one space (e.g. " "). Otherwise, all spaces are
to be removed.
For example, removal of spaces from the Form KC string: For example, removal of spaces from the Form KC string:
"<SPACE><SPACE>123<SPACE><SPACE>456<SPACE><SPACE>" would result in "<SPACE><SPACE>123<SPACE><SPACE>456<SPACE><SPACE>"
the output string: would result in the output string:
"123456" "123456"
and the Form KC string: and the Form KC string:
"<SPACE><SPACE><SPACE>" "<SPACE><SPACE><SPACE>"
would result in an empty output string. would result in the output string:
"<SPACE>".
2.6.3. telephoneNumber Insignificant Character Removal 2.5.3. telephoneNumber Insignificant Character Removal
For the purposes of this section, a hyphen is defined to be For the purposes of this section, a hyphen is defined to be
HYPHEN-MINUS (U+002D), ARMENIAN HYPHEN (U+058A), HYPHEN (U+2010), HYPHEN-MINUS (U+002D), ARMENIAN HYPHEN (U+058A), HYPHEN (U+2010),
NON-BREAKING HYPHEN (U+2011), MINUS SIGN (U+2212), SMALL HYPHEN-MINUS NON-BREAKING HYPHEN (U+2011), MINUS SIGN (U+2212), SMALL HYPHEN-MINUS
(U+FE63), or FULLWIDTH HYPHEN-MINUS (U+FF0D) code point followed by no (U+FE63), or FULLWIDTH HYPHEN-MINUS (U+FF0D) code point followed by no
combining marks and a space is defined to be the SPACE (U+0020) code combining marks and a space is defined to be the SPACE (U+0020) code
point followed by no combining marks. point followed by no combining marks.
All hyphens and spaces are regarded as not significant and are to be All hyphens and spaces are considered insignificant. If the string
contains only spaces and hyphens or is empty, then the output is a
string consisting of one space. Otherwise, all hyphens and spaces are
removed. removed.
For example, removal of hyphens and spaces from the Form KC string:
"<SPACE><HYPHEN>123<SPACE><SPACE>456<SPACE><HYPHEN>"
would result in the output string:
"123456"
and the Form KC string:
"<HYPHEN><HYPHEN><HYPHEN>"
would result in the output string:
"<SPACE>".
3. Security Considerations 3. Security Considerations
"Preparation for International Strings ('stringprep')" [RFC3454] "Preparation for International Strings ('stringprep')" [RFC3454]
security considerations generally apply to the algorithms described security considerations generally apply to the algorithms described
here. here.
4. Contributors 4. Contributors
Appendix A and B of this document were authored by Howard Chu Appendix A and B of this document were authored by Howard Chu
<hyc@symas.com> of Symas Corporation (based upon information provided <hyc@symas.com> of Symas Corporation (based upon information provided
in RFC 1345). in RFC 1345).
5. Acknowledgments 5. Acknowledgments
The approach used in this document is based upon design principles and The approach used in this document is based upon design principles and
algorithms described in "Preparation of Internationalized Strings algorithms described in "Preparation of Internationalized Strings
('stringprep')" [RFC3454] by Paul Hoffman and Marc Blanchet. Some ('stringprep')" [RFC3454] by Paul Hoffman and Marc Blanchet. Some
additional guidance was drawn from Unicode Technical Standards, additional guidance was drawn from Unicode Technical Standards,
Technical Reports, and Notes. Technical Reports, and Notes.
This document is a product of the IETF LDAP Revision (LDAPBIS) Working
Group.
6. Author's Address 6. Author's Address
Kurt Zeilenga Kurt Zeilenga
E-mail: <kurt@openldap.org> E-mail: <kurt@openldap.org>
7. References 7. References
7.1. Normative References 7.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
skipping to change at page 9, line 44 skipping to change at page 10, line 15
[Glossary] The Unicode Consortium, "Unicode Glossary", [Glossary] The Unicode Consortium, "Unicode Glossary",
<http://www.unicode.org/glossary/>. <http://www.unicode.org/glossary/>.
[CharModel] Whistler, K. and M. Davis, "Unicode Technical Report [CharModel] Whistler, K. and M. Davis, "Unicode Technical Report
#17, Character Encoding Model", UTR17, #17, Character Encoding Model", UTR17,
<http://www.unicode.org/unicode/reports/tr17/>, August <http://www.unicode.org/unicode/reports/tr17/>, August
2000. 2000.
[XMATCH] Zeilenga, K., "Internationalized String Matching Rules [XMATCH] Zeilenga, K., "Internationalized String Matching Rules
for X.500", draft-zeilenga-ldapbis-strmatch-xx.txt a for X.500", draft-zeilenga-ldapbis-strmatch-xx.txt, a
work in progress. work in progress.
[RFC1345] Simonsen, K., "Character Mnemonics & Character Sets", [RFC1345] Simonsen, K., "Character Mnemonics & Character Sets",
RFC 1345, June 1992. RFC 1345, June 1992.
Appendix A. Teletex (T.61) to Unicode Appendix A. Teletex (T.61) to Unicode
This appendix defines an algorithm for transcoding [T.61] characters This appendix defines an algorithm for transcoding [T.61] characters
to [Unicode] characters for use in string preparation for LDAP to [Unicode] characters for use in string preparation for LDAP
matching rules. This appendix is a normative. matching rules. This appendix is a normative.
The transcoding algorithm is derived from the T.61-8bit definition The transcoding algorithm is derived from the T.61-8bit definition
provided in [RFC1345]. With a few exceptions, the T.61 character provided in [RFC1345]. With a few exceptions, the T.61 character
codes from x00 to x7f are equivalent to the corresponding [Unicode] codes from x00 to x7f are equivalent to the corresponding [Unicode]
code points, and their values are left unchanged by this algorithm. code points, and their values are left unchanged by this algorithm.
E.g. the T.61 code x20 is identical to (U+0020). The exceptions are E.g. the T.61 code x20 is identical to (U+0020). The exceptions are
for these T.61 codes that are undefined: x23, x24, x5c, x5e, x60, x7b, for these T.61 codes that are undefined: x23, x24, x5c, x5e, x60, x7b,
 End of changes. 

This html diff was produced by rfcdiff 1.23, available from http://www.levkowetz.com/ietf/tools/rfcdiff/