idnits 2.17.00 (12 Aug 2021) /tmp/idnits14653/draft-ietf-precis-saslprepbis-17.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The abstract seems to indicate that this document obsoletes RFC3454, but the header doesn't have an 'Obsoletes:' line to match this. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (May 15, 2015) is 2562 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: draft-ietf-precis-framework has been published as RFC 7564 -- Possible downref: Non-RFC (?) normative reference: ref. 'UAX11' -- Possible downref: Non-RFC (?) normative reference: ref. 'Unicode' == Outdated reference: draft-ietf-httpauth-basicauth-update has been published as RFC 7617 == Outdated reference: draft-ietf-httpauth-digest has been published as RFC 7616 == Outdated reference: draft-ietf-xmpp-6122bis has been published as RFC 7622 -- Obsolete informational reference (is this intentional?): RFC 3454 (Obsoleted by RFC 7564) -- Obsolete informational reference (is this intentional?): RFC 3501 (Obsoleted by RFC 9051) -- Obsolete informational reference (is this intentional?): RFC 4013 (Obsoleted by RFC 7613) -- Obsolete informational reference (is this intentional?): RFC 6122 (Obsoleted by RFC 7622) Summary: 0 errors (**), 0 flaws (~~), 5 warnings (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 PRECIS P. Saint-Andre 3 Internet-Draft &yet 4 Obsoletes: 4013 (if approved) A. Melnikov 5 Intended status: Standards Track Isode Ltd 6 Expires: November 16, 2015 May 15, 2015 8 Preparation, Enforcement, and Comparison of Internationalized Strings 9 Representing Usernames and Passwords 10 draft-ietf-precis-saslprepbis-17 12 Abstract 14 This document describes updated methods for handling Unicode strings 15 representing usernames and passwords. The previous approach was 16 known as SASLprep (RFC 4013) and was based on Stringprep (RFC 3454). 17 The methods specified in this document provide a more sustainable 18 approach to the handling of internationalized usernames and 19 passwords. The PRECIS framework, RFC YYYY, obsoletes RFC 3454, and 20 this document obsoletes RFC 4013. 22 [[ NOTE TO RFC EDITOR: please replace "YYYY" in the previous 23 paragraph with the RFC number assigned to draft-ietf-precis- 24 framework. ]] 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at http://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on November 16, 2015. 43 Copyright Notice 45 Copyright (c) 2015 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (http://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 62 3. Usernames . . . . . . . . . . . . . . . . . . . . . . . . . . 5 63 3.1. Definition . . . . . . . . . . . . . . . . . . . . . . . 5 64 3.2. UsernameCaseMapped Profile . . . . . . . . . . . . . . . 6 65 3.2.1. Preparation . . . . . . . . . . . . . . . . . . . . . 6 66 3.2.2. Enforcement . . . . . . . . . . . . . . . . . . . . . 6 67 3.2.3. Comparison . . . . . . . . . . . . . . . . . . . . . 7 68 3.3. UsernameCasePreserved Profile . . . . . . . . . . . . . . 7 69 3.3.1. Preparation . . . . . . . . . . . . . . . . . . . . . 7 70 3.3.2. Enforcement . . . . . . . . . . . . . . . . . . . . . 7 71 3.3.3. Comparison . . . . . . . . . . . . . . . . . . . . . 8 72 3.4. Case Mapping vs. Case Preservation . . . . . . . . . . . 8 73 3.5. Application-Layer Constructs . . . . . . . . . . . . . . 9 74 3.6. Examples . . . . . . . . . . . . . . . . . . . . . . . . 9 75 4. Passwords . . . . . . . . . . . . . . . . . . . . . . . . . . 11 76 4.1. Definition . . . . . . . . . . . . . . . . . . . . . . . 11 77 4.2. OpaqueString Profile . . . . . . . . . . . . . . . . . . 12 78 4.2.1. Preparation . . . . . . . . . . . . . . . . . . . . . 12 79 4.2.2. Enforcement . . . . . . . . . . . . . . . . . . . . . 12 80 4.2.3. Comparison . . . . . . . . . . . . . . . . . . . . . 13 81 4.3. Examples . . . . . . . . . . . . . . . . . . . . . . . . 13 82 5. Use in Application Protocols . . . . . . . . . . . . . . . . 14 83 6. Migration . . . . . . . . . . . . . . . . . . . . . . . . . . 15 84 6.1. Usernames . . . . . . . . . . . . . . . . . . . . . . . . 15 85 6.2. Passwords . . . . . . . . . . . . . . . . . . . . . . . . 16 86 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17 87 7.1. UsernameCaseMapped Profile . . . . . . . . . . . . . . . 17 88 7.2. UsernameCasePreserved Profile . . . . . . . . . . . . . . 18 89 7.3. OpaqueString Profile . . . . . . . . . . . . . . . . . . 18 90 8. Security Considerations . . . . . . . . . . . . . . . . . . . 19 91 8.1. Password/Passphrase Strength . . . . . . . . . . . . . . 19 92 8.2. Identifier Comparison . . . . . . . . . . . . . . . . . . 19 93 8.3. Reuse of PRECIS . . . . . . . . . . . . . . . . . . . . . 19 94 8.4. Reuse of Unicode . . . . . . . . . . . . . . . . . . . . 19 95 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 20 96 9.1. Normative References . . . . . . . . . . . . . . . . . . 20 97 9.2. Informative References . . . . . . . . . . . . . . . . . 20 98 Appendix A. Differences from RFC 4013 . . . . . . . . . . . . . 22 99 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 22 100 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 23 102 1. Introduction 104 Usernames and passwords are widely used for authentication and 105 authorization on the Internet, either directly when provided in 106 plaintext (as in the SASL PLAIN mechanism [RFC4616] or the HTTP Basic 107 scheme [I-D.ietf-httpauth-basicauth-update]) or indirectly when 108 provided as the input to a cryptographic algorithm such as a hash 109 function (as in the SASL SCRAM mechanism [RFC5802] or the HTTP Digest 110 scheme [I-D.ietf-httpauth-digest]). 112 To increase the likelihood that the input and comparison of usernames 113 and passwords will work in ways that make sense for typical users 114 throughout the world, this document defines rules for preparing, 115 enforcing, and comparing internationalized strings that represent 116 usernames and passwords. Such strings consist of characters from the 117 Unicode character set [Unicode], with special attention to characters 118 outside the ASCII range [RFC20]. The rules for handling such strings 119 are specified through profiles of the string classes defined in the 120 PRECIS framework specification [I-D.ietf-precis-framework]. 122 Profiles of the PRECIS framework enable software to handle Unicode 123 characters outside the ASCII range in an automated way, so that such 124 characters are treated carefully and consistently in application 125 protocols. In large measure, these profiles are designed to protect 126 application developers from the potentially negative consequences of 127 supporting the full range of Unicode characters. For instance, in 128 almost all application protocols it would be dangerous to treat the 129 Unicode character SUPERSCRIPT ONE (U+0089) as equivalent to DIGIT ONE 130 (U+0031), since that would result in false positives during 131 comparison, authentication, and authorization (e.g., an attacker 132 could easy spoof an account "user1@example.com"). 134 Whereas a naive use of Unicode would make such attacks trivially 135 easy, the PRECIS profile defined here for usernames generally 136 protects applications from inadvertently causing such problems. 137 (Similar considerations apply to passwords, although here it is 138 desirable to support a wider range of characters so as to maximize 139 entropy during authentication.) 141 The methods defined here might be applicable wherever usernames or 142 passwords are used. However, the methods are not intended for use in 143 preparing strings that are not usernames (e.g., LDAP distinguished 144 names), nor in cases where identifiers or secrets are not strings 145 (e.g., keys and certificates) or require specialized handling. 147 This document obsoletes RFC 4013 (the "SASLprep" profile of 148 stringprep [RFC3454]) but can be used by technologies other than the 149 Simple Authentication and Security Layer (SASL) [RFC4422], such as 150 HTTP authentication as specified in 151 [I-D.ietf-httpauth-basicauth-update] and [I-D.ietf-httpauth-digest]. 153 This document does not modify the handling of internationalized 154 strings in usernames and passwords as prescribed by existing 155 application protocols that use SASLprep. If the community that uses 156 such an application protocol wishes to modernize its handling of 157 internationalized strings to use PRECIS instead of stringprep, it 158 needs to explicitly update the existing application protocol 159 definition (one example is [I-D.ietf-xmpp-6122bis], which obsoletes 160 [RFC6122]). Non-coordinated updates to protocol implementations are 161 discouraged because they can have a negative impact on 162 interoperability and security. 164 2. Terminology 166 Many important terms used in this document are defined in 167 [I-D.ietf-precis-framework], [RFC5890], [RFC6365], and [Unicode]. 168 The term "non-ASCII space" refers to any Unicode code point having a 169 general category of "Zs", with the exception of U+0020 (here called 170 "ASCII space"). 172 As used here, the term "password" is not literally limited to a word; 173 i.e., a password could be a passphrase consisting of more than one 174 word, perhaps separated by spaces, punctuation, or other non- 175 alphanumeric characters. 177 Some SASL mechanisms (e.g., CRAM-MD5, DIGEST-MD5, and SCRAM) specify 178 that the authentication identity used in the context of such 179 mechanisms is a "simple user name" (see Section 2 of [RFC4422] as 180 well as [RFC4013]). Various application technologies also assume 181 that the identity of a user or account takes the form of a username 182 (e.g., authentication for the HyperText Transfer Protocol as 183 specified in [I-D.ietf-httpauth-basicauth-update] and 184 [I-D.ietf-httpauth-digest]), whether or not they use SASL. Note well 185 that the exact form of a username in any particular SASL mechanism or 186 application technology is a matter for implementation and deployment, 187 and that a username does not necessarily map to any particular 188 application identifier (such as the localpart of an email address). 190 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 191 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 192 "OPTIONAL" in this document are to be interpreted as described in 193 [RFC2119]. 195 3. Usernames 197 3.1. Definition 199 This document specifies that a username is a string of Unicode code 200 points [Unicode], encoded using UTF-8 [RFC3629], and structured as an 201 ordered sequence of "userparts" (where the complete username can 202 consist of a single userpart or a space-separated sequence of 203 userparts). 205 The syntax for a username is defined as follows using the Augmented 206 Backus-Naur Form (ABNF) [RFC5234]. 208 username = userpart *(1*SP userpart) 209 userpart = 1*(idbyte) 210 ; 211 ; an "idbyte" is a byte used to represent a 212 ; UTF-8 encoded Unicode code point that can be 213 ; contained in a string that conforms to the 214 ; PRECIS "IdentifierClass" 215 ; 217 All code points and blocks not explicitly allowed in the PRECIS 218 IdentifierClass are disallowed; this includes private use characters, 219 surrogate code points, and the other code points and blocks that were 220 defined as "Prohibited Output" in [RFC4013]. In addition, common 221 constructions such as "user@example.com" (e.g., the Network Access 222 Identifier from [RFC7542]) are allowed as usernames under this 223 specification, as they were under [RFC4013]. 225 Implementation Note: The username construct defined in this 226 document does not necessarily match what all deployed applications 227 might refer to as a "username" or "userid", but instead provides a 228 relatively safe subset of Unicode characters that can be used in 229 existing SASL mechanisms and SASL-using application protocols, and 230 even in most application protocols that do not currently use SASL. 232 A username MUST NOT be zero bytes in length. This rule is to be 233 enforced after any normalization and mapping of code points. 235 In protocols that provide usernames as input to a cryptographic 236 algorithm such as a hash function, the client will need to perform 237 proper preparation of the username before applying the algorithm. 239 This specification defines two profiles for usernames: one that 240 performs case mapping and one that performs case preservation (see 241 further discussion under Section 3.4). 243 3.2. UsernameCaseMapped Profile 245 The definition of the UsernameCaseMapped profile of the 246 IdentifierClass is provided in the following sections, including 247 detailed information about preparation, enforcement, and comparison 248 (on the distinction between these actions, refer to 249 [I-D.ietf-precis-framework]). 251 3.2.1. Preparation 253 An entity that prepares a string according to this profile MUST 254 ensure that the string consists only of Unicode code points that 255 conform to the "IdentifierClass" base string class defined in 256 [I-D.ietf-precis-framework]. In addition, the string MUST be encoded 257 as UTF-8 [RFC3629]. 259 3.2.2. Enforcement 261 An entity that performs enforcement according to this profile MUST 262 prepare a string as described in the previous section and MUST also 263 apply the rules specified below for the UsernameCaseMapped profile 264 (these rules MUST be applied in the order shown). 266 1. Width Mapping Rule: Fullwidth and halfwidth characters MUST be 267 mapped to their decomposition mappings (see Unicode Standard 268 Annex #11 [UAX11]). 270 2. Additional Mapping Rule: There is no additional mapping rule. 272 3. Case Mapping Rule: Uppercase and titlecase characters MUST be 273 mapped to their lowercase equivalents, preferably using Unicode 274 Default Case Folding as defined in the Unicode Standard [Unicode] 275 (at the time of this writing, the algorithm is specified in 276 Chapter 3 of [Unicode7.0]); see further discussion in 277 Section 3.4. 279 4. Normalization Rule: Unicode Normalization Form C (NFC) MUST be 280 applied to all characters. 282 5. Directionality Rule: Applications MUST apply the "Bidi Rule" 283 defined in [RFC5893] to strings that contain right-to-left 284 characters (i.e., each of the six conditions of the Bidi Rule 285 must be satisfied). 287 3.2.3. Comparison 289 An entity that performs comparison of two strings according to this 290 profile MUST prepare each string and enforce the rules specified in 291 the previous two sections. The two strings are to be considered 292 equivalent if they are an exact octet-for-octet match (sometimes 293 called "bit-string identity"). 295 3.3. UsernameCasePreserved Profile 297 The definition of the UsernameCasePreserved profile of the 298 IdentifierClass is provided in the following sections, including 299 detailed information about preparation, enforcement, and comparison 300 (on the distinction between these actions, refer to 301 [I-D.ietf-precis-framework]). 303 3.3.1. Preparation 305 An entity that prepares a string according to this profile MUST 306 ensure that the string consists only of Unicode code points that 307 conform to the "IdentifierClass" base string class defined in 308 [I-D.ietf-precis-framework]. In addition, the string MUST be encoded 309 as UTF-8 [RFC3629]. 311 3.3.2. Enforcement 313 An entity that performs enforcement according to this profile MUST 314 prepare a string as described in the previous section and MUST also 315 apply the rules specified below for the UsernameCasePreserved profile 316 (these rules MUST be applied in the order shown). 318 1. Width Mapping Rule: Fullwidth and halfwidth characters MUST be 319 mapped to their decomposition mappings (see Unicode Standard 320 Annex #11 [UAX11]). 322 2. Additional Mapping Rule: There is no additional mapping rule. 324 3. Case Mapping Rule: Uppercase and titlecase characters MUST NOT be 325 mapped to their lowercase equivalents; see further discussion in 326 Section 3.4. 328 4. Normalization Rule: Unicode Normalization Form C (NFC) MUST be 329 applied to all characters. 331 5. Directionality Rule: Applications MUST apply the "Bidi Rule" 332 defined in [RFC5893] to strings that contain right-to-left 333 characters (i.e., each of the six conditions of the Bidi Rule 334 must be satisfied). 336 3.3.3. Comparison 338 An entity that performs comparison of two strings according to this 339 profile MUST prepare each string and enforce the rules specified in 340 the previous two sections. The two strings are to be considered 341 equivalent if they are an exact octet-for-octet match (sometimes 342 called "bit-string identity"). 344 3.4. Case Mapping vs. Case Preservation 346 In order to accommodate the widest range of username constructs in 347 applications, this document defines two username profiles: 348 UsernameCaseMapped and UsernameCasePreserved. These two profiles 349 differ only in the Case Mapping Rule, and are otherwise identical. 351 Case mapping is a matter for the application protocol, protocol 352 implementation, or end deployment. In general, this document 353 suggests that it is preferable to apply the UsernameCaseMapped 354 profile and therefore perform case mapping, since not doing so can 355 lead to false positives during authentication and authorization (as 356 described in [RFC6943]) and can result in confusion among end users 357 given the prevalence of case mapping in many existing protocols and 358 applications. However, there can be good reasons to apply the 359 UsernameCasePreserved profile and thus not perform case mapping, such 360 as backward compatibility with deployed infrastructure. 362 In particular: 364 o SASL mechanisms that follow the recommendations in this document 365 MUST specify whether and when case mapping is to be applied to 366 authentication identifiers. SASL mechanisms SHOULD delay any case 367 mapping to the last possible moment, such as when doing a lookup 368 by username, username comparisons, or generating a cryptographic 369 salt from a username (if the last possible moment happens on the 370 server, then decisions about case mapping can be a matter of 371 deployment policy). In keeping with [RFC4422], SASL mechanisms 372 are not to apply this or any other profile to authorization 373 identifiers. 375 o Application protocols that use SASL (such as IMAP [RFC3501] and 376 XMPP [RFC6120]) and that directly re-use this profile MUST specify 377 whether case mapping is to be applied to authorization 378 identifiers. Such "SASL application protocols" SHOULD delay any 379 case mapping of authorization identifiers to the last possible 380 moment, which happens to necessarily be on the server side (this 381 enables decisions about case mapping to be a matter of deployment 382 policy). In keeping with [RFC4422], SASL application protocols 383 are not to apply this or any other profile to authentication 384 identifiers. 386 o Application protocols that do not use SASL (such as HTTP 387 authentication with the Basic and Digest schemes as specified in 388 [I-D.ietf-httpauth-basicauth-update] and 389 [I-D.ietf-httpauth-digest]) but that directly re-use this profile 390 MUST specify whether and when case mapping is to be applied to 391 authentication identifiers and authorization identifiers. Such 392 "non-SASL application protocols" SHOULD delay any case mapping to 393 the last possible moment, such as when doing a lookup by username, 394 username comparisons, or generating a cryptographic salt from a 395 username (if the last possible moment happens on the server, then 396 decisions about case mapping can be a matter of deployment 397 policy). 399 If the specification for a SASL mechanism, SASL application protocol, 400 or non-SASL application protocol uses the UsernameCaseMapped profile, 401 it MUST clearly describe whether case mapping is to be applied at the 402 level of the protocol itself, implementations thereof, or service 403 deployments (all of these approaches can be legitimate depending on 404 the application in question). 406 3.5. Application-Layer Constructs 408 Both the UsernameCaseMapped and UsernameCasePreserved profiles enable 409 an application protocol, implementation, or deployment to create 410 application-layer constructs such as a space-separated set of names 411 like "Firstname Middlename Lastname". Although such a construct is 412 not a PRECIS profile (since U+0020 SPACE is not allowed in the 413 IdentifierClass), it can be created at the application layer because 414 U+0020 SPACE can be used as a separator between instances of the 415 PRECIS IdentifierClass (or a profile thereof). 417 3.6. Examples 419 The following examples illustrate a small number of userparts (not 420 usernames) that are consistent with the format defined above (note 421 that the characters < and > are used here to delineate the actual 422 userparts and are not part of the userpart strings). 424 Table 1: A sample of legal userparts 426 +--------------------------+---------------------------------+ 427 | # | Userpart | Notes | 428 +--------------------------+---------------------------------+ 429 | 1 | | The at-sign is allowed in the | 430 | | | PRECIS IdentifierClass | 431 +--------------------------+---------------------------------+ 432 | 2 | | | 433 +--------------------------+---------------------------------+ 434 | 3 | | The third character is LATIN | 435 | | | SMALL LETTER SHARP S (U+00DF) | 436 +--------------------------+---------------------------------+ 437 | 4 | <π> | A userpart of GREEK SMALL | 438 | | | LETTER PI (U+03C0) | 439 +--------------------------+---------------------------------+ 440 | 5 | <Σ> | A userpart of GREEK CAPITAL | 441 | | | LETTER SIGMA (U+03A3) | 442 +--------------------------+---------------------------------+ 443 | 6 | <σ> | A userpart of GREEK SMALL | 444 | | | LETTER SIGMA (U+03C3) | 445 +--------------------------+---------------------------------+ 446 | 7 | <ς> | A userpart of GREEK SMALL | 447 | | | LETTER FINAL SIGMA (U+03C2) | 448 +--------------------------+---------------------------------+ 450 Several points are worth noting. Regarding examples 2 and 3: 451 although in German the character eszett (LATIN SMALL LETTER SHARP S, 452 U+00DF) can mostly be used interchangeably with the two characters 453 "ss", the userparts in these examples are different and (if desired) 454 a server would need to enforce a registration policy that disallows 455 one of them if the other is registered. Regarding examples 5, 6, and 456 7: optional case-mapping of GREEK CAPITAL LETTER SIGMA (U+03A3) to 457 lowercase (i.e., to GREEK SMALL LETTER SIGMA, U+03C3) during 458 comparison would result in matching the userparts in examples 5 and 459 6; however, because the PRECIS mapping rules do not account for the 460 special status of GREEK SMALL LETTER FINAL SIGMA (U+03C2), the 461 userparts in examples 5 and 7 or examples 6 and 7 would not be 462 matched during comparison. 464 The following examples illustrate strings that are not valid 465 userparts (not usernames) because they violate the format defined 466 above. 468 Table 2: A sample of strings that violate the userpart rule 470 +--------------------------+---------------------------------+ 471 | # | Non-Userpart string | Notes | 472 +--------------------------+---------------------------------+ 473 | 8 | | Space (U+0020) is disallowed in | 474 | | | the userpart | 475 +--------------------------+---------------------------------+ 476 | 9 | <> | Zero-length userpart | 477 +--------------------------+---------------------------------+ 478 | 10| | The sixth character is ROMAN | 479 | | | NUMERAL FOUR (U+2163) | 480 +--------------------------+---------------------------------+ 481 | 11| <♚> | A localpart of BLACK CHESS KING | 482 | | | (U+265A) | 483 +--------------------------+---------------------------------+ 485 Here again, several points are worth noting. Regarding example 10, 486 the Unicode character ROMAN NUMERAL FOUR (U+2163) has a compatibility 487 equivalent of the string formed of LATIN CAPITAL LETTER I (U+0049) 488 and LATIN CAPITAL LETTER V (U+0056), but characters with 489 compatibility equivalents are not allowed in the PRECIS 490 IdentiferClass. Regarding example 11: symbol characters such as 491 BLACK CHESS KING (U+265A) are not allowed in the PRECIS 492 IdentifierClass. 494 4. Passwords 496 4.1. Definition 498 This document specifies that a password is a string of Unicode code 499 points [Unicode], encoded using UTF-8 [RFC3629], and conformant to 500 OpaqueString profile of the PRECIS FreeformClass specified below. 502 The syntax for a password is defined as follows using the Augmented 503 Backus-Naur Form (ABNF) [RFC5234]. 505 password = 1*(freebyte) 506 ; 507 ; a "freebyte" is a byte used to represent a 508 ; UTF-8 encoded Unicode code point that can be 509 ; contained in a string that conforms to the 510 ; PRECIS "FreeformClass" 511 ; 513 All code points and blocks not explicitly allowed in the PRECIS 514 FreeformClass are disallowed; this includes private use characters, 515 surrogate code points, and the other code points and blocks defined 516 as "Prohibited Output" in Section 2.3 of RFC 4013. 518 A password MUST NOT be zero bytes in length. This rule is to be 519 enforced after any normalization and mapping of code points. 521 Note: The prohibition on zero-length passwords is not a 522 recommendation regarding password strength (since a password of 523 only one byte is highly insecure), but is meant to prevent 524 applications from omitting a password entirely. 526 In protocols that provide passwords as input to a cryptographic 527 algorithm such as a hash function, the client will need to perform 528 proper preparation of the password before applying the algorithm, 529 since the password is not available to the server in plaintext form. 531 4.2. OpaqueString Profile 533 The definition of the OpaqueString profile is provided in the 534 following sections, including detailed information about preparation, 535 enforcement, and comparison (on the distinction between these 536 actions, refer to [I-D.ietf-precis-framework]). 538 4.2.1. Preparation 540 An entity that prepares a string according to this profile MUST 541 ensure that the string consists only of Unicode code points that 542 conform to the "FreeformClass" base string class defined in 543 [I-D.ietf-precis-framework]. In addition, the string MUST be encoded 544 as UTF-8 [RFC3629]. 546 4.2.2. Enforcement 548 An entity that performs enforcement according to this profile MUST 549 prepare a string as described in the previous section and MUST also 550 apply the rules specified below (these rules MUST be applied in the 551 order shown). 553 1. Width Mapping Rule: Fullwidth and halfwidth characters MUST NOT 554 be mapped to their decomposition mappings (see Unicode Standard 555 Annex #11 [UAX11]). 557 2. Additional Mapping Rule: Any instances of non-ASCII space MUST be 558 mapped to ASCII space (U+0020); a non-ASCII space is any Unicode 559 code point having a general category of "Zs", naturally with the 560 exception of U+0020. 562 3. Case Mapping Rule: Uppercase and titlecase characters MUST NOT be 563 mapped to their lowercase equivalents. 565 4. Normalization Rule: Unicode Normalization Form C (NFC) MUST be 566 applied to all characters. 568 5. Directionality Rule: There is no directionality rule. The "Bidi 569 Rule" (defined in [RFC5893]) and similar rules are unnecessary 570 and inapplicable to passwords, since they can reduce the range of 571 characters that are allowed in a string and therefore reduce the 572 amount of entropy that is possible in a password. Such rules are 573 intended to minimize the possibility that the same string will be 574 displayed differently on a layout system set for right-to-left 575 display and a layout system set for left-to-right display; 576 however, passwords are typically not displayed at all and are 577 rarely meant to be interoperable across different layout systems 578 in the way that non-secret strings like domain names and 579 usernames are. Furthermore, it is perfectly acceptable for 580 opaque strings other than passwords to be presented differently 581 in different layout systems, as long as the presentation is 582 consistent in any given layout system. 584 4.2.3. Comparison 586 An entity that performs comparison of two strings according to this 587 profile MUST prepare each string and enforce the rules specified in 588 the previous two sections. The two strings are to be considered 589 equivalent if they are an exact octet-for-octet match (sometimes 590 called "bit-string identity"). 592 4.3. Examples 594 The following examples illustrate a small number of passwords that 595 are consistent with the format defined above (note that the 596 characters < and > are used here to delineate the actual passwords 597 and are not part of the password strings). 599 Table 3: A sample of legal passwords 601 +------------------------------------+------------------------------+ 602 | # | Password | Notes | 603 +------------------------------------+------------------------------+ 604 | 12| | ASCII space is allowed | 605 +------------------------------------+------------------------------+ 606 | 13| | Different from example 12 | 607 +------------------------------------+------------------------------+ 608 | 14| <πßå> | Non-ASCII letters are OK | 609 | | | (e.g., GREEK SMALL LETTER | 610 | | | PI, U+03C0) | 611 +------------------------------------+------------------------------+ 612 | 15| | Symbols are OK (e.g., BLACK | 613 | | | DIAMOND SUIT, U+2666) | 614 +------------------------------------+------------------------------+ 615 | 16| | OGHAM SPACE MARK, U+1680, is | 616 | | | mapped to U+0020 and thus | 617 | | | the full string is mapped to | 618 | | | | 619 +------------------------------------+------------------------------+ 621 The following example illustrates a string that is not a valid 622 password because it violates the format defined above. 624 Table 4: A string that violates the password rules 626 +------------------------------------+------------------------------+ 627 | # | Password | Notes | 628 +------------------------------------+------------------------------+ 629 | 17| | Controls are disallowed | 630 +------------------------------------+------------------------------+ 632 5. Use in Application Protocols 634 This specification defines only the PRECIS-based rules for handling 635 of strings conforming to the UsernameCaseMapped and 636 UsernameCasePreserved profiles of the PRECIS IdentifierClass, and 637 strings conforming to the OpaqueString profile of the PRECIS 638 FreeformClass. It is the responsibility of an application protocol 639 to specify the protocol slots in which such strings can appear, the 640 entities that are expected to enforce the rules governing such 641 strings, and when in protocol processing or interface handling the 642 rules need to be enforced. See Section 6 of 643 [I-D.ietf-precis-framework] for guidelines about using PRECIS 644 profiles in applications. 646 Above and beyond the PRECIS-based rules specified here, application 647 protocols can also define application-specific rules governing such 648 strings (rules regarding minimum or maximum length, further 649 restrictions on allowable characters or character ranges, safeguards 650 to mitigate the effects of visually similar characters, etc.), 651 application-layer constructs (see Section 3.5), and related matters. 653 Some PRECIS profile definitions encourage entities that enforce the 654 rules to be liberal in what they accept. However, for usernames and 655 passwords such a policy can be problematic since it can lead to false 656 positives. An in-depth discussion can be found in "Issues in 657 Identifier Comparison for Security Purposes" [RFC6943]. 659 6. Migration 661 The rules defined in this specification differ slightly from those 662 defined by the SASLprep specification [RFC4013]. The following 663 sections describe these differences, along with their implications 664 for migration, in more detail. 666 6.1. Usernames 668 Deployments that currently use SASLprep for handling usernames might 669 need to scrub existing data when migrating to use of the rules 670 defined in this specification. In particular: 672 o SASLprep specified the use of Unicode Normalization Form KC 673 (NFKC), whereas the UsernameCaseMapped and UsernameCasePreserved 674 profiles employ Unicode Normalization Form C (NFC). In practice 675 this change is unlikely to cause significant problems, because 676 NFKC provides methods for mapping Unicode code points with 677 compatibility equivalents to those equivalents, whereas the PRECIS 678 IdentifierClass entirely disallows Unicode code points with 679 compatibility equivalents (i.e., during comparison NFKC is more 680 "aggressive" about finding matches than NFC). A few examples 681 might suffice to indicate the nature of the problem: 683 1. U+017F LATIN SMALL LETTER LONG S is compatibility equivalent 684 to U+0073 LATIN SMALL LETTER S 686 2. U+2163 ROMAN NUMERAL FOUR is compatibility equivalent to 687 U+0049 LATIN CAPITAL LETTER I and U+0056 LATIN CAPITAL LETTER 688 V 690 3. U+FB01 LATIN SMALL LIGATURE FI is compatibility equivalent to 691 U+0066 LATIN SMALL LETTER F and U+0069 LATIN SMALL LETTER I 693 Under SASLprep, the use of NFKC also handled the mapping of 694 fullwidth and halfwidth code points to their decomposition 695 mappings. Although it is expected that code points with 696 compatibility equivalents are rare in existing usernames, for 697 migration purposes deployments might want to search their database 698 of usernames for Unicode code points with compatibility 699 equivalents and map those code points to their compatibility 700 equivalents. 702 o SASLprep mapped the "characters commonly mapped to nothing" from 703 Appendix B.1 of [RFC3454]) to nothing, whereas the PRECIS 704 IdentifierClass entirely disallows most of these characters, which 705 correspond to the code points from the "M" category defined under 706 Section 8.13 of [I-D.ietf-precis-framework] (with the exception of 707 U+1806 MONGOLIAN TODO SOFT HYPHEN, which was "commonly mapped to 708 nothing" in Unicode 3.2 but at the time of this writing does not 709 have a derived property of Default_Ignorable_Code_Point in Unicode 710 7.0). For migration purposes, deployments might want to remove 711 code points contained in the PRECIS "M" category from usernames. 713 o SASLprep allowed uppercase and titlecase characters, whereas the 714 UsernameCaseMapped profile maps uppercase and titlecase characters 715 to their lowercase equivalents (by contrast, the 716 UsernameCasePreserved profile matches SASLprep in this regard). 717 For migration purposes, deployments can either use the 718 UsernameCaseMapped profile (thus losing the case information) or 719 use the UsernameCasePreserved profile (thus ignoring case 720 difference when comparing usernames). 722 6.2. Passwords 724 Depending on local service policy, migration from RFC 4013 to this 725 specification might not involve any scrubbing of data (since 726 passwords might not be stored in the clear anyway); however, service 727 providers need to be aware of possible issues that might arise during 728 migration. In particular: 730 o SASLprep specified the use of Unicode Normalization Form KC 731 (NFKC), whereas the OpaqueString profile employs Unicode 732 Normalization Form C (NFC). Because NFKC is more aggressive about 733 finding matches than NFC, in practice this change is unlikely to 734 cause significant problems and indeed has the security benefit of 735 probably resulting in fewer false positives when comparing 736 passwords. A few examples might suffice to indicate the nature of 737 the problem: 739 1. U+017F LATIN SMALL LETTER LONG S is compatibility equivalent 740 to U+0073 LATIN SMALL LETTER S 742 2. U+2163 ROMAN NUMERAL FOUR is compatibility equivalent to 743 U+0049 LATIN CAPITAL LETTER I and U+0056 LATIN CAPITAL LETTER 744 V 746 3. U+FB01 LATIN SMALL LIGATURE FI is compatibility equivalent to 747 U+0066 LATIN SMALL LETTER F and U+0069 LATIN SMALL LETTER I 749 Under SASLprep, the use of NFKC also handled the mapping of 750 fullwidth and halfwidth code points to their decomposition 751 mappings. Although it is expected that code points with 752 compatibility equivalents are rare in existing passwords, some 753 passwords that matched when SASLprep was used might no longer work 754 when the rules in this specification are applied. 756 o SASLprep mapped the "characters commonly mapped to nothing" from 757 Appendix B.1 of [RFC3454]) to nothing, whereas the PRECIS 758 FreeformClass entirely disallows such characters, which correspond 759 to the code points from the "M" category defined under 760 Section 8.13 of [I-D.ietf-precis-framework] (with the exception of 761 U+1806 MONGOLIAN TODO SOFT HYPHEN, which was commonly mapped to 762 nothing in Unicode 3.2 but at the time of this writing is allowed 763 by Unicode 7.0). In practice, this change will probably have no 764 effect on comparison, but user-oriented software might reject such 765 code points instead of ignoring them during password preparation. 767 7. IANA Considerations 769 The IANA shall add the following entries to the PRECIS Profiles 770 Registry. 772 7.1. UsernameCaseMapped Profile 774 Name: UsernameCaseMapped. 776 Base Class: IdentifierClass. 778 Applicability: Usernames in security and application protocols. 780 Replaces: The SASLprep profile of Stringprep. 782 Width Mapping Rule: Map fullwidth and halfwidth characters to their 783 decomposition mappings. 785 Additional Mapping Rule: None. 787 Case Mapping Rule: Map uppercase and titlecase characters to 788 lowercase. 790 Normalization Rule: NFC. 792 Directionality Rule: The "Bidi Rule" defined in RFC 5893 applies. 794 Enforcement: To be defined by security or application protocols that 795 use this profile. 797 Specification: RFC XXXX, Section 3.2. [Note to RFC Editor: please 798 change XXXX to the number issued for this specification.] 800 7.2. UsernameCasePreserved Profile 802 Name: UsernameCasePreserved. 804 Base Class: IdentifierClass. 806 Applicability: Usernames in security and application protocols. 808 Replaces: The SASLprep profile of Stringprep. 810 Width Mapping Rule: Map fullwidth and halfwidth characters to their 811 decomposition mappings. 813 Additional Mapping Rule: None. 815 Case Mapping Rule: None. 817 Normalization Rule: NFC. 819 Directionality Rule: The "Bidi Rule" defined in RFC 5893 applies. 821 Enforcement: To be defined by security or application protocols that 822 use this profile. 824 Specification: RFC XXXX, Section 3.3. [Note to RFC Editor: please 825 change XXXX to the number issued for this specification.] 827 7.3. OpaqueString Profile 829 Name: OpaqueString. 831 Base Class: FreeformClass. 833 Applicability: Passwords and other opaque strings in security and 834 application protocols. 836 Replaces: The SASLprep profile of Stringprep. 838 Width Mapping Rule: None. 840 Additional Mapping Rule: Map non-ASCII space characters to ASCII 841 space. 843 Case Mapping Rule: None. 845 Normalization Rule: NFC. 847 Directionality Rule: None. 849 Enforcement: To be defined by security or application protocols that 850 use this profile. 852 Specification: RFC XXXX, Section 4.2. [Note to RFC Editor: please 853 change XXXX to the number issued for this specification.] 855 8. Security Considerations 857 8.1. Password/Passphrase Strength 859 The ability to include a wide range of characters in passwords and 860 passphrases can increase the potential for creating a strong password 861 with high entropy. However, in practice, the ability to include such 862 characters ought to be weighed against the possible need to reproduce 863 them on various devices using various input methods. 865 8.2. Identifier Comparison 867 The process of comparing identifiers (such as SASL simple user names, 868 authentication identifiers, and authorization identifiers) can lead 869 to either false negatives or false positives, both of which have 870 security implications. A more detailed discussion can be found in 871 [RFC6943]. 873 8.3. Reuse of PRECIS 875 The security considerations described in [I-D.ietf-precis-framework] 876 apply to the "IdentifierClass" and "FreeformClass" base string 877 classes used in this document for usernames and passwords, 878 respectively. 880 8.4. Reuse of Unicode 882 The security considerations described in [UTS39] apply to the use of 883 Unicode characters in usernames and passwords. 885 9. References 887 9.1. Normative References 889 [I-D.ietf-precis-framework] 890 Saint-Andre, P. and M. Blanchet, "Precis Framework: 891 Handling Internationalized Strings in Protocols", draft- 892 ietf-precis-framework-23 (work in progress), February 893 2015. 895 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 896 Requirement Levels", BCP 14, RFC 2119, March 1997. 898 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 899 10646", STD 63, RFC 3629, November 2003. 901 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 902 Specifications: ABNF", STD 68, RFC 5234, January 2008. 904 [RFC5890] Klensin, J., "Internationalized Domain Names for 905 Applications (IDNA): Definitions and Document Framework", 906 RFC 5890, August 2010. 908 [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in 909 Internationalization in the IETF", BCP 166, RFC 6365, 910 September 2011. 912 [UAX11] The Unicode Consortium, "Unicode Standard Annex #11: East 913 Asian Width", September 2012, 914 . 916 [Unicode7.0] 917 The Unicode Consortium, "The Unicode Standard, Version 918 7.0.0", 2014, 919 . 921 [Unicode] The Unicode Consortium, "The Unicode Standard", 922 2015-present, . 924 9.2. Informative References 926 [I-D.ietf-httpauth-basicauth-update] 927 Reschke, J., "The 'Basic' HTTP Authentication Scheme", 928 draft-ietf-httpauth-basicauth-update-07 (work in 929 progress), February 2015. 931 [I-D.ietf-httpauth-digest] 932 Shekh-Yusef, R., Ahrens, D., and S. Bremer, "HTTP Digest 933 Access Authentication", draft-ietf-httpauth-digest-19 934 (work in progress), April 2015. 936 [I-D.ietf-xmpp-6122bis] 937 Saint-Andre, P., "Extensible Messaging and Presence 938 Protocol (XMPP): Address Format", draft-ietf-xmpp- 939 6122bis-22 (work in progress), May 2015. 941 [RFC20] Cerf, V., "ASCII format for network interchange", RFC 20, 942 October 1969. 944 [RFC3454] Hoffman, P. and M. Blanchet, "Preparation of 945 Internationalized Strings ("stringprep")", RFC 3454, 946 December 2002. 948 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 949 4rev1", RFC 3501, March 2003. 951 [RFC4013] Zeilenga, K., "SASLprep: Stringprep Profile for User Names 952 and Passwords", RFC 4013, February 2005. 954 [RFC4422] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple 955 Authentication and Security Layer (SASL)", RFC 4422, June 956 2006. 958 [RFC4616] Zeilenga, K., "The PLAIN Simple Authentication and 959 Security Layer (SASL) Mechanism", RFC 4616, August 2006. 961 [RFC5802] Newman, C., Menon-Sen, A., Melnikov, A., and N. Williams, 962 "Salted Challenge Response Authentication Mechanism 963 (SCRAM) SASL and GSS-API Mechanisms", RFC 5802, July 2010. 965 [RFC5891] Klensin, J., "Internationalized Domain Names in 966 Applications (IDNA): Protocol", RFC 5891, August 2010. 968 [RFC5893] Alvestrand, H. and C. Karp, "Right-to-Left Scripts for 969 Internationalized Domain Names for Applications (IDNA)", 970 RFC 5893, August 2010. 972 [RFC5894] Klensin, J., "Internationalized Domain Names for 973 Applications (IDNA): Background, Explanation, and 974 Rationale", RFC 5894, August 2010. 976 [RFC6120] Saint-Andre, P., "Extensible Messaging and Presence 977 Protocol (XMPP): Core", RFC 6120, March 2011. 979 [RFC6122] Saint-Andre, P., "Extensible Messaging and Presence 980 Protocol (XMPP): Address Format", RFC 6122, March 2011. 982 [RFC6943] Thaler, D., "Issues in Identifier Comparison for Security 983 Purposes", RFC 6943, May 2013. 985 [RFC7542] DeKok, A., "The Network Access Identifier", RFC 7542, May 986 2015. 988 [UTS39] The Unicode Consortium, "Unicode Technical Standard #39: 989 Unicode Security Mechanisms", July 2012, 990 . 992 Appendix A. Differences from RFC 4013 994 This document builds upon the PRECIS framework defined in 995 [I-D.ietf-precis-framework], which differs fundamentally from the 996 stringprep technology [RFC3454] used in SASLprep [RFC4013]. The 997 primary difference is that stringprep profiles allowed all characters 998 except those which were explicitly disallowed, whereas PRECIS 999 profiles disallow all characters except those which are explicitly 1000 allowed (this "inclusion model" was originally used for 1001 internationalized domain names in [RFC5891]; see [RFC5894] for 1002 further discussion). It is important to keep this distinction in 1003 mind when comparing the technology defined in this document to 1004 SASLprep [RFC4013]. 1006 The following substantive modifications were made from RFC 4013. 1008 o A single SASLprep algorithm was replaced by three separate 1009 algorithms: one for usernames with case mapping, one for usernames 1010 with case preservation, and one for passwords. 1012 o The new preparation algorithms use PRECIS instead of a stringprep 1013 profile. The new algorithms work independenctly of Unicode 1014 versions. 1016 o As recommended in the PRECIS framework, changed the Unicode 1017 normalization form from NFKC to NFC. 1019 o Some Unicode code points that were mapped to nothing in RFC 4013 1020 are simply disallowed by PRECIS. 1022 Appendix B. Acknowledgements 1024 This document borrows some text from [RFC4013] and [RFC6120]. 1026 The following individuals provided helpful feedback on this document: 1027 Marc Blanchet, Ben Campbell, Alan DeKok, Joe Hildebrand, Jeffrey 1028 Hutzelman, Simon Josefsson, Jonathan Lennox, James Manger, Matt 1029 Miller, Chris Newman, Yutaka OIWA, Pete Resnick, Andrew Sullivan, 1030 Nico Williams, and Yoshiro YONEYA. Nico Williams in particular 1031 deserves special recognition for providing text that was used in 1032 Section 3.4. Thanks also to Takahiro NEMOTO and Yoshiro YONEYA for 1033 implementation feedback. 1035 Robert Sparks and Derek Atkins reviewed the document on behalf of the 1036 General Area Review Team and the Security Directorate, respectively. 1038 Peter Saint-Andre wishes to acknowledge Cisco Systems, Inc., for 1039 employing him during his work on earlier draft versions of this 1040 document. 1042 Authors' Addresses 1044 Peter Saint-Andre 1045 &yet 1047 Email: peter@andyet.com 1048 URI: https://andyet.com/ 1050 Alexey Melnikov 1051 Isode Ltd 1052 5 Castle Business Village 1053 36 Station Road 1054 Hampton, Middlesex TW12 2BX 1055 UK 1057 Email: Alexey.Melnikov@isode.com