[openpgp] Alternative to Base64

Phillip Hallam-Baker <phill@hallambaker.com> Mon, 18 July 2016 18:49 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3E00612D501 for <openpgp@ietfa.amsl.com>; Mon, 18 Jul 2016 11:49:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.597
X-Spam-Level:
X-Spam-Status: No, score=-2.597 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 F8mH1ycZyTmF for <openpgp@ietfa.amsl.com>; Mon, 18 Jul 2016 11:49:05 -0700 (PDT)
Received: from mail-qt0-x22e.google.com (mail-qt0-x22e.google.com [IPv6:2607:f8b0:400d:c0d::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 086DE12B077 for <openpgp@ietf.org>; Mon, 18 Jul 2016 11:49:04 -0700 (PDT)
Received: by mail-qt0-x22e.google.com with SMTP id w38so96819364qtb.0 for <openpgp@ietf.org>; Mon, 18 Jul 2016 11:49:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to; bh=K8/gchRcrjJt5QzvNUgQ69Zx/J3HvNQCehbENsUGyMc=; b=YgyFGE91c74VYGJBPedq5kmTFIQ0QfLSdPYcH3u6x86xxebSAJm7/8SZ+1GiIuCeQ/ 08PtYgO7mTsOVB/wqzSFR9fChWxCtxCyFmIEJR8AhHO5ZAd1ewWpXXL17PgdZAg/eGUp /apbUa89nz0RAYpUDtGQ4UKFHtKY/PSEULB7UGdIBC6gjgmfey4U/zzvDtUFQnLDnQkc urmrWma/GFA81aN8eC981hek1MI96zlPpcKWUI6omxRCsUoo1u+OLovTL/w1J7kKwez4 grzL6GLvkb58gCqemm+T2G5/SGd/CWuuVwICKvToN72rX/6GISxbUTkTCLnCL6/pzv62 1SUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=K8/gchRcrjJt5QzvNUgQ69Zx/J3HvNQCehbENsUGyMc=; b=LpK1tDzcrMKfHw0RxU9N780VrWE+cDbAgR4NO56+65fMHuP+tdTdDe4ZlPwQdz1/5L ixQGppE4cXZUA5Ho1KxpP02ujxdYrHwwlscPXaHTiSwOiTqi8hFHWFysfrl1g2H83gXD 48xhO8t9uG++7MNpeXcNDI0M767XgC+RImnyP+qJGDqAXKg8cnkWB6C4z1dr5ZhAPiG2 GTW357ObBy3rGLgLDeAr2bi3kdykbKWoXubmn9PefwatN5ddV3gVHmisxVAqF+bTi/rh b2da9ajnR/pqDNHLTReUV54VBuuYRJioaoABN1YTcZLxZ+ZAI8hRMojNaMD+rDzhDacm Y2WA==
X-Gm-Message-State: ALyK8tKpdIpDfDRkClBPMR4VUUPxHUS/GMSXSpUL6NFd2GTGjZ/NFpljgcxp51fNc3/Eyc5G3dkcM3FjUVEbng==
X-Received: by 10.200.55.91 with SMTP id p27mr53050640qtb.48.1468867744093; Mon, 18 Jul 2016 11:49:04 -0700 (PDT)
MIME-Version: 1.0
Sender: hallam@gmail.com
Received: by 10.55.16.106 with HTTP; Mon, 18 Jul 2016 11:49:03 -0700 (PDT)
From: Phillip Hallam-Baker <phill@hallambaker.com>
Date: Mon, 18 Jul 2016 20:49:03 +0200
X-Google-Sender-Auth: c_adZ-Fy4Ed7uFQSqBV9b9s9MFw
Message-ID: <CAMm+LwgPRSnPrL_AKwwyOsfYRsJ-n6j6gUQ7aCU-=GqAW7D41w@mail.gmail.com>
To: IETF OpenPGP <openpgp@ietf.org>, Russ Housley <housley@vigilsec.com>
Content-Type: multipart/alternative; boundary="001a113988021bdca40537ed6c69"
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/Q9LruEhDsbVKX091zq40LgSRLX4>
Subject: [openpgp] Alternative to Base64
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Jul 2016 18:49:07 -0000

As we discussed after the meeting,

* Yes Base64 sucks

* Yes alleged 'binary' transport SMTP also sucketh because dimwits insert
CRLFs to wrap lines.

There is an alternative that could be used, yenc is widely implemented on
USENET.

http://www.yenc.org/yenc-draft.1.3.txt :

 1. Fetch a character from the input stream.
 2. Increment the character's ASCII value by 42, modulo 256
 3. If the result is a critical character (as defined in the previous
    section), write the escape character to the output stream and increment
    character's ASCII value by 64, modulo 256.
 4. Output the character to the output stream.
 5. Repeat from start.

Critical characters include the following:

ASCII 00h (NULL)
ASCII 0Ah (LF)
ASCII 0Dh (CR)
ASCII 3Dh (=)


It ain't perfect but it is about 98% efficient and we need not
necessarily do that exact scheme.