Re: [netmod] Strictness of Base64classic in RFC 7950/7951

Kent Watsen <kent+ietf@watsen.net> Mon, 27 February 2023 19:59 UTC

Return-Path: <010001869475834a-96c9705a-2f88-416c-af73-da2d36d00b8e-000000@amazonses.watsen.net>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C7460C14F739 for <netmod@ietfa.amsl.com>; Mon, 27 Feb 2023 11:59:40 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.896
X-Spam-Level:
X-Spam-Status: No, score=-6.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazonses.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2wvAkbMcV0Zb for <netmod@ietfa.amsl.com>; Mon, 27 Feb 2023 11:59:37 -0800 (PST)
Received: from a48-110.smtp-out.amazonses.com (a48-110.smtp-out.amazonses.com [54.240.48.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DFC02C14CE5F for <netmod@ietf.org>; Mon, 27 Feb 2023 11:59:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1677527974; h=From:Message-Id:Content-Type:Mime-Version:Subject:Date:In-Reply-To:Cc:To:References:Feedback-ID; bh=4x+UvmppqqpXIHIzre4c5/HpyPigZxazBFT31wTKi/g=; b=GFLSqk0mDNPdvFaVX4v7R/jAVeJFfDlRl0PKBPxpSidZDrhyBi9RRUV73s9vTT4L 7xKiUZvUHSMuiFmWgH/Hx72m/jKBKQfU3CvQ90Hbobv/BLnjOP0YlvHSzxjSy1fQsjL YzMJQTg6+MptUE/DAdMJ70096UD2TsK2YT/d1l28=
From: Kent Watsen <kent+ietf@watsen.net>
Message-ID: <010001869475834a-96c9705a-2f88-416c-af73-da2d36d00b8e-000000@email.amazonses.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_4F5418FD-FF17-4982-95E3-F3763DADD06F"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\))
Date: Mon, 27 Feb 2023 19:59:34 +0000
In-Reply-To: <F8312FB3-42FC-44D8-8D89-08BD3C95FAFF@tzi.org>
Cc: Ladislav Lhotka <ladislav.lhotka@nic.cz>, "netmod@ietf.org" <netmod@ietf.org>
To: Carsten Bormann <cabo@tzi.org>
References: <C4CA45AE-4294-48FF-9210-16783A4B6FEC@tzi.org> <877cw3jp7w.fsf@nic.cz> <0DC09E3A-D200-4C25-BBF9-4CA43FBA2DFD@tzi.org> <6a0ac8c0-e0c9-32bc-cdd6-09ef57b8193b@nic.cz> <F8312FB3-42FC-44D8-8D89-08BD3C95FAFF@tzi.org>
X-Mailer: Apple Mail (2.3731.400.51.1.1)
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
X-SES-Outgoing: 2023.02.27-54.240.48.110
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/BZT6n1I--aYn_M4Ih2JTr18yE0U>
Subject: Re: [netmod] Strictness of Base64classic in RFC 7950/7951
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 27 Feb 2023 19:59:40 -0000

This was discussed in late 2021.   I switched from:

	base64encodedvalue==

to:

	BASE64VALUE=

in all my drafts then.  Which document are you looking at?

Kent




> On Feb 27, 2023, at 9:24 AM, Carsten Bormann <cabo@tzi.org> wrote:
> 
> On 2023-02-27, at 15:04, Ladislav Lhotka <ladislav.lhotka@nic.cz> wrote:
>> 
>> Unlike non-alphabet characters, RFC 4648 doesn't say that such a character in encoded data is invalid.
> 
> Not explicitly, but it also gives you an algorithm for arriving at the encoded value that never can result in the characters that I consider invalid [1]:
> 
>   When fewer than 24 input
>   bits are available in an input group, bits with value zero are added
>   (on the right) to form an integral number of 6-bit groups.  
> 
> Note the explicit “with value zero”.
> 
>> FWIW, my implementation (Yangson) uses Python standard library base64 that accepts it without complaints even with validation turned on:
>> 
>>>>> import base64
>>>>> base64.b64decode("ue==", validate=True)
>> b'\xb9'
>> 
>> So I assume the authors consider this input valid, and I saw no reason to be concerned about it.
> 
> Thank you — that was the kind of input I was looking for.
> 
> Now what do other implementations do?
> 
> Grüße, Carsten
> 
> [1]: https://www.rfc-editor.org/rfc/rfc4648#page-6
> 
> And the missing [2] from my previous message:
> [2]: https://www.ietf.org/archive/id/draft-bormann-cbor-cddl-more-control-00.html#name-byte-strings-base16-hex-bas
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod