idnits 2.17.1 draft-ietf-precis-saslprepbis-15.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 (April 14, 2015) is 3272 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) -- Possible downref: Non-RFC (?) normative reference: ref. 'Unicode' == Outdated reference: A later version (-19) exists of draft-ietf-httpauth-digest-18 -- 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) Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 6 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: October 16, 2015 April 14, 2015 8 Preparation, Enforcement, and Comparison of Internationalized Strings 9 Representing Usernames and Passwords 10 draft-ietf-precis-saslprepbis-15 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 October 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 . . . . . . . . . . . . . . . . . . . . . . . . . . 4 63 3.1. Definition . . . . . . . . . . . . . . . . . . . . . . . 4 64 3.2. UsernameCaseMapped Profile . . . . . . . . . . . . . . . 5 65 3.2.1. Preparation . . . . . . . . . . . . . . . . . . . . . 6 66 3.2.2. Enforcement . . . . . . . . . . . . . . . . . . . . . 6 67 3.2.3. Comparison . . . . . . . . . . . . . . . . . . . . . 6 68 3.3. UsernameCasePreserved Profile . . . . . . . . . . . . . . 6 69 3.3.1. Preparation . . . . . . . . . . . . . . . . . . . . . 7 70 3.3.2. Enforcement . . . . . . . . . . . . . . . . . . . . . 7 71 3.3.3. Comparison . . . . . . . . . . . . . . . . . . . . . 7 72 3.4. Case Mapping vs. Case Preservation . . . . . . . . . . . 7 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., email addresses and 144 LDAP distinguished names), nor in cases where identifiers or secrets 145 are not strings (e.g., keys and certificates) or require specialized 146 handling. 148 This document obsoletes RFC 4013 (the "SASLprep" profile of 149 stringprep [RFC3454]) but can be used by technologies other than the 150 Simple Authentication and Security Layer (SASL) [RFC4422], such as 151 HTTP authentication as specified in 152 [I-D.ietf-httpauth-basicauth-update] and [I-D.ietf-httpauth-digest]. 154 2. Terminology 156 Many important terms used in this document are defined in 157 [I-D.ietf-precis-framework], [RFC5890], [RFC6365], and [Unicode]. 158 The term "non-ASCII space" refers to any Unicode code point having a 159 general category of "Zs", with the exception of U+0020 (here called 160 "ASCII space"). 162 As used here, the term "password" is not literally limited to a word; 163 i.e., a password could be a passphrase consisting of more than one 164 word, perhaps separated by spaces, punctuation, or other non- 165 alphanumeric characters. 167 Some SASL mechanisms (e.g., CRAM-MD5, DIGEST-MD5, and SCRAM) specify 168 that the authentication identity used in the context of such 169 mechanisms is a "simple user name" (see Section 2 of [RFC4422] as 170 well as [RFC4013]). Various application technologies also assume 171 that the identity of a user or account takes the form of a username 172 (e.g., authentication for the HyperText Transfer Protocol as 173 specified in [I-D.ietf-httpauth-basicauth-update] and 174 [I-D.ietf-httpauth-digest]), whether or not they use SASL. Note well 175 that the exact form of a username in any particular SASL mechanism or 176 application technology is a matter for implementation and deployment, 177 and that a username does not necessarily map to any particular 178 application identifier (such as the localpart of an email address). 180 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 181 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 182 "OPTIONAL" in this document are to be interpreted as described in 183 [RFC2119]. 185 3. Usernames 187 3.1. Definition 189 This document specifies that a username is a string of Unicode code 190 points [Unicode], encoded using UTF-8 [RFC3629], and structured as an 191 ordered sequence of "userparts" (where the complete username can 192 consist of a single userpart or a space-separated sequence of 193 userparts). 195 The syntax for a username is defined as follows using the Augmented 196 Backus-Naur Form (ABNF) [RFC5234]. 198 username = userpart *(1*SP userpart) 199 userpart = 1*(idbyte) 200 ; 201 ; an "idbyte" is a byte used to represent a 202 ; UTF-8 encoded Unicode code point that can be 203 ; contained in a string that conforms to the 204 ; PRECIS "IdentifierClass" 205 ; 207 All code points and blocks not explicitly allowed in the PRECIS 208 IdentifierClass are disallowed; this includes private use characters, 209 surrogate code points, and the other code points and blocks that were 210 defined as "Prohibited Output" in [RFC4013]. In addition, common 211 constructions such as "user@example.com" (e.g., the Network Access 212 Identifier from [I-D.ietf-radext-nai]) are allowed as usernames under 213 this specification, as they were under [RFC4013]. 215 Implementation Note: The username construct defined in this 216 document does not necessarily match what all deployed applications 217 might refer to as a "username" or "userid", but instead provides a 218 relatively safe subset of Unicode characters that can be used in 219 existing SASL mechanisms and SASL-using application protocols, and 220 even in most application protocols that do not currently use SASL. 222 A username MUST NOT be zero bytes in length. This rule is to be 223 enforced after any normalization and mapping of code points. 225 In protocols that provide usernames as input to a cryptographic 226 algorithm such as a hash function, the client will need to perform 227 proper preparation of the username before applying the algorithm. 229 This specification defines two profiles for usernames: one that 230 performs case mapping and one that performs case preservation (see 231 further discussion under Section 3.4). 233 3.2. UsernameCaseMapped Profile 235 The definition of the UsernameCaseMapped profile of the 236 IdentifierClass is provided in the following sections, including 237 detailed information about preparation, enforcement, and comparison 238 (on the distinction between these actions, refer to 239 [I-D.ietf-precis-framework]). 241 3.2.1. Preparation 243 An entity that prepares a string according to this profile MUST 244 ensure that the string consists only of Unicode code points that 245 conform to the "IdentifierClass" base string class defined in 246 [I-D.ietf-precis-framework]. In addition, the string MUST be encoded 247 as UTF-8 [RFC3629]. 249 3.2.2. Enforcement 251 An entity that performs enforcement according to this profile MUST 252 prepare a string as described in the previous section and MUST also 253 apply the rules specified below for the UsernameCaseMapped profile 254 (these rules MUST be applied in the order shown). 256 1. Width Mapping Rule: Fullwidth and halfwidth characters MUST be 257 mapped to their decomposition mappings. 259 2. Additional Mapping Rule: There is no additional mapping rule. 261 3. Case Mapping Rule: Uppercase and titlecase characters MUST be 262 mapped to their lowercase equivalents, preferably using Unicode 263 Default Case Folding as defined in the Unicode Standard [Unicode] 264 (at the time of this writing, the algorithm is specified in 265 Chapter 3 of [Unicode7.0]). 267 4. Normalization Rule: Unicode Normalization Form C (NFC) MUST be 268 applied to all characters. 270 5. Directionality Rule: Applications MUST apply the "Bidi Rule" 271 defined in [RFC5893] to strings that contain right-to-left 272 characters (i.e., each of the six conditions of the Bidi Rule 273 must be satisfied). 275 3.2.3. Comparison 277 An entity that performs comparison of two strings according to this 278 profile MUST prepare each string and enforce the rules specified in 279 the previous two sections. The two strings are to be considered 280 equivalent if they are an exact octet-for-octet match (sometimes 281 called "bit-string identity"). 283 3.3. UsernameCasePreserved Profile 285 The definition of the UsernameCasePreserved profile of the 286 IdentifierClass is provided in the following sections, including 287 detailed information about preparation, enforcement, and comparison 288 (on the distinction between these actions, refer to 289 [I-D.ietf-precis-framework]). 291 3.3.1. Preparation 293 An entity that prepares a string according to this profile MUST 294 ensure that the string consists only of Unicode code points that 295 conform to the "IdentifierClass" base string class defined in 296 [I-D.ietf-precis-framework]. In addition, the string MUST be encoded 297 as UTF-8 [RFC3629]. 299 3.3.2. Enforcement 301 An entity that performs enforcement according to this profile MUST 302 prepare a string as described in the previous section and MUST also 303 apply the rules specified below for the UsernameCasePreserved profile 304 (these rules MUST be applied in the order shown). 306 1. Width Mapping Rule: Fullwidth and halfwidth characters MUST be 307 mapped to their decomposition mappings. 309 2. Additional Mapping Rule: There is no additional mapping rule. 311 3. Case Mapping Rule: Uppercase and titlecase characters MUST NOT be 312 mapped to their lowercase equivalents. 314 4. Normalization Rule: Unicode Normalization Form C (NFC) MUST be 315 applied to all characters. 317 5. Directionality Rule: Applications MUST apply the "Bidi Rule" 318 defined in [RFC5893] to strings that contain right-to-left 319 characters (i.e., each of the six conditions of the Bidi Rule 320 must be satisfied). 322 3.3.3. Comparison 324 An entity that performs comparison of two strings according to this 325 profile MUST prepare each string and enforce the rules specified in 326 the previous two sections. The two strings are to be considered 327 equivalent if they are an exact octet-for-octet match (sometimes 328 called "bit-string identity"). 330 3.4. Case Mapping vs. Case Preservation 332 In order to accommodate the widest range of username constructs in 333 applications, this document defines two username profiles: 334 UsernameCaseMapped and UsernameCasePreserved. These two profiles 335 differ only in the Case Mapping Rule, and are otherwise identical. 337 Case mapping is a matter for the application protocol, protocol 338 implementation, or end deployment. In general, this document 339 suggests that it is preferable to apply the UsernameCaseMapped 340 profile and therefore perform case mapping, since not doing so can 341 lead to false positives during authentication and authorization (as 342 described in [RFC6943]) and can result in confusion among end users 343 given the prevalence of case mapping in many existing protocols and 344 applications. However, there can be good reasons to apply the 345 UsernameCasePreserved profile and thus not perform case mapping, such 346 as backward compatibility with deployed infrastructure. 348 In particular: 350 o SASL mechanisms that follow the recommendations in this document 351 MUST specify whether and when case mapping is to be applied to 352 authentication identifiers. SASL mechanisms SHOULD delay any case 353 mapping to the last possible moment, such as when doing a lookup 354 by username, username comparisons, or generating a cryptographic 355 salt from a username (if the last possible moment happens on the 356 server, then decisions about case mapping can be a matter of 357 deployment policy). In keeping with [RFC4422], SASL mechanisms 358 are not to apply this or any other profile to authorization 359 identifiers. 361 o Application protocols that use SASL (such as IMAP [RFC3501] and 362 XMPP [RFC6120]) and that directly re-use this profile MUST specify 363 whether case mapping is to be applied to authorization 364 identifiers. Such "SASL application protocols" SHOULD delay any 365 case mapping of authorization identifiers to the last possible 366 moment, which happens to necessarily be on the server side (this 367 enables decisions about case mapping to be a matter of deployment 368 policy). In keeping with [RFC4422], SASL application protocols 369 are not to apply this or any other profile to authentication 370 identifiers. 372 o Application protocols that do not use SASL (such as HTTP 373 authentication with the Basic and Digest schemes as specified in 374 [I-D.ietf-httpauth-basicauth-update] and 375 [I-D.ietf-httpauth-digest]) but that directly re-use this profile 376 MUST specify whether and when case mapping is to be applied to 377 authentication identifiers and authorization identifiers. Such 378 "non-SASL application protocols" SHOULD delay any case mapping to 379 the last possible moment, such as when doing a lookup by username, 380 username comparisons, or generating a cryptographic salt from a 381 username (if the last possible moment happens on the server, then 382 decisions about case mapping can be a matter of deployment 383 policy). 385 If the specification for a SASL mechanism, SASL application protocol, 386 or non-SASL application protocol uses the UsernameCaseMapped profile, 387 it MUST clearly describe whether case mapping is to be applied at the 388 level of the protocol itself, implementations thereof, or service 389 deployments (all of these approaches can be legitimate depending on 390 the application in question). 392 3.5. Application-Layer Constructs 394 Both the UsernameCaseMapped and UsernameCasePreserved profiles enable 395 an application protocol, implementation, or deployment to create 396 application-layer constructs such as a space-separated set of names 397 like "Firstname Middlename Lastname". Although such a construct is 398 not a PRECIS profile (since U+0020 SPACE is not allowed in the 399 IdentifierClass), it can be created at the application layer because 400 U+0020 SPACE can be used as a separator between instances of the 401 PRECIS IdentifierClass (or a profile thereof). 403 3.6. Examples 405 The following examples illustrate a small number of userparts (not 406 usernames) that are consistent with the format defined above (note 407 that the characters < and > are used here to delineate the actual 408 userparts and are not part of the userpart strings). 410 Table 1: A sample of legal userparts 412 +--------------------------+---------------------------------+ 413 | # | Userpart | Notes | 414 +--------------------------+---------------------------------+ 415 | 1 | | The at-sign is allowed in the | 416 | | | PRECIS IdentifierClass | 417 +--------------------------+---------------------------------+ 418 | 2 | | | 419 +--------------------------+---------------------------------+ 420 | 3 | | The third character is LATIN | 421 | | | SMALL LETTER SHARP S (U+00DF) | 422 +--------------------------+---------------------------------+ 423 | 4 | <π> | A userpart of GREEK SMALL | 424 | | | LETTER PI (U+03C0) | 425 +--------------------------+---------------------------------+ 426 | 5 | <Σ> | A userpart of GREEK CAPITAL | 427 | | | LETTER SIGMA (U+03A3) | 428 +--------------------------+---------------------------------+ 429 | 6 | <σ> | A userpart of GREEK SMALL | 430 | | | LETTER SIGMA (U+03C3) | 431 +--------------------------+---------------------------------+ 432 | 7 | <ς> | A userpart of GREEK SMALL | 433 | | | LETTER FINAL SIGMA (U+03C2) | 434 +--------------------------+---------------------------------+ 436 Several points are worth noting. Regarding examples 2 and 3: 437 although in German the character eszett (LATIN SMALL LETTER SHARP S, 438 U+00DF) can mostly be used interchangeably with the two characters 439 "ss", the userparts in these examples are different and (if desired) 440 a server would need to enforce a registration policy that disallows 441 one of them if the other is registered. Regarding examples 5, 6, and 442 7: optional case-mapping of GREEK CAPITAL LETTER SIGMA (U+03A3) to 443 lowercase (i.e., to GREEK SMALL LETTER SIGMA, U+03C3) during 444 comparison would result in matching the userparts in examples 5 and 445 6; however, because the PRECIS mapping rules do not account for the 446 special status of GREEK SMALL LETTER FINAL SIGMA (U+03C2), the 447 userparts in examples 5 and 7 or examples 6 and 7 would not be 448 matched during comparison. 450 The following examples illustrate strings that are not valid 451 userparts (not usernames) because they violate the format defined 452 above. 454 Table 2: A sample of strings that violate the userpart rule 456 +--------------------------+---------------------------------+ 457 | # | Non-Userpart string | Notes | 458 +--------------------------+---------------------------------+ 459 | 8 | | Space (U+0020) is disallowed in | 460 | | | the userpart | 461 +--------------------------+---------------------------------+ 462 | 9 | <> | Zero-length userpart | 463 +--------------------------+---------------------------------+ 464 | 10| | The sixth character is ROMAN | 465 | | | NUMERAL FOUR (U+2163) | 466 +--------------------------+---------------------------------+ 467 | 11| <♚> | A localpart of BLACK CHESS KING | 468 | | | (U+265A) | 469 +--------------------------+---------------------------------+ 471 Here again, several points are worth noting. Regarding example 10, 472 the Unicode character ROMAN NUMERAL FOUR (U+2163) has a compatibility 473 equivalent of the string formed of LATIN CAPITAL LETTER I (U+0049) 474 and LATIN CAPITAL LETTER V (U+0056), but characters with 475 compatibility equivalents are not allowed in the PRECIS 476 IdentiferClass. Regarding example 11: symbol characters such as 477 BLACK CHESS KING (U+265A) are not allowed in the PRECIS 478 IdentifierClass. 480 4. Passwords 482 4.1. Definition 484 This document specifies that a password is a string of Unicode code 485 points [Unicode], encoded using UTF-8 [RFC3629], and conformant to 486 OpaqueString profile of the PRECIS FreeformClass specified below. 488 The syntax for a password is defined as follows using the Augmented 489 Backus-Naur Form (ABNF) [RFC5234]. 491 password = 1*(freebyte) 492 ; 493 ; a "freebyte" is a byte used to represent a 494 ; UTF-8 encoded Unicode code point that can be 495 ; contained in a string that conforms to the 496 ; PRECIS "FreeformClass" 497 ; 499 All code points and blocks not explicitly allowed in the PRECIS 500 FreeformClass are disallowed; this includes private use characters, 501 surrogate code points, and the other code points and blocks defined 502 as "Prohibited Output" in Section 2.3 of RFC 4013. 504 A password MUST NOT be zero bytes in length. This rule is to be 505 enforced after any normalization and mapping of code points. 507 Note: The prohibition on zero-length passwords is not a 508 recommendation regarding password strength (since a password of 509 only one byte is highly insecure), but is meant to prevent 510 applications from omitting a password entirely. 512 In protocols that provide passwords as input to a cryptographic 513 algorithm such as a hash function, the client will need to perform 514 proper preparation of the password before applying the algorithm, 515 since the password is not available to the server in plaintext form. 517 4.2. OpaqueString Profile 519 The definition of the OpaqueString profile is provided in the 520 following sections, including detailed information about preparation, 521 enforcement, and comparison (on the distinction between these 522 actions, refer to [I-D.ietf-precis-framework]). 524 4.2.1. Preparation 526 An entity that prepares a string according to this profile MUST 527 ensure that the string consists only of Unicode code points that 528 conform to the "FreeformClass" base string class defined in 529 [I-D.ietf-precis-framework]. In addition, the string MUST be encoded 530 as UTF-8 [RFC3629]. 532 4.2.2. Enforcement 534 An entity that performs enforcement according to this profile MUST 535 prepare a string as described in the previous section and MUST also 536 apply the rules specified below (these rules MUST be applied in the 537 order shown). 539 1. Width Mapping Rule: Fullwidth and halfwidth characters MUST NOT 540 be mapped to their decomposition mappings. 542 2. Additional Mapping Rule: Any instances of non-ASCII space MUST be 543 mapped to ASCII space (U+0020); a non-ASCII space is any Unicode 544 code point having a general category of "Zs", naturally with the 545 exception of U+0020. 547 3. Case Mapping Rule: Uppercase and titlecase characters MUST NOT be 548 mapped to their lowercase equivalents. 550 4. Normalization Rule: Unicode Normalization Form C (NFC) MUST be 551 applied to all characters. 553 5. Directionality Rule: There is no directionality rule. The "Bidi 554 Rule" (defined in [RFC5893]) and similar rules are unnecessary 555 and inapplicable to passwords, since they can reduce the range of 556 characters that are allowed in a string and therefore reduce the 557 amount of entropy that is possible in a password. Such rules are 558 intended to minimize the possibility that the same string will be 559 displayed differently on a layout system set for right-to-left 560 display and a layout system set for left-to-right display; 561 however, passwords are typically not displayed at all and are 562 rarely meant to be interoperable across different layout systems 563 in the way that non-secret strings like domain names and 564 usernames are. Furthermore, it is perfectly acceptable for 565 opaque strings other than passwords to be presented differently 566 in different layout systems, as long as the presentation is 567 consistent in any given layout system. 569 4.2.3. Comparison 571 An entity that performs comparison of two strings according to this 572 profile MUST prepare each string and enforce the rules specified in 573 the previous two sections. The two strings are to be considered 574 equivalent if they are an exact octet-for-octet match (sometimes 575 called "bit-string identity"). 577 4.3. Examples 579 The following examples illustrate a small number of passwords that 580 are consistent with the format defined above (note that the 581 characters < and > are used here to delineate the actual passwords 582 and are not part of the password strings). 584 Table 3: A sample of legal passwords 586 +------------------------------------+------------------------------+ 587 | # | Password | Notes | 588 +------------------------------------+------------------------------+ 589 | 12| | ASCII space is allowed | 590 +------------------------------------+------------------------------+ 591 | 13| | Different from example 12 | 592 +------------------------------------+------------------------------+ 593 | 14| <πßå> | Non-ASCII letters are OK | 594 | | | (e.g., GREEK SMALL LETTER | 595 | | | PI, U+03C0) | 596 +------------------------------------+------------------------------+ 597 | 15| | Symbols are OK (e.g., BLACK | 598 | | | DIAMOND SUIT, U+2666) | 599 +------------------------------------+------------------------------+ 600 | 16| | OGHAM SPACE MARK, U+1680, is | 601 | | | mapped to U+0020 and thus | 602 | | | the full string is mapped to | 603 | | | | 604 +------------------------------------+------------------------------+ 606 The following example illustrates a strings that is not a valid 607 password because it violates the format defined above. 609 Table 4: A string that violates the password rules 611 +------------------------------------+------------------------------+ 612 | # | Password | Notes | 613 +------------------------------------+------------------------------+ 614 | 17| | Controls are disallowed | 615 +------------------------------------+------------------------------+ 617 5. Use in Application Protocols 619 This specification defines only the PRECIS-based rules for handling 620 of strings conforming to the UsernameCaseMapped and 621 UsernameCasePreserved profiles of the PRECIS IdentifierClass, and 622 strings conforming to the OpaqueString profile of the PRECIS 623 FreeformClass. It is the responsibility of an application protocol 624 to specify the protocol slots in which such strings can appear, the 625 entities that are expected to enforce the rules governing such 626 strings, and when in protocol processing or interface handling the 627 rules need to be enforced. See Section 6 of 628 [I-D.ietf-precis-framework] for guidelines about using PRECIS 629 profiles in applications. 631 Above and beyond the PRECIS-based rules specified here, application 632 protocols can also define application-specific rules governing such 633 strings (rules regarding minimum or maximum length, further 634 restrictions on allowable characters or character ranges, safeguards 635 to mitigate the effects of visually similar characters, etc.), 636 application-layer constructs (see Section 3.5), and related matters. 638 Some PRECIS profile definitions encourage entities that enforce the 639 rules to be liberal in what they accept. However, for usernames and 640 passwords such a policy can be problematic since it can lead to false 641 positives. An in-depth discussion can be found in "Issues in 642 Identifier Comparison for Security Purposes" [RFC6943]. 644 6. Migration 646 The rules defined in this specification differ slightly from those 647 defined by the SASLprep specification [RFC4013]. The following 648 sections describe these differences, along with their implications 649 for migration, in more detail. 651 6.1. Usernames 653 Deployments that currently use SASLprep for handling usernames might 654 need to scrub existing data when migrating to use of the rules 655 defined in this specification. In particular: 657 o SASLprep specified the use of Unicode Normalization Form KC 658 (NFKC), whereas the UsernameCaseMapped and UsernameCasePreserved 659 profiles employ Unicode Normalization Form C (NFC). In practice 660 this change is unlikely to cause significant problems, because 661 NFKC provides methods for mapping Unicode code points with 662 compatibility equivalents to those equivalents, whereas the PRECIS 663 IdentifierClass entirely disallows Unicode code points with 664 compatibility equivalents (i.e., during comparison NFKC is more 665 "aggressive" about finding matches than NFC). A few examples 666 might suffice to indicate the nature of the problem: 668 1. U+017F LATIN SMALL LETTER LONG S is compatibility equivalent 669 to U+0073 LATIN SMALL LETTER S 671 2. U+2163 ROMAN NUMERAL FOUR is compatibility equivalent to 672 U+0049 LATIN CAPITAL LETTER I and U+0056 LATIN CAPITAL LETTER 673 V 675 3. U+FB01 LATIN SMALL LIGATURE FI is compatibility equivalent to 676 U+0066 LATIN SMALL LETTER F and U+0069 LATIN SMALL LETTER I 678 Under SASLprep, the use of NFKC also handled the mapping of 679 fullwidth and halfwidth code points to their decomposition 680 mappings. Although it is expected that code points with 681 compatibility equivalents are rare in existing usernames, for 682 migration purposes deployments might want to search their database 683 of usernames for Unicode code points with compatibility 684 equivalents and map those code points to their compatibility 685 equivalents. 687 o SASLprep mapped the "characters commonly mapped to nothing" from 688 Appendix B.1 of [RFC3454]) to nothing, whereas the PRECIS 689 IdentifierClass entirely disallows most of these characters, which 690 correspond to the code points from the "M" category defined under 691 Section 8.13 of [I-D.ietf-precis-framework] (with the exception of 692 U+1806 MONGOLIAN TODO SOFT HYPHEN, which was "commonly mapped to 693 nothing" in Unicode 3.2 but at the time of this writing does not 694 have a derived property of Default_Ignorable_Code_Point in Unicode 695 7.0). For migration purposes, deployments might want to remove 696 code points contained in the PRECIS "M" category from usernames. 698 o SASLprep allowed uppercase and titlecase characters, whereas the 699 UsernameCaseMapped profile maps uppercase and titlecase characters 700 to their lowercase equivalents (by contrast, the 701 UsernameCasePreserved profile matches SASLprep in this regard). 702 For migration purposes, deployments can either use the 703 UsernameCaseMapped profile (thus losing the case information) or 704 use the UsernameCasePreserved profile (thus ignoring case 705 difference when comparing usernames). 707 6.2. Passwords 709 Depending on local service policy, migration from RFC 4013 to this 710 specification might not involve any scrubbing of data (since 711 passwords might not be stored in the clear anyway); however, service 712 providers need to be aware of possible issues that might arise during 713 migration. In particular: 715 o SASLprep specified the use of Unicode Normalization Form KC 716 (NFKC), whereas the OpaqueString profile employs Unicode 717 Normalization Form C (NFC). Because NFKC is more aggressive about 718 finding matches than NFC, in practice this change is unlikely to 719 cause significant problems and indeed has the security benefit of 720 probably resulting in fewer false positives when comparing 721 passwords. A few examples might suffice to indicate the nature of 722 the problem: 724 1. U+017F LATIN SMALL LETTER LONG S is compatibility equivalent 725 to U+0073 LATIN SMALL LETTER S 727 2. U+2163 ROMAN NUMERAL FOUR is compatibility equivalent to 728 U+0049 LATIN CAPITAL LETTER I and U+0056 LATIN CAPITAL LETTER 729 V 731 3. U+FB01 LATIN SMALL LIGATURE FI is compatibility equivalent to 732 U+0066 LATIN SMALL LETTER F and U+0069 LATIN SMALL LETTER I 734 Under SASLprep, the use of NFKC also handled the mapping of 735 fullwidth and halfwidth code points to their decomposition 736 mappings. Although it is expected that code points with 737 compatibility equivalents are rare in existing passwords, some 738 passwords that matched when SASLprep was used might no longer work 739 when the rules in this specification are applied. 741 o SASLprep mapped the "characters commonly mapped to nothing" from 742 Appendix B.1 of [RFC3454]) to nothing, whereas the PRECIS 743 FreeformClass entirely disallows such characters, which correspond 744 to the code points from the "M" category defined under 745 Section 8.13 of [I-D.ietf-precis-framework] (with the exception of 746 U+1806 MONGOLIAN TODO SOFT HYPHEN, which was commonly mapped to 747 nothing in Unicode 3.2 but at the time of this writing is allowed 748 by Unicode 7.0). In practice, this change will probably have no 749 effect on comparison, but user-oriented software might reject such 750 code points instead of ignoring them during password preparation. 752 7. IANA Considerations 754 The IANA shall add the following entries to the PRECIS Profiles 755 Registry. 757 7.1. UsernameCaseMapped Profile 759 Name: UsernameCaseMapped. 761 Base Class: IdentifierClass. 763 Applicability: Usernames in security and application protocols. 765 Replaces: The SASLprep profile of Stringprep. 767 Width Mapping Rule: Map fullwidth and halfwidth characters to their 768 decomposition mappings. 770 Additional Mapping Rule: None. 772 Case Mapping Rule: Map uppercase and titlecase characters to 773 lowercase. 775 Normalization Rule: NFC. 777 Directionality Rule: The "Bidi Rule" defined in RFC 5893 applies. 779 Enforcement: To be defined by security or application protocols that 780 use this profile. 782 Specification: RFC XXXX. [Note to RFC Editor: please change XXXX to 783 the number issued for this specification.] 785 7.2. UsernameCasePreserved Profile 787 Name: UsernameCasePreserved. 789 Base Class: IdentifierClass. 791 Applicability: Usernames in security and application protocols. 793 Replaces: The SASLprep profile of Stringprep. 795 Width Mapping Rule: Map fullwidth and halfwidth characters to their 796 decomposition mappings. 798 Additional Mapping Rule: None. 800 Case Mapping Rule: None. 802 Normalization Rule: NFC. 804 Directionality Rule: The "Bidi Rule" defined in RFC 5893 applies. 806 Enforcement: To be defined by security or application protocols that 807 use this profile. 809 Specification: RFC XXXX. [Note to RFC Editor: please change XXXX to 810 the number issued for this specification.] 812 7.3. OpaqueString Profile 814 Name: OpaqueString. 816 Base Class: FreeformClass. 818 Applicability: Passwords and other opaque strings in security and 819 application protocols. 821 Replaces: The SASLprep profile of Stringprep. 823 Width Mapping Rule: None. 825 Additional Mapping Rule: Map non-ASCII space characters to ASCII 826 space. 828 Case Mapping Rule: None. 830 Normalization Rule: NFC. 832 Directionality Rule: None. 834 Enforcement: To be defined by security or application protocols that 835 use this profile. 837 Specification: RFC XXXX. [Note to RFC Editor: please change XXXX to 838 the number issued for this specification.] 840 8. Security Considerations 842 8.1. Password/Passphrase Strength 844 The ability to include a wide range of characters in passwords and 845 passphrases can increase the potential for creating a strong password 846 with high entropy. However, in practice, the ability to include such 847 characters ought to be weighed against the possible need to reproduce 848 them on various devices using various input methods. 850 8.2. Identifier Comparison 852 The process of comparing identifiers (such as SASL simple user names, 853 authentication identifiers, and authorization identifiers) can lead 854 to either false negatives or false positives, both of which have 855 security implications. A more detailed discussion can be found in 856 [RFC6943]. 858 8.3. Reuse of PRECIS 860 The security considerations described in [I-D.ietf-precis-framework] 861 apply to the "IdentifierClass" and "FreeformClass" base string 862 classes used in this document for usernames and passwords, 863 respectively. 865 8.4. Reuse of Unicode 867 The security considerations described in [UTS39] apply to the use of 868 Unicode characters in usernames and passwords. 870 9. References 872 9.1. Normative References 874 [I-D.ietf-precis-framework] 875 Saint-Andre, P. and M. Blanchet, "Precis Framework: 876 Handling Internationalized Strings in Protocols", draft- 877 ietf-precis-framework-23 (work in progress), February 878 2015. 880 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 881 Requirement Levels", BCP 14, RFC 2119, March 1997. 883 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 884 10646", STD 63, RFC 3629, November 2003. 886 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 887 Specifications: ABNF", STD 68, RFC 5234, January 2008. 889 [RFC5890] Klensin, J., "Internationalized Domain Names for 890 Applications (IDNA): Definitions and Document Framework", 891 RFC 5890, August 2010. 893 [RFC6365] Hoffman, P. and J. Klensin, "Terminology Used in 894 Internationalization in the IETF", BCP 166, RFC 6365, 895 September 2011. 897 [Unicode] The Unicode Consortium, "The Unicode Standard", 898 2015-present, . 900 [Unicode7.0] 901 The Unicode Consortium, "The Unicode Standard, Version 902 7.0.0", 2014, 903 . 905 9.2. Informative References 907 [I-D.ietf-httpauth-basicauth-update] 908 Reschke, J., "The 'Basic' HTTP Authentication Scheme", 909 draft-ietf-httpauth-basicauth-update-07 (work in 910 progress), February 2015. 912 [I-D.ietf-httpauth-digest] 913 Shekh-Yusef, R., Ahrens, D., and S. Bremer, "HTTP Digest 914 Access Authentication", draft-ietf-httpauth-digest-18 915 (work in progress), April 2015. 917 [I-D.ietf-radext-nai] 918 DeKok, A., "The Network Access Identifier", draft-ietf- 919 radext-nai-15 (work in progress), December 2014. 921 [RFC20] Cerf, V., "ASCII format for network interchange", RFC 20, 922 October 1969. 924 [RFC3454] Hoffman, P. and M. Blanchet, "Preparation of 925 Internationalized Strings ("stringprep")", RFC 3454, 926 December 2002. 928 [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 929 4rev1", RFC 3501, March 2003. 931 [RFC4013] Zeilenga, K., "SASLprep: Stringprep Profile for User Names 932 and Passwords", RFC 4013, February 2005. 934 [RFC4422] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple 935 Authentication and Security Layer (SASL)", RFC 4422, June 936 2006. 938 [RFC4616] Zeilenga, K., "The PLAIN Simple Authentication and 939 Security Layer (SASL) Mechanism", RFC 4616, August 2006. 941 [RFC5802] Newman, C., Menon-Sen, A., Melnikov, A., and N. Williams, 942 "Salted Challenge Response Authentication Mechanism 943 (SCRAM) SASL and GSS-API Mechanisms", RFC 5802, July 2010. 945 [RFC5891] Klensin, J., "Internationalized Domain Names in 946 Applications (IDNA): Protocol", RFC 5891, August 2010. 948 [RFC5893] Alvestrand, H. and C. Karp, "Right-to-Left Scripts for 949 Internationalized Domain Names for Applications (IDNA)", 950 RFC 5893, August 2010. 952 [RFC5894] Klensin, J., "Internationalized Domain Names for 953 Applications (IDNA): Background, Explanation, and 954 Rationale", RFC 5894, August 2010. 956 [RFC6120] Saint-Andre, P., "Extensible Messaging and Presence 957 Protocol (XMPP): Core", RFC 6120, March 2011. 959 [RFC6943] Thaler, D., "Issues in Identifier Comparison for Security 960 Purposes", RFC 6943, May 2013. 962 [UTS39] The Unicode Consortium, "Unicode Technical Standard #39: 963 Unicode Security Mechanisms", July 2012, 964 . 966 Appendix A. Differences from RFC 4013 968 This document builds upon the PRECIS framework defined in 969 [I-D.ietf-precis-framework], which differs fundamentally from the 970 stringprep technology [RFC3454] used in SASLprep [RFC4013]. The 971 primary difference is that stringprep profiles allowed all characters 972 except those which were explicitly disallowed, whereas PRECIS 973 profiles disallow all characters except those which are explicitly 974 allowed (this "inclusion model" was originally used for 975 internationalized domain names in [RFC5891]; see [RFC5894] for 976 further discussion). It is important to keep this distinction in 977 mind when comparing the technology defined in this document to 978 SASLprep [RFC4013]. 980 The following substantive modifications were made from RFC 4013. 982 o A single SASLprep algorithm was replaced by three separate 983 algorithms: one for usernames with case mapping, one for usernames 984 with case preservation, and one for passwords. 986 o The new preparation algorithms use PRECIS instead of a stringprep 987 profile. The new algorithms work independenctly of Unicode 988 versions. 990 o As recommended in the PRECIS framework, changed the Unicode 991 normalization form from NFKC to NFC. 993 o Some Unicode code points that were mapped to nothing in RFC 4013 994 are simply disallowed by PRECIS. 996 Appendix B. Acknowledgements 998 The following individuals provided helpful feedback on this document: 999 Marc Blanchet, Ben Campbell, Alan DeKok, Joe Hildebrand, Jeffrey 1000 Hutzelman, Simon Josefsson, Jonathan Lennox, James Manger, Matt 1001 Miller, Chris Newman, Yutaka OIWA, Pete Resnick, Andrew Sullivan, 1002 Nico Williams, and Yoshiro YONEYA. Nico in particular deserves 1003 special recognition for providing text that was used in Section 3.4. 1004 Thanks also to Takahiro NEMOTO and Yoshiro YONEYA for implementation 1005 feedback. 1007 This document borrows some text from [RFC4013] and [RFC6120]. 1009 Peter Saint-Andre wishes to acknowledge Cisco Systems, Inc., for 1010 employing him during his work on earlier versions of this document. 1012 Authors' Addresses 1014 Peter Saint-Andre 1015 &yet 1017 Email: peter@andyet.com 1018 URI: https://andyet.com/ 1020 Alexey Melnikov 1021 Isode Ltd 1022 5 Castle Business Village 1023 36 Station Road 1024 Hampton, Middlesex TW12 2BX 1025 UK 1027 Email: Alexey.Melnikov@isode.com