Subject: New revision of DIGEST-MD5 (draft-melnikov-rfc2831bis-00.txt) is available

From: Alexey Melnikov <[email-masked]>
Date: Thu, 18 Apr 2002 23:30:36 +0100

I've submitted a new revision of DIGEST-MD5 document. I didn't fix all
items from the list of issues I have, but I've decided to submit a new
document in a hope to start some discussions.

Fixed in this revision (I should probably add this to the document
itself):

1). Fixed several typos:

>   Kcc = MD5({H(A1)[0..n],
>   "Digest H(A1) to client-to-server sealing key magic constant"})

Changed "[0..n]" to "[0..n-1]".

>   The key for confidentiality protecting messages from server to
client
>   is:

>   Kcs = MD5({H(A1)[0..n],
>   "Digest H(A1) to server-to-client sealing key magic constant"})

Changed "[0..n]" to "[0..n-1]".

>   where MD5 is as specified in [RFC 1321]. For cipher "rc4-40" n is 5;

>   for "rc4-56" n is 7; for the rest n is 16. The key for the "rc-*"

Typo "rc4-*"

>   ciphers is all 16 bytes of Kcc or Kcs; the key for "des" is the
first
>   7 bytes; the key for "3des" is the first 14 bytes. The IV for "des"
>   and "3des" is the last 8 bytes of Kcc or Kcs.

2). Tightened the syntax of the nonce and cnonce to prohibit quoted
characters:
    nonce-value = *qdtext
    cnonce-value = *qdtext

They use to be "qdstr-val". RFC 2617 (HTTP Digest) prohibits <">, we are
prohibiting even more!
I've also changed qdtext from:

   qdtext         = <any TEXT except <">>

to

   qdtext         = <any TEXT except <">, "\">

i.e. <\> is not allowed unquoted. Is it Ok with everybody?

3). DES and 3DES are mandatory to implement for privacy layer. I've
removed DES, as it seems too weak now, especially when used together
with CBC mode (see Questions below). Objections?

4). Section 2.1.2, description of nc-value: shouldn't it be the server
aborting the exchange?

Changed:
This directive may appear at most once; if multiple instances are
present,
the client should abort the authentication exchange.

to:
This directive is required and MUST be present exactly once; otherwise,
authentication fails.

Reason: text below says that "server verifies nonce-count". It can't
verify
nonce-count if the client didn't include it.

Alternative: say if nonce-count is missing it is defaulted to
"00000001".

5). Added text saying that authentication/authorization ids and
passwords are in Unicode Normalization form KC without NULs.

6). Clarified that the unquoted versions of  username, realm, etc. used
in A1 calculations.

7). Added UTF-8 to References section and removed some unused
references.

To Do:

1). Security considerations: How does DIGEST-MD5 protect against
downgrade of maxbuf, qop, qop-options?

2). Add acknowledgment section.

3). More ABNF cleanup.

Other questions:

1). realm-value, authzid-value - always in UTF8 even if charset=utf-8 is
absent?

2). Specify that realm is in Unicode Normalization form KC encoded as
UTF-8?

3). Can we move to Draft without fixing the issue with "CBC mode attack"
discussed in Minneapolis at TLS and SSH WGs meetings.
TLS working group has the same issue and they seem to think that they
can't move to Draft without fixing.

Alexey
__________________________________________
R & D, ACI Worldwide/MessagingDirect
Richmond, Surrey, UK
Phone: +44 20 8332 4508

I speak for myself only, not for my employer.
__________________________________________

---

From: Simon Josefsson <[email-masked]>
Date: Mon, 22 Apr 2002 19:43:36 +0200

> document in a hope to start some discussions.
...
> with CBC mode (see Questions below). Objections?

What about merging the text from draft-melnikov-sasl-digest-aes-00.txt
into RFC 2831bis?  In any case, the security consideration of
rfc2831bis should say that rc4-40 and probably also rc4-56 and des are
weak.

I remember interoperability problems with DIGEST-MD5 in the past.
Were those due to implementation bugs, or has something in rfc2831bis
clarified previous unclear/wrong text?

Thanks,
Simon

---

From: Alexey Melnikov <[email-masked]>
Date: Wed, 24 Apr 2002 17:18:28 -0600

> rfc2831bis should say that rc4-40 and probably also rc4-56 and des are

I don't mind merging the documents, the problem is that this will mean that
DIGEST-MD5 recycles to Proposed and this is additional 6 months (also if we
do the document right this round, we will not have to reissue a new revision
before moving to Draft). I would like to hear other opinions on this matter.

> clarified previous unclear/wrong text?

I am not too sure. Most changes I've made in
draft-melnikov-rfc2831bis-00.txt are fixing some edge cases that I don't
think anybody implemented.

I think it would be fair to say that we have good interoperability for
"auth".
We need to perform a round of auth-int and auth-conf interop testing, as we
had problems before.

Regards,
Alexey

---

From: Simon Josefsson <[email-masked]>
Date: Mon, 22 Apr 2002 19:43:36 +0200

...

Thanks,
Simon

---

From: Alexey Melnikov <[email-masked]>
Date: Wed, 24 Apr 2002 17:18:28 -0600

Regards,
Alexey

Date: Wed, 24 Apr 2002 17:18:28 -0600
From: Alexey Melnikov <[email-masked]>
Organization: ACI WorldWide / MessagingDirect
To: Simon Josefsson <[email-masked]>
CC: [email-masked]
Subject: Re: New revision of DIGEST-MD5 (draft-melnikov-rfc2831bis-00.txt)is   available
Sender: [email-masked]

Regards,
Alexey

To: Alexey Melnikov <[email-masked]>
Cc: [email-masked]
Subject: Re: New revision of DIGEST-MD5 (draft-melnikov-rfc2831bis-00.txt) is  available
From: Simon Josefsson <[email-masked]>
Date: Mon, 22 Apr 2002 19:43:36 +0200
Lines: 21
Sender: [email-masked]

...

Thanks,
Simon

To: [email-masked]
Cc: Chris Newman <[email-masked]>, [email-masked], [email-masked]
Subject: Re: SASL/GSSAPI proposed change of base32 alphabet
From: Simon Josefsson <[email-masked]>
Date: Mon, 22 Apr 2002 17:15:56 +0200
Lines: 64
Sender: [email-masked]

--=-=-=

I now have an updated base encoding document based on comments below,
and from Chris Newman and others, changes relevant here include:

- Alternative alphabets moved to separate section.
- Alternative alphabets marked as not being the same as the original
  ones.
- Canonical base16 dropped.

I am considering dropping the RFC 2938 compatible Base32 version as
well, in favor of only the SASL-GSSAPI alphabet.  It might send a
mixed message having two different base32 alphabets defined in RFCs,
but RFC 2938 seem to be for a limited audience and does not describe a
general base32 encoding.  The SASL-GSSAPI alphabet also seems better.
The SASL-GSSAPI alphabet was compatible with draft-ietf-pkix-okid-00,
but not draft-ietf-pkix-pkid-01 which isn't compatible with RFC 2938
either.  I don't remember the situation for the various IDN proposals
completely (there seem to be many and I'm not sure which are valid),
but I believe they either used the RFC 2938 alphabet or (more
commonly) the SASL-GSSAPI alphabet.  I think it would be nice to go
for the SASL-GSSAPI alphabet everywhere.

I'll submit this to the I-D editor within a week or so unless someone
has comments.

Thanks.

[email-masked] (John Myers) writes:

> Simon Josefsson wrote:
>> The document give names to the alphabets, so making the reference to the
>> "Base32 with the canonical alphabet" should be sufficient.  The
>> encoding is the same, only the alphabet differ.
>
> If the alphabets differ then the encodings are not the same.
>
> Names that require qualification are awkward and invite ambiguous
> references.  The term "Base64" refers to the encoding and alphabet
> defined in MIME.  If an encoding uses a different alphabet, then that
> is a variant of base64 and needs to go by a different name.
>
>> The only use of base32 in a IETF standards track document is in RFC 2938,
>> so I chosed that alphabet as the "canonical" one.
>
> The -03 version of your document uses the sasl-gssapi alpahabet as the
> "canonical" one.  The RFC 2938 alphabet is given the name "Extended
> Hex".
>
>> I'd rather drop the "Extended hex" version as well, but it seems to be in
>> use.  Right now, I'm not sure if the base encoding document should
>> document current practice or suggest best future practices.  For Base64
>> both alphabets have useful and distinct properties, and warrant
>> inclusion.  For base32, which isn't commonly used, perhaps it is not
>> as clear.
>
> I don't see any references in the document to uses of the "Canonical
> Base 16" alphabet.  I have strenuous objections to inventing a new
> variant of hex.
>
> The request I've received is to make the sasl-gssapi document have a
> normative reference to the base-encoding document.  The current state
> of the base-encoding document does not make me comfortable about
> adding a dependency on it.

--=-=-=
Content-Disposition: attachment;
  filename=draft-josefsson-base-encoding.txt

Network Working Group                              S. Josefsson (editor)
Internet-Draft                                             February 2002
Expires: August 2, 2002

                         Base Encoding of Data
                     draft-josefsson-base-encoding

Status of this Memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on August 2, 2002.

Copyright Notice

   Copyright (C) The Internet Society (2002).  All Rights Reserved.

Keywords

   Base Encoding, Base64, Base32, Base16, Hex.

Abstract

   This draft contain descriptions of the commonly used base 64, base
   32, and base 16 encoding schemes.  It also discusses the use of line-
   feeds in encoded data, use of padding in encoded data, use of non-
   alphabet characters in encoded data, and use of different encoding
   alphabets.

Josefsson (editor)       Expires August 2, 2002                 [Page 1]

Internet-Draft            Base Encoding of Data            February 2002

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Implementation discrepancies . . . . . . . . . . . . . . . . .  3
   2.1 Line feeds in encoded data . . . . . . . . . . . . . . . . . .  3
   2.2 Padding of encoded data  . . . . . . . . . . . . . . . . . . .  3
   2.3 Interpretation of non-alphabet characters in encoded data  . .  4
   2.4 Chosing the alphabet . . . . . . . . . . . . . . . . . . . . .  4
   3.  Base 64 Encoding . . . . . . . . . . . . . . . . . . . . . . .  5
   4.  Base 64 Encoding with URL and Filename Safe Alphabet . . . . .  6
   5.  Base 32 Encoding . . . . . . . . . . . . . . . . . . . . . . .  7
   6.  Base 32 Encoding with Extended Hex Alphabet  . . . . . . . . .  9
   7.  Base 16 Encoding . . . . . . . . . . . . . . . . . . . . . . .  9
   8.  Illustrations  . . . . . . . . . . . . . . . . . . . . . . . . 10
   8.1 Examples of Base 64  . . . . . . . . . . . . . . . . . . . . . 11
   9.  Security Considerations  . . . . . . . . . . . . . . . . . . . 11
   10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 11
       References . . . . . . . . . . . . . . . . . . . . . . . . . . 12
       Author's Address . . . . . . . . . . . . . . . . . . . . . . . 12
       Full Copyright Statement . . . . . . . . . . . . . . . . . . . 13

Josefsson (editor)       Expires August 2, 2002                 [Page 2]

Internet-Draft            Base Encoding of Data            February 2002

1. Introduction

   Base encoding of data is used in many situations to store or transfer
   data in environments that, perhaps for legacy reasons, are restricted
   to only US-ASCII data.  Base encoding can also be used in new
   applications that do not have legacy restrictions, simply because it
   makes it possible to manipulate objects with text editors.

   In the past, different applications has had different requirements
   and thus sometimes implemented base encodings in slightly different
   ways.  Today, protocol specifications sometimes use base encodings in
   general, and "base64" in particular, without a precise description or
   reference.  MIME [2] is often used as a reference for base64 without
   considering the consequences for line-wrapping or non-alphabet
   character considerations.  The purpose of this specification is to
   establish common alphabet and encoding considerations.  This will
   hopefully reduce ambiguity in other documents, leading to better
   interoperability.

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in RFC 2119 [3].

2. Implementation discrepancies

   Here we discuss the discrepancies between base encoding
   implementations in the past, and where appropriate, mandate a
   specific recommended behaviour for the future.

2.1 Line feeds in encoded data

   MIME [2] is often used as a reference for base 64 encoding.  However,
   MIME does not define "base 64" per se, but rather a "base 64 Content-
   Transfer-Encoding" for use within MIME.  As such, MIME enforces a
   limit on line length of base 64 encode data to 76 characters.  MIME
   inherits the encoding from PEM [1] stating it is "virtually
   identical", however PEM uses a line length of 64 characters.  The
   MIME and PEM limits are both due to limits within SMTP.

   Implementation of specifications using this document as reference for
   base encodings MUST NOT add line feeds to the encoded data, unless
   explicitely stated after how many characters lines should be wrapped
   in said specifications.

2.2 Padding of encoded data

   In some circumstances, the use of padding ("=") in base encoded data
   is not required nor used.  In the general case when assumptions on

Josefsson (editor)       Expires August 2, 2002                 [Page 3]

Internet-Draft            Base Encoding of Data            February 2002

   size of data transported cannot be made, padding is required to yield
   correct decoded data.

   Implementation of specifications using this document as reference for
   base encodings MUST do proper padding to the encoded data, unless
   explicitely stated and handled otherwise in said specifications.

2.3 Interpretation of non-alphabet characters in encoded data

   Base encodings use a specific, reduced, alphabet to encode binary
   data.  Non base alphabet characters could exist within base encoded
   data, caused by data corruption or by design.  Non alphabet
   characters may be exploited as a "covert channel", where non-protocol
   data can be sent for nefarious purposes.  Non alphabet characters
   might also be sent in order to exploit implementation errors leading
   to, e.g., buffer overflow attacks

   Implementations of specifications using this document as reference
   for base encodings MUST reject the encoding if it contains characters
   outside the base alphabet when interpreting base encoded data, unless
   explicitly stated and handled otherwise in said specification.  Such
   specifications may, as MIME does, state that characters outside the
   base encoding alphabet should simply be ignored when interepreting
   data (``be liberal in what you accept'').  Note that this means that
   any CRLF-padding constitue "non alphabet characters" and is ignored.
   Furthermore, such specifications may consider the pad character, "=",
   as not part of the base alphabet until the end of the string.  If
   more than the allowed number of pad characters are found at the end
   of the string, e.g., a base 64 string terminated with "===", the
   excess pad characters could be ignored.

2.4 Chosing the alphabet

   Different applications have different requirements on the characters
   in the alphabet.  Here are a few requirements that determine which
   alphabet should be used:

   o  Handled by humans.  Characters "0", "O" are easily interchanged,
      as well "1", "l" and "I".  In the base32 alphabet below, where 0
      (zero) and 1 (one) is not present, a decoder may interprete 0 as
      O, and 1 as I or L depending on case.  (However, by default it
      should not, see previous section.)

   o  Encoded into structures that place other requirements.  This
      determines the use of upper- or lowercase alphabets (for case-
      insensitive alphabets such as base 32).  For base 64, the non-
      alphanumeric characters (in particular "/") may be problematic in
      filenames and URLs.

Josefsson (editor)       Expires August 2, 2002                 [Page 4]

Internet-Draft            Base Encoding of Data            February 2002

   o  Used as identifiers.  Certain characters, notably "+" and "/" in
      the base 64 alphabet, are treated as word-breaks by legacy text
      search/index tools.

   There is no universally accepted alphabet that fulfill all the
   requirements.  In this document, we document and name some currently
   used alphabets.

3. Base 64 Encoding

   The following description of base 64 is due to [1], [2], [4] and [5].

   The Base 64 encoding is designed to represent arbitrary sequences of
   octets in a form that requires case sensitivity but need not be
   humanly readable.

   A 65-character subset of US-ASCII is used, enabling 6 bits to be
   represented per printable character.  (The extra 65th character, "=",
   is used to signify a special processing function.)

   The encoding process represents 24-bit groups of input bits as output
   strings of 4 encoded characters.  Proceeding from left to right, a
   24-bit input group is formed by concatenating 3 8-bit input groups.
   These 24 bits are then treated as 4 concatenated 6-bit groups, each
   of which is translated into a single digit in the base 64 alphabet.

   Each 6-bit group is used as an index into an array of 64 printable
   characters.  The character referenced by the index is placed in the
   output string.

Josefsson (editor)       Expires August 2, 2002                 [Page 5]

Internet-Draft            Base Encoding of Data            February 2002

                         Table 1: The Base 64 Alphabet

         Value Encoding  Value Encoding  Value Encoding  Value Encoding
             0 A            17 R            34 i            51 z
             1 B            18 S            35 j            52 0
             2 C            19 T            36 k            53 1
             3 D            20 U            37 l            54 2
             4 E            21 V            38 m            55 3
             5 F            22 W            39 n            56 4
             6 G            23 X            40 o            57 5
             7 H            24 Y            41 p            58 6
             8 I            25 Z            42 q            59 7
             9 J            26 a            43 r            60 8
            10 K            27 b            44 s            61 9
            11 L            28 c            45 t            62 +
            12 M            29 d            46 u            63 /
            13 N            30 e            47 v
            14 O            31 f            48 w         (pad) =
            15 P            32 g            49 x
            16 Q            33 h            50 y

   Special processing is performed if fewer than 24 bits are available
   at the end of the data being encoded.  A full encoding quantum is
   always completed at the end of a quantity.  When fewer than 24 input
   bits are available in an input group, zero bits are added (on the
   right) to form an integral number of 6-bit groups.  Padding at the
   end of the data is performed using the '=' character.  Since all base
   64 input is an integral number of octets, only the following cases
   can arise:

   (1) the final quantum of encoding input is an integral multiple of 24
   bits; here, the final unit of encoded output will be an integral
   multiple of 4 characters with no "=" padding,

   (2) the final quantum of encoding input is exactly 8 bits; here, the
   final unit of encoded output will be two characters followed by two
   "=" padding characters, or

   (3) the final quantum of encoding input is exactly 16 bits; here, the
   final unit of encoded output will be three characters followed by one
   "=" padding character.

4. Base 64 Encoding with URL and Filename Safe Alphabet

   The Base 64 encoding with an URL and filename safe alphabet has been
   used in [8].  An alternative alphabet has been suggested that used
   "~" as the 63rd character.  Since the "~" character has special
   meaning in some file system environments, the encoding described in

Josefsson (editor)       Expires August 2, 2002                 [Page 6]

Internet-Draft            Base Encoding of Data            February 2002

   this section is recommended instead.  This encoding should not be
   regarded as the same as the "base64" encoding, and should not be
   referred to as only "base64".

   This encoding is identical to the previous one, except for the 62:nd
   and 63:rd alphabet character, as indicated in table 2.

             Table 2: The "URL and Filename safe" Base 64 Alphabet

         Value Encoding  Value Encoding  Value Encoding  Value Encoding
             0 A            17 R            34 i            51 z
             1 B            18 S            35 j            52 0
             2 C            19 T            36 k            53 1
             3 D            20 U            37 l            54 2
             4 E            21 V            38 m            55 3
             5 F            22 W            39 n            56 4
             6 G            23 X            40 o            57 5
             7 H            24 Y            41 p            58 6
             8 I            25 Z            42 q            59 7
             9 J            26 a            43 r            60 8
            10 K            27 b            44 s            61 9
            11 L            28 c            45 t            62 - (minus)
            12 M            29 d            46 u            63 _ (understrike)
            13 N            30 e            47 v
            14 O            31 f            48 w         (pad) =
            15 P            32 g            49 x
            16 Q            33 h            50 y

5. Base 32 Encoding

   The following description of base 32 is due to [7] (with
   corrections).

   The Base 32 encoding is designed to represent arbitrary sequences of
   octets in a form that needs to be case insensitive but need not be
   humanly readable.

   A 33-character subset of US-ASCII is used, enabling 5 bits to be
   represented per printable character.  (The extra 33rd character, "=",
   is used to signify a special processing function.)

   The encoding process represents 40-bit groups of input bits as output
   strings of 8 encoded characters.  Proceeding from left to right, a
   40-bit input group is formed by concatenating 5 8bit input groups.
   These 40 bits are then treated as 8 concatenated 5-bit groups, each
   of which is translated into a single digit in the base 32 alphabet.
   When encoding a bit stream via the base 32 encoding, the bit stream

Josefsson (editor)       Expires August 2, 2002                 [Page 7]

Internet-Draft            Base Encoding of Data            February 2002

   must be presumed to be ordered with the most-significant-bit first.
   That is, the first bit in the stream will be the high-order bit in
   the first 8bit byte, and the eighth bit will be the low-order bit in
   the first 8bit byte, and so on.

   Each 5-bit group is used as an index into an array of 32 printable
   characters.  The character referenced by the index is placed in the
   output string.  These characters, identified in Table 2, below, are
   selected from US-ASCII digits and uppercase letters.

                      Table 3: The Base 32 Alphabet

           Value Encoding  Value Encoding  Value Encoding  Value Encoding
               0 A             9 J            18 S            27 3
               1 B            10 K            19 T            28 4
               2 C            11 L            20 U            29 5
               3 D            12 M            21 V            30 6
               4 E            13 N            22 W            31 7
               5 F            14 O            23 X
               6 G            15 P            24 Y         (pad) =
               7 H            16 Q            25 Z
               8 I            17 R            26 2

   Special processing is performed if fewer than 40 bits are available
   at the end of the data being encoded.  A full encoding quantum is
   always completed at the end of a body.  When fewer than 40 input bits
   are available in an input group, zero bits are added (on the right)
   to form an integral number of 5-bit groups.  Padding at the end of
   the data is performed using the "=" character.  Since all base 32
   input is an integral number of octets, only the following cases can
   arise:

   (1) the final quantum of encoding input is an integral multiple of 40
   bits; here, the final unit of encoded output will be an integral
   multiple of 8 characters with no "=" padding,

   (2) the final quantum of encoding input is exactly 8 bits; here, the
   final unit of encoded output will be two characters followed by six
   "=" padding characters,

   (3) the final quantum of encoding input is exactly 16 bits; here, the
   final unit of encoded output will be four characters followed by four
   "=" padding characters,

   (4) the final quantum of encoding input is exactly 24 bits; here, the
   final unit of encoded output will be five characters followed by
   three "=" padding characters, or

Josefsson (editor)       Expires August 2, 2002                 [Page 8]

Internet-Draft            Base Encoding of Data            February 2002

   (5) the final quantum of encoding input is exactly 32 bits; here, the
   final unit of encoded output will be seven characters followed by one
   "=" padding character.

6. Base 32 Encoding with Extended Hex Alphabet

   The following description of base 32 is due to [6].  This encoding
   should not be regarded as the same as the "base32" encoding, and
   should not be referred to as only "base32".

   This encoding is identical to the previous one, except for the
   alphabet.  The new alphabet is found in table 4.

                     Table 4: The "Extended Hex" Base 32 Alphabet

           Value Encoding  Value Encoding  Value Encoding  Value Encoding
               0 0             9 9            18 I            27 R
               1 1            10 A            19 J            28 S
               2 2            11 B            20 K            29 T
               3 3            12 C            21 L            30 U
               4 4            13 D            22 M            31 V
               5 5            14 E            23 N
               6 6            15 F            24 O         (pad) =
               7 7            16 G            25 P
               8 8            17 H            26 Q

7. Base 16 Encoding

   The following description is original but analogous to previous
   descriptions.  Essentially, Base 16 encoding is the standard hex
   encoding, and may be referred to as "base16" or "hex".

   A 16-character subset of US-ASCII is used, enabling 4 bits to be
   represented per printable character.

   The encoding process represents 8-bit groups (octets) of input bits
   as output strings of 2 encoded characters.  Proceeding from left to
   right, a 8-bit input is taken from the input data.  These 8 bits are
   then treated as 2 concatenated 4-bit groups, each of which is
   translated into a single digit in the base 16 alphabet.

   Each 4-bit group is used as an index into an array of 16 printable
   characters.  The character referenced by the index is placed in the
   output string.

   This draft describe two alphabets for Base 16 encoding.  While the

Josefsson (editor)       Expires August 2, 2002                 [Page 9]

Internet-Draft            Base Encoding of Data            February 2002

   Hex alphabet is arguable more natural there may be situations with
   special constraints, such as forbidden leading digits in strings,
   which the other may be useful.  Both alphabets are to be handled case
   insensitive.

                      Table 5: The Base 16 Alphabet

         Value Encoding  Value Encoding  Value Encoding  Value Encoding
             0 0             4 4             8 8            12 C
             1 1             5 5             9 9            13 D
             2 2             6 6            10 A            14 E
             3 3             7 7            11 B            15 F

   Unlike base 32 and base 64, no special padding is necessery since a
   full code word is always available.

8. Illustrations

   To translate between binary and a base encoding, the input is stored
   in a structure and the output is extracted.  The case for base 64 is
   displayed in the following figure, borrowed from [4].

            +--first octet--+-second octet--+--third octet--+
            |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|
            +-----------+---+-------+-------+---+-----------+
            |5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0|
            +--1.index--+--2.index--+--3.index--+--4.index--+

   The case for base 32 is shown in the following figure, borrowed from
   [6].  Each successive character in a base-32 value represents 5
   successive bits of the underlying octet sequence.  Thus, each group
   of 8 characters represents a sequence of 5 octets (40 bits).

                        1          2          3
             01234567 89012345 67890123 45678901 23456789
            +--------+--------+--------+--------+--------+
            |< 1 >< 2| >< 3 ><|.4 >< 5.|>< 6 ><.|7 >< 8 >|
            +--------+--------+--------+--------+--------+
                                                    <===> 8th character
                                              <====> 7th character
                                         <===> 6th character
                                   <====> 5th character
                             <====> 4th character
                        <===> 3rd character
                  <====> 2nd character
             <===> 1st character

Josefsson (editor)       Expires August 2, 2002                [Page 10]

Internet-Draft            Base Encoding of Data            February 2002

8.1 Examples of Base 64

   This example is from [4].

          Input data:  0x14fb9c03d97e
          Hex:     1   4    f   b    9   c     | 0   3    d   9    7   e
          8-bit:   00010100 11111011 10011100  | 00000011 11011001
          11111110
          6-bit:   000101 001111 101110 011100 | 000000 111101 100111
          111110
          Decimal: 5      15     46     28       0      61     37     62
          Output:  F      P      u      c        A      9      l      +

          Input data:  0x14fb9c03d9
          Hex:     1   4    f   b    9   c     | 0   3    d   9
          8-bit:   00010100 11111011 10011100  | 00000011 11011001
                                                          pad with 00
          6-bit:   000101 001111 101110 011100 | 000000 111101 100100
          Decimal: 5      15     46     28       0      61     36
                                                             pad with =
          Output:  F      P      u      c        A      9      k      =

          Input data:  0x14fb9c03
          Hex:     1   4    f   b    9   c     | 0   3
          8-bit:   00010100 11111011 10011100  | 00000011
                                                 pad with 0000
          6-bit:   000101 001111 101110 011100 | 000000 110000
          Decimal: 5      15     46     28       0      48
                                                      pad with =      =
          Output:  F      P      u      c        A      w      =      =

9. Security Considerations

   When implementing Base 64 encoding and decoding, care should be made
   not to introduce vulnerabilities to buffer overflows.  Decoders
   should not break on invalid input including, e.g., embedded NUL
   characters (ASCII 0).

   If non-alphabet characters do not lead to rejection of the encoding
   (as recommended), covert channels will be possible.  The implications
   of this should be understood if the recommendation is not followed.

10. Acknowledgements

   Several people offered comments and suggestions, including Tony
   Hansen, Gordon Mohr, John Myers, Chris Newman.  Text used in this
   document are based on earlier RFCs describing specific uses of

Josefsson (editor)       Expires August 2, 2002                [Page 11]

Internet-Draft            Base Encoding of Data            February 2002

   various base encodings.

References

   [1]  Linn, J., "Privacy Enhancement for Internet Electronic Mail:
        Part I: Message Encryption and Authentication Procedures", RFC
        1421, February 1993.

   [2]  Freed, N. and N. Borenstein, "Multipurpose Internet Mail
        Extensions (MIME) Part One: Format of Internet Message Bodies",
        RFC 2045, November 1996.

   [3]  Bradner, S., "Key words for use in RFCs to Indicate Requirement
        Levels", BCP 14, RFC 2119, March 1997.

   [4]  Callas, J., Donnerhacke, L., Finney, H. and R. Thayer, "OpenPGP
        Message Format", RFC 2440, November 1998.

   [5]  Eastlake, D., "Domain Name System Security Extensions", RFC
        2535, March 1999.

   [6]  Klyne, G. and L. Masinter, "Identifying Composite Media
        Features", RFC 2938, September 2000.

   [7]  Myers, J., "SASL GSSAPI mechanisms", draft draft-ietf-cat-sasl-
        gssapi-01, May 2000.

   [8]  Zooko, O., "Post to P2P-hackers mailing list", World Wide Web
        http://zgp.org/pipermail/p2p-hackers/2001-September/000315.html,
        September 2001.

Author's Address

   Simon Josefsson
   Drottningholmsv. 70
   Stockholm  112 42
   Sweden

   EMail: [email-masked]

Josefsson (editor)       Expires August 2, 2002                [Page 12]

Internet-Draft            Base Encoding of Data            February 2002

Full Copyright Statement

   Copyright (C) The Internet Society (2002).  All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implementation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included on all such copies and derivative works.  However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will not be
   revoked by the Internet Society or its successors or assigns.

   This document and the information contained herein is provided on an
   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.

Josefsson (editor)       Expires August 2, 2002                [Page 13]


--=-=-=--

Date: Thu, 18 Apr 2002 23:30:36 +0100
From: Alexey Melnikov <[email-masked]>
Organization: ACI WorldWide / MessagingDirect
To: SASL MailingList <[email-masked]>
Subject: New revision of DIGEST-MD5 (draft-melnikov-rfc2831bis-00.txt) is  available
Sender: [email-masked]

client

Typo "rc4-*"

first

to

Changed:

to:

To Do:

3). More ABNF cleanup.

Other questions:

Alexey

Date: Thu, 04 Apr 2002 15:58:07 -0800
From: [email-masked] (John Myers)
To: [email-masked]
Subject: Re: SASL/GSSAPI proposed change of base32 alphabet
Sender: [email-masked]

Simon Josefsson wrote:
> The document give names to the alphabets, so making the reference to the
> "Base32 with the canonical alphabet" should be sufficient.  The encoding 
> is the same, only the alphabet differ.

If the alphabets differ then the encodings are not the same.

Names that require qualification are awkward and invite ambiguous 
references.  The term "Base64" refers to the encoding and alphabet 
defined in MIME.  If an encoding uses a different alphabet, then that is 
a variant of base64 and needs to go by a different name.

> The only use of base32 in a IETF standards track document is in RFC 2938,
> so I chosed that alphabet as the "canonical" one.

The -03 version of your document uses the sasl-gssapi alpahabet as the 
"canonical" one.  The RFC 2938 alphabet is given the name "Extended Hex".

> I'd rather drop the "Extended hex" version as well, but it seems to be in
> use.  Right now, I'm not sure if the base encoding document should
> document current practice or suggest best future practices.  For Base64
> both alphabets have useful and distinct properties, and warrant inclusion.  
> For base32, which isn't commonly used, perhaps it is not as clear.

I don't see any references in the document to uses of the "Canonical 
Base 16" alphabet.  I have strenuous objections to inventing a new 
variant of hex.

The request I've received is to make the sasl-gssapi document have a 
normative reference to the base-encoding document.  The current state of 
the base-encoding document does not make me comfortable about adding a 
dependency on it.

Date: Wed, 3 Apr 2002 10:34:17 +0200 (CEST)
From: Simon Josefsson <[email-masked]>
To: John Myers <[email-masked]>
cc: [email-masked]
Subject: Re: SASL/GSSAPI proposed change of base32 alphabet
Sender: [email-masked]

On Tue, 2 Apr 2002, John Myers wrote:

> Simon Josefsson wrote:
> > Perhaps I am being dense here, but I do not see any incompatibility
> > between the description in my draft and draft-ietf-cat-sasl-gssapi-05.txt.  
> 
> When I first scanned the document, it didn't occur to me that there 
> would be two different definitions of base32 in it.  The current 
> document is hard to reference because it defines two different 
> encodings, naming them both "base32".  It doesn't even give the two 
> encodings different section numbers.

The document give names to the alphabets, so making the reference to the
"Base32 with the canonical alphabet" should be sufficient.  The encoding 
is the same, only the alphabet differ.

> Then there's a third base32 encoding, defined by 
> draft-ietf-pkix-okid-01.txt.  This raises the question as to whether 
> sasl-gssapi should switch to the pkix-okid alphabet, vice versa, or we 
> should keep three different alphabets.  If we have three alphabets, I'm 
> not sure of the value of defining one of them as being "canonical".

The only use of base32 in a IETF standards track document is in RFC 2938,
so I chosed that alphabet as the "canonical" one.

The description in RFC 2938 is not complete though (e.g., no padding), so
I doubt it can be used as reference for base32.  The RFC 2938 alphabet is
used by some IDN proposals as well, but other than that I haven't found
any major real world use of base32.  I have not seen the alphabet in
draft-ietf-pkix-okid-01.txt before.

> I would be much more comfortable with the Joseffson document if it only 
> defined one alphabet for each encoding.

I'd rather drop the "Extended hex" version as well, but it seems to be in
use.  Right now, I'm not sure if the base encoding document should
document current practice or suggest best future practices.  For Base64
both alphabets have useful and distinct properties, and warrant inclusion.  
For base32, which isn't commonly used, perhaps it is not as clear.

Regards, Simon

Date: Tue, 02 Apr 2002 16:07:46 -0800
From: [email-masked] (John Myers)
To: [email-masked]
Subject: Re: SASL/GSSAPI proposed change of base32 alphabet
Sender: [email-masked]

Simon Josefsson wrote:
> Perhaps I am being dense here, but I do not see any incompatibility
> between the description in my draft and draft-ietf-cat-sasl-gssapi-05.txt.  

When I first scanned the document, it didn't occur to me that there 
would be two different definitions of base32 in it.  The current 
document is hard to reference because it defines two different 
encodings, naming them both "base32".  It doesn't even give the two 
encodings different section numbers.

Then there's a third base32 encoding, defined by 
draft-ietf-pkix-okid-01.txt.  This raises the question as to whether 
sasl-gssapi should switch to the pkix-okid alphabet, vice versa, or we 
should keep three different alphabets.  If we have three alphabets, I'm 
not sure of the value of defining one of them as being "canonical".

I would be much more comfortable with the Joseffson document if it only 
defined one alphabet for each encoding.  I also don't see the point of 
defining hexadecimal or a variant hexadecimal alphabet.

Date: Tue, 2 Apr 2002 11:45:15 +0200 (CEST)
From: Simon Josefsson <[email-masked]>
To: John Myers <[email-masked]>
cc: [email-masked], ietf-sasl <[email-masked]>
Subject: Re: SASL/GSSAPI proposed change of base32 alphabet
Sender: [email-masked]

On Thu, 21 Mar 2002, John Myers wrote:

> I have been requested to replace the base32 specification in the 
> (expired) SASL GSSAPI internet draft with a reference section 3 of 
> draft-josefsson-base-encoding-03.txt.  This would mean a change in the 
> encoding alphabet, breaking any implementations of the existing draft 
> which use mechanisms other than Kerberos or SPNEGO.

Perhaps I am being dense here, but I do not see any incompatibility
between the description in my draft and draft-ietf-cat-sasl-gssapi-05.txt.  
In fact, I stole the base32 description from your draft, corrected a few
cut'n'paste errors in the text describing how encoding works and added an
alternative base32 alphabet that is being used in some other protocols.  

Naturally, it could be indicated in the SASL/GSSAPI document that the
"canonical" and not the alternative alphabet is to be used.

Can you elaborate on what the incompatibilities are?