Tech-invite3GPPspaceIETFspace
959493929190898887868584838281807978777675747372717069686766656463626160595857565554535251504948474645444342414039383736353433323130292827262524232221201918171615141312111009080706050403020100
in Index   Prev   Next

RFC 8265

Preparation, Enforcement, and Comparison of Internationalized Strings Representing Usernames and Passwords

Pages: 26
Proposed Standard
Errata
Obsoletes:  7613
Part 1 of 2 – Pages 1 to 12
None   None   Next

Top   ToC   RFC8265 - Page 1
Internet Engineering Task Force (IETF)                    P. Saint-Andre
Request for Comments: 8265                                    Jabber.org
Obsoletes: 7613                                              A. Melnikov
Category: Standards Track                                      Isode Ltd
ISSN: 2070-1721                                             October 2017


 Preparation, Enforcement, and Comparison of Internationalized Strings
                  Representing Usernames and Passwords

Abstract

This document describes updated methods for handling Unicode strings representing usernames and passwords. The previous approach was known as SASLprep (RFC 4013) and was based on Stringprep (RFC 3454). The methods specified in this document provide a more sustainable approach to the handling of internationalized usernames and passwords. This document obsoletes RFC 7613. Status of This Memo This is an Internet Standards Track document. This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841. Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at https://www.rfc-editor.org/info/rfc8265. Copyright Notice Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Top   ToC   RFC8265 - Page 2

Table of Contents

1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. Usernames . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.1. Definition . . . . . . . . . . . . . . . . . . . . . . . 5 3.2. Case Mapping vs. Case Preservation . . . . . . . . . . . 6 3.3. UsernameCaseMapped Profile . . . . . . . . . . . . . . . 7 3.3.1. Rules . . . . . . . . . . . . . . . . . . . . . . . . 7 3.3.2. Preparation . . . . . . . . . . . . . . . . . . . . . 8 3.3.3. Enforcement . . . . . . . . . . . . . . . . . . . . . 8 3.3.4. Comparison . . . . . . . . . . . . . . . . . . . . . 9 3.4. UsernameCasePreserved Profile . . . . . . . . . . . . . . 9 3.4.1. Rules . . . . . . . . . . . . . . . . . . . . . . . . 9 3.4.2. Preparation . . . . . . . . . . . . . . . . . . . . . 9 3.4.3. Enforcement . . . . . . . . . . . . . . . . . . . . . 10 3.4.4. Comparison . . . . . . . . . . . . . . . . . . . . . 10 3.5. Application-Layer Constructs . . . . . . . . . . . . . . 11 3.6. Examples . . . . . . . . . . . . . . . . . . . . . . . . 11 4. Passwords . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.1. Definition . . . . . . . . . . . . . . . . . . . . . . . 13 4.2. OpaqueString Profile . . . . . . . . . . . . . . . . . . 14 4.2.1. Preparation . . . . . . . . . . . . . . . . . . . . . 14 4.2.2. Enforcement . . . . . . . . . . . . . . . . . . . . . 14 4.2.3. Comparison . . . . . . . . . . . . . . . . . . . . . 15 4.3. Examples . . . . . . . . . . . . . . . . . . . . . . . . 15 5. Use in Application Protocols . . . . . . . . . . . . . . . . 16 6. Migration . . . . . . . . . . . . . . . . . . . . . . . . . . 17 6.1. Usernames . . . . . . . . . . . . . . . . . . . . . . . . 17 6.2. Passwords . . . . . . . . . . . . . . . . . . . . . . . . 19 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 7.1. UsernameCaseMapped Profile . . . . . . . . . . . . . . . 20 7.2. UsernameCasePreserved Profile . . . . . . . . . . . . . . 20 7.3. OpaqueString Profile . . . . . . . . . . . . . . . . . . 21 7.4. Stringprep Profile . . . . . . . . . . . . . . . . . . . 22 8. Security Considerations . . . . . . . . . . . . . . . . . . . 22 8.1. Password/Passphrase Strength . . . . . . . . . . . . . . 22 8.2. Password/Passphrase Comparison . . . . . . . . . . . . . 22 8.3. Identifier Comparison . . . . . . . . . . . . . . . . . . 22 8.4. Reuse of PRECIS . . . . . . . . . . . . . . . . . . . . . 22 8.5. Reuse of Unicode . . . . . . . . . . . . . . . . . . . . 22 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 23 9.1. Normative References . . . . . . . . . . . . . . . . . . 23 9.2. Informative References . . . . . . . . . . . . . . . . . 24 Appendix A. Changes from RFC 7613 . . . . . . . . . . . . . . . 25 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 26 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26
Top   ToC   RFC8265 - Page 3

1. Introduction

Usernames and passwords are widely used for authentication and authorization on the Internet, either directly when provided in plaintext (as in the PLAIN Simple Authentication and Security Layer (SASL) mechanism [RFC4616] and the HTTP Basic scheme [RFC7617]) or indirectly when provided as the input to a cryptographic algorithm such as a hash function (as in the Salted Challenge Response Authentication Mechanism (SCRAM) SASL mechanism [RFC5802] and the HTTP Digest scheme [RFC7616]). To increase the likelihood that the input and comparison of usernames and passwords will work in ways that make sense for typical users throughout the world, this document defines rules for handling internationalized strings that represent usernames and passwords. Such strings consist of code points from the Unicode coded character set [Unicode], with special attention to code points outside the ASCII range [RFC20]. The rules for handling such strings are specified through profiles of the string classes defined in the preparation, enforcement, and comparison of internationalized strings (PRECIS) framework specification [RFC8264]. Profiles of the PRECIS framework enable software to handle Unicode code points outside the ASCII range in an automated way, so that such code points are treated carefully and consistently in application protocols. In large measure, these profiles are designed to protect application developers from the potentially negative consequences of supporting the full range of Unicode code points. For instance, in almost all application protocols it would be dangerous to treat the Unicode code point "¹" (SUPERSCRIPT ONE, U+00B9) as equivalent to "1" (DIGIT ONE, U+0031), because that would result in false accepts during comparison, authentication, and authorization (e.g., an attacker could easily spoof an account "user1@example.com"). Whereas a naive use of Unicode would make such attacks trivially easy, the PRECIS profile defined here for usernames generally protects applications from inadvertently causing such problems. (Similar considerations apply to passwords, although here it is desirable to support a wider range of characters so as to maximize entropy for purposes of authentication.) The methods defined here might be applicable wherever usernames or passwords are used. However, the methods are not intended for use in preparing strings that are not usernames (e.g., Lightweight Directory Access Protocol (LDAP) distinguished names), nor in cases where identifiers or secrets are not strings (e.g., keys and certificates) or require specialized handling.
Top   ToC   RFC8265 - Page 4
   Although the historical predecessor of this document was the SASLprep
   profile of Stringprep [RFC3454]), the approach defined here can be
   used by technologies other than SASL [RFC4422], such as HTTP
   authentication as specified in [RFC7617] and [RFC7616].

   This document does not modify the handling of internationalized
   strings in usernames and passwords as prescribed by existing
   application protocols that use SASLprep.  If the community that uses
   such an application protocol wishes to modernize its handling of
   internationalized strings to use PRECIS instead of Stringprep, it
   needs to explicitly update the existing application protocol
   definition (one example is [RFC7622]).  Non-coordinated updates to
   protocol implementations are discouraged because they can have a
   negative impact on interoperability and security.

2. Terminology

A "username" or "user identifier" is a string of characters designating an account on a computing device or system, often but not necessarily for use by a person. Although some devices and systems might allow a username to be part or all of a person's name and a person might want their account designator to be part or all of their name, because of the complexities involved, that outcome is not guaranteed for all human names on all computing devices or systems that follow the rules defined in this specification. Protocol designers and application developers who wish to allow a wider range of characters are encouraged to consider a separation between more restrictive account identifiers and more expressive display names or nicknames (see [RFC8266]). A "password" is a string of characters that allows access to a computing device or system, often associated with a particular username. A password is not literally limited to a word, because a password could be a passphrase consisting of more than one word, perhaps separated by spaces, punctuation, or other non-alphanumeric characters. Some SASL mechanisms (e.g., CRAM-MD5, DIGEST-MD5, and SCRAM) specify that the authentication identity used in the context of such mechanisms is a "simple username" (see Section 2 of [RFC4422] as well as [RFC4013]). Various application technologies also assume that the identity of a user or account takes the form of a username (e.g., authentication for the Hypertext Transfer Protocol as specified in [RFC7617] and [RFC7616]), whether or not they use SASL. Note well that the exact form of a username in any particular SASL mechanism or application technology is a matter for implementation and deployment; note also that a username does not necessarily map to any particular application identifier.
Top   ToC   RFC8265 - Page 5
   Many important terms used in this document are defined in [RFC5890],
   [RFC6365], [RFC8264], and [Unicode].  The term "non-ASCII space"
   refers to any Unicode code point having a Unicode general category of
   "Zs", naturally with the exception of SPACE (U+0020).

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
   "OPTIONAL" in this document are to be interpreted as described in
   BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
   capitals, as shown here.

3. Usernames

3.1. Definition

This document specifies that a username is a string of Unicode code points [Unicode] that is structured as an ordered sequence of "userparts" and expressed in a standard Unicode Encoding Form (such as UTF-8 [RFC3629]). A userpart is allowed to contain only code points that are allowed by the PRECIS IdentifierClass defined in Section 4.2 of [RFC8264] and thus consists almost exclusively of letters and digits. A username can consist of a single userpart or a space-separated sequence of userparts. The syntax for a username is defined as follows, using the Augmented Backus-Naur Form (ABNF) [RFC5234]. username = userpart *(1*SP userpart) userpart = 1*(idpoint) ; ; an "idpoint" is a Unicode code point that ; can be contained in a string conforming to ; the PRECIS IdentifierClass ; All code points and blocks not explicitly allowed in the PRECIS IdentifierClass are disallowed; this includes private-use code points, surrogate code points, and the other code points and blocks that were defined as "Prohibited Output" in Section 2.3 of [RFC4013] (when corrected per [Err1812]). In addition, common constructions such as "user@example.com" (e.g., the Network Access Identifier from [RFC7542]) are allowed as usernames under this specification, as they were under [RFC4013]. Implementation Note: The username construct defined in this document does not necessarily match what all deployed applications might refer to as a "username" or "userid" but instead provides a relatively safe subset of Unicode code points that can be used in
Top   ToC   RFC8265 - Page 6
      existing SASL mechanisms and in application protocols that use
      SASL, and even in most application protocols that do not currently
      use SASL.

   A username MUST NOT be zero bytes in length.  This rule is to be
   enforced after any normalization and mapping of code points.

   This specification defines two profiles for usernames: the
   UsernameCaseMapped profile performs case mapping, and the
   UsernameCasePreserved performs case preservation (see further
   discussion under Section 3.2).

   In protocols that provide usernames as input to a cryptographic
   algorithm such as a hash function, the client will need to perform
   enforcement of the rules for the UsernameCaseMapped or
   UsernameCasePreserved profile before applying the algorithm.

3.2. Case Mapping vs. Case Preservation

In order to accommodate the widest range of username constructs in applications, this document defines two username profiles: UsernameCaseMapped and UsernameCasePreserved. These two profiles differ only in their use (or not) of the Case Mapping Rule and are otherwise identical. Case mapping is a matter for the application protocol, protocol implementation, or end deployment. In general, this document suggests that it is preferable to apply the UsernameCaseMapped profile and therefore perform case mapping, because not doing so can lead to false accepts during authentication and authorization (as described in [RFC6943]) and can result in confusion among end users, given the prevalence of case mapping in many existing protocols and applications. However, there can be good reasons to apply the UsernameCasePreserved profile and thus not perform case mapping, such as backward compatibility with deployed infrastructure. In particular: o SASL mechanisms that follow the recommendations in this document MUST specify whether and when case mapping is to be applied to authentication identifiers. Because case mapping results in information loss, in order to retain that information for as long as possible during processing, implementations SHOULD delay any case mapping to the last possible moment, such as when doing a lookup by username, performing username comparisons, or generating a cryptographic salt from a username (if the last possible moment happens on a server, then decisions about case mapping can be a matter of service deployment policy). In keeping with [RFC4422],
Top   ToC   RFC8265 - Page 7
      SASL mechanisms are not to apply this or any other profile to
      authorization identifiers, only to authentication identifiers.

   o  Application protocols that use SASL (such as IMAP [RFC3501] and
      the Extensible Messaging and Presence Protocol (XMPP) [RFC6120])
      and that directly reuse this profile MUST specify whether or not
      case mapping is to be applied to authorization identifiers.  Such
      "SASL application protocols" SHOULD delay any case mapping of
      authorization identifiers to the last possible moment, which
      happens to necessarily be on the server side (this enables
      decisions about case mapping to be a matter of service deployment
      policy).  In keeping with [RFC4422], SASL application protocols
      are not to apply this or any other profile to authentication
      identifiers, only to authorization identifiers.

   o  Application protocols that do not use SASL (such as HTTP
      authentication with the HTTP Basic and Digest schemes as specified
      in [RFC7617] and [RFC7616]) but that directly reuse this profile
      MUST specify whether and when case mapping is to be applied to
      authentication identifiers or authorization identifiers, or both.
      Such "non-SASL application protocols" SHOULD delay any case
      mapping to the last possible moment, such as when doing a lookup
      by username, performing username comparisons, or generating a
      cryptographic salt from a username (if the last possible moment
      happens on the server, then decisions about case mapping can be a
      matter of service deployment policy).

   If the specification for a SASL mechanism, SASL application protocol,
   or non-SASL application protocol uses the UsernameCaseMapped profile,
   it MUST clearly describe whether case mapping is to be applied at the
   level of the protocol itself, implementations thereof, or service
   deployments (each of these approaches can be legitimate, depending on
   the application in question).

3.3. UsernameCaseMapped Profile

3.3.1. Rules

The following rules are defined for use within the UsernameCaseMapped profile of the PRECIS IdentifierClass. 1. Width Mapping Rule: Map fullwidth and halfwidth code points to their decomposition mappings (see Unicode Standard Annex #11 [UAX11]). 2. Additional Mapping Rule: There is no additional mapping rule.
Top   ToC   RFC8265 - Page 8
   3.  Case Mapping Rule: Map uppercase and titlecase code points to
       their lowercase equivalents, preferably using the Unicode
       toLowerCase() operation as defined in the Unicode Standard
       [Unicode]; see further discussion in Section 3.2.

   4.  Normalization Rule: Apply Unicode Normalization Form C (NFC) to
       all strings.

   5.  Directionality Rule: Apply the "Bidi Rule" defined in [RFC5893]
       to strings that contain right-to-left code points (i.e., each of
       the six conditions of the Bidi Rule must be satisfied); for
       strings that do not contain right-to-left code points, there is
       no special processing for directionality.

3.3.2. Preparation

An entity that prepares an input string for subsequent enforcement according to this profile MUST proceed as follows (applying the steps in the order shown). 1. Apply the width mapping rule specified in Section 3.3.1. It is necessary to apply the rule at this point because otherwise the PRECIS "HasCompat" category specified in Section 9.17 of [RFC8264] would forbid fullwidth and halfwidth code points. 2. Ensure that the string consists only of Unicode code points that are explicitly allowed by the PRECIS IdentifierClass defined in Section 4.2 of [RFC8264].

3.3.3. Enforcement

An entity that performs enforcement according to this profile MUST prepare an input string as described in Section 3.3.2 and MUST also apply the following rules specified in Section 3.3.1 in the order shown: 1. Case Mapping Rule 2. Normalization Rule 3. Directionality Rule After all of the foregoing rules have been enforced, the entity MUST ensure that the username is not zero bytes in length (this is done after enforcing the rules to prevent applications from mistakenly omitting a username entirely, because when internationalized strings are accepted, a non-empty sequence of characters can result in a zero-length username after canonicalization).
Top   ToC   RFC8265 - Page 9
   The result of the foregoing operations is an output string that
   conforms to the UsernameCaseMapped profile.  Until an implementation
   produces such an output string, it MUST NOT treat the string as
   conforming (in particular, it MUST NOT assume that an input string is
   conforming before the enforcement operation has been completed).

3.3.4. Comparison

An entity that performs comparison of two strings according to this profile MUST prepare each string as specified in Section 3.3.2 and then MUST enforce the rules specified in Section 3.3.3. The two strings are to be considered equivalent if and only if they are an exact octet-for-octet match (sometimes called "bit-string identity"). Until an implementation determines whether two strings are to be considered equivalent, it MUST NOT treat them as equivalent (in particular, it MUST NOT assume that two input strings are equivalent before the comparison operation has been completed).

3.4. UsernameCasePreserved Profile

3.4.1. Rules

The following rules are defined for use within the UsernameCasePreserved profile of the PRECIS IdentifierClass. 1. Width Mapping Rule: Map fullwidth and halfwidth code points to their decomposition mappings (see Unicode Standard Annex #11 [UAX11]). 2. Additional Mapping Rule: There is no additional mapping rule. 3. Case Mapping Rule: There is no case mapping rule. 4. Normalization Rule: Apply Unicode Normalization Form C (NFC) to all strings. 5. Directionality Rule: Apply the "Bidi Rule" defined in [RFC5893] to strings that contain right-to-left code points (i.e., each of the six conditions of the Bidi Rule must be satisfied); for strings that do not contain right-to-left code points, there is no special processing for directionality.

3.4.2. Preparation

An entity that prepares a string for subsequent enforcement according to this profile MUST proceed as follows (applying the steps in the order shown).
Top   ToC   RFC8265 - Page 10
   1.  Apply the width mapping rule specified in Section 3.4.1.  It is
       necessary to apply the rule at this point because otherwise the
       PRECIS "HasCompat" category specified in Section 9.17 of
       [RFC8264] would forbid fullwidth and halfwidth code points.

   2.  Ensure that the string consists only of Unicode code points that
       are explicitly allowed by the PRECIS IdentifierClass defined in
       Section 4.2 of [RFC8264].

3.4.3. Enforcement

An entity that performs enforcement according to this profile MUST prepare a string as described in Section 3.4.2 and MUST also apply the following rules specified in Section 3.4.1 in the order shown: 1. Normalization Rule 2. Directionality Rule After all of the foregoing rules have been enforced, the entity MUST ensure that the username is not zero bytes in length (this is done after enforcing the rules to prevent applications from mistakenly omitting a username entirely, because when internationalized strings are accepted, a non-empty sequence of characters can result in a zero-length username after canonicalization). The result of the foregoing operations is an output string that conforms to the UsernameCasePreserved profile. Until an implementation produces such an output string, it MUST NOT treat the string as conforming (in particular, it MUST NOT assume that an input string is conforming before the enforcement operation has been completed).

3.4.4. Comparison

An entity that performs comparison of two strings according to this profile MUST prepare each string as specified in Section 3.4.2 and then MUST enforce the rules specified in Section 3.4.3. The two strings are to be considered equivalent if and only if they are an exact octet-for-octet match (sometimes called "bit-string identity"). Until an implementation determines whether two strings are to be considered equivalent, it MUST NOT treat them as equivalent (in particular, it MUST NOT assume that two input strings are equivalent before the comparison operation has been completed).
Top   ToC   RFC8265 - Page 11

3.5. Application-Layer Constructs

Both the UsernameCaseMapped and UsernameCasePreserved profiles enable an application protocol, implementation, or deployment to create application-layer constructs such as a username that is a space- separated set of userparts like "Firstname Middlename Lastname". Such a construct is not a profile of the PRECIS IdentifierClass, because SPACE (U+0020) is not allowed in the IdentifierClass; however, it can be created at the application layer because SPACE (U+0020) can be used as a separator between instances of the PRECIS IdentifierClass (e.g., userparts as defined in this specification).

3.6. Examples

The following examples illustrate a small number of userparts (not usernames) that are consistent with the format defined above (note that the characters "<" and ">" are used here to delineate the actual userparts and are not part of the userpart strings). +--------------------------+---------------------------------+ | # | Userpart | Notes | +--------------------------+---------------------------------+ | 1 | <juliet@example.com> | The "at" sign ("@") is allowed | | | | in the PRECIS IdentifierClass | +--------------------------+---------------------------------+ | 2 | <fussball> | | +--------------------------+---------------------------------+ | 3 | <fußball> | The third character is LATIN | | | | SMALL LETTER SHARP S (U+00DF) | +--------------------------+---------------------------------+ | 4 | <π> | A userpart of GREEK SMALL | | | | LETTER PI (U+03C0) | +--------------------------+---------------------------------+ | 5 | <Σ> | A userpart of GREEK CAPITAL | | | | LETTER SIGMA (U+03A3) | +--------------------------+---------------------------------+ | 6 | <σ> | A userpart of GREEK SMALL | | | | LETTER SIGMA (U+03C3) | +--------------------------+---------------------------------+ | 7 | <ς> | A userpart of GREEK SMALL | | | | LETTER FINAL SIGMA (U+03C2) | +--------------------------+---------------------------------+ Table 1: A Sample of Legal Userparts Regarding examples 2 and 3: although in German writing the character eszett "ß" (LATIN SMALL LETTER SHARP S, U+00DF) can mostly be used interchangeably with the two characters "ss", the userparts in these
Top   ToC   RFC8265 - Page 12
   examples are different and (if desired) a server would need to
   enforce a registration policy that disallows one of them if the other
   is registered.

   Regarding examples 5, 6, and 7: optional case mapping of "Σ" (GREEK
   CAPITAL LETTER SIGMA, U+03A3) to the lowercase character "σ" (GREEK
   SMALL LETTER SIGMA, U+03C3) during comparison would result in
   matching the userparts in examples 5 and 6; however, because the
   PRECIS mapping rules do not account for the special status of the
   character "ς" (GREEK SMALL LETTER FINAL SIGMA, U+03C2), the userparts
   in examples 5 and 7 or examples 6 and 7 would not be matched during
   comparison.

   The following examples illustrate strings that are not valid
   userparts (not usernames) because they violate the format defined
   above.

      +--------------------------+---------------------------------+
      | # | Non-Userpart String  | Notes                           |
      +--------------------------+---------------------------------+
      | 8 | <foo bar>            | SPACE (U+0020) is disallowed in |
      |   |                      | the userpart                    |
      +--------------------------+---------------------------------+
      | 9 | <>                   | Zero-length userpart            |
      +--------------------------+---------------------------------+
      | 10| <henryⅣ>            | The sixth character is ROMAN    |
      |   |                      | NUMERAL FOUR (U+2163)           |
      +--------------------------+---------------------------------+
      | 11| <∞>                  | A userpart of INFINITY (U+221E) |
      +--------------------------+---------------------------------+

       Table 2: A Sample of Strings That Violate the Userpart Rules

   Regarding example 8: although this is not a valid userpart, it is a
   valid username because it is a space-separated sequence of userparts.

   Regarding example 10: the character "Ⅳ" (ROMAN NUMERAL FOUR, U+2163)
   has a compatibility equivalent of the characters "I" (LATIN CAPITAL
   LETTER I, U+0049) and "V" (LATIN CAPITAL LETTER V, U+0056), but code
   points with compatibility equivalents are not allowed in the PRECIS
   IdentifierClass.

   Regarding example 11: symbol characters such as "∞" (INFINITY,
   U+221E) are not allowed in the PRECIS IdentifierClass.


(next page on part 2)

Next Section