Re: [netconf] base64encodedvalue== is an invalid base64 value

Kent Watsen <kent+ietf@watsen.net> Fri, 29 January 2021 23:26 UTC

Return-Path: <0100017750786b5f-6f9004c8-d56f-4f67-802b-09154dce9f3c-000000@amazonses.watsen.net>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 72EA83A1388 for <netconf@ietfa.amsl.com>; Fri, 29 Jan 2021 15:26:47 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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 ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nsVevdf4eLZI for <netconf@ietfa.amsl.com>; Fri, 29 Jan 2021 15:26:46 -0800 (PST)
Received: from a8-96.smtp-out.amazonses.com (a8-96.smtp-out.amazonses.com [54.240.8.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6560D3A1387 for <netconf@ietf.org>; Fri, 29 Jan 2021 15:26:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=224i4yxa5dv7c2xz3womw6peuasteono; d=amazonses.com; t=1611962805; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References:To:Feedback-ID; bh=gzQnBeTKDiPEOJ+F47OMhyn0xLVE+OBlnkItAnhw+Og=; b=D/1kzMTI1fklmNiJr0Ir1A4txjIIz5jPFwrImG1KYrTMNFyen3XVySmRsgUbWQha KiFUkTc5rl4QXTsILw9T+JZK9kePkLWBdVSD9dPSSO1BfTgFz6EoHxoK5CKLhNQ3LNB 4rieC/Lh3MZ/L1BHmBLy7rRePsx1xokBk87QzOx0=
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\))
From: Kent Watsen <kent+ietf@watsen.net>
In-Reply-To: <6A06C21C-70F1-40D7-A690-B2AC94BC9CB3@tzi.org>
Date: Fri, 29 Jan 2021 23:26:45 +0000
Cc: "netconf@ietf.org" <netconf@ietf.org>
Content-Transfer-Encoding: quoted-printable
Message-ID: <0100017750786b5f-6f9004c8-d56f-4f67-802b-09154dce9f3c-000000@email.amazonses.com>
References: <010001774f5f7df0-89830501-6d1a-465b-a172-dd95e98e8a3e-000000@email.amazonses.com> <20210129191142.lxhtegbkgan37oyj@anna.jacobs.jacobs-university.de> <6A06C21C-70F1-40D7-A690-B2AC94BC9CB3@tzi.org>
To: Carsten Bormann <cabo@tzi.org>
X-Mailer: Apple Mail (2.3608.80.23.2.2)
X-SES-Outgoing: 2021.01.29-54.240.8.96
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/tcFC9jwwY43AkOefBX6CSRcCNeo>
Subject: Re: [netconf] base64encodedvalue== is an invalid base64 value
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETCONF WG list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Jan 2021 23:26:47 -0000

>> Who cares whether this value roundtrips in an examples??
> 
> I’d expect at least some decent implementations will check for RFC 4648’s mandate "These pad bits MUST be set to
>   zero by conforming encoders”, just like some check for the right number of equals signs.
> Examples that fail in decent implementations are suboptimal.
> (They might even be used in arguments to claim that this decency needs to be removed.)



`base64` doesn’t produce a warning:

    $ echo "base64encodedvalue==" | base64 -d | base64
    base64encodedvaluQ==



`openssl` doesn’t produce a warning:

    $ echo "base64encodedvalue==" | openssl enc -d -base64 -A | openssl enc -base64 -A
    base64encodedvaluQ==



Python doesn’t produce a warning:

    $ printf "import binascii\nprint(binascii.b2a_base64(binascii.a2b_base64('base64encodedvalue=='), newline=False).decode('ascii'))" |  python -
    base64encodedvaluQ==