Re: [openpgp] Algorithm-specific data: problems with Simple Octet Strings, and possible alternatives

Wiktor Kwapisiewicz <wiktor@metacode.biz> Wed, 31 March 2021 07:51 UTC

Return-Path: <wiktor@metacode.biz>
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 ABC513A1ECB for <openpgp@ietfa.amsl.com>; Wed, 31 Mar 2021 00:51:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=metacode.biz
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 qmo7carg4bro for <openpgp@ietfa.amsl.com>; Wed, 31 Mar 2021 00:51:44 -0700 (PDT)
Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (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 A74F73A1EC8 for <openpgp@ietf.org>; Wed, 31 Mar 2021 00:51:43 -0700 (PDT)
Received: by mail-wr1-x436.google.com with SMTP id k8so18643788wrc.3 for <openpgp@ietf.org>; Wed, 31 Mar 2021 00:51:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metacode.biz; s=2017; h=to:references:cc:from:organization:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Wju8KxujUNBDoYn5ETlPhnSM4omg6MhSY6/xO87p4NU=; b=ORziVDHUhK1KnitdmqmInLjZUCKe58xcvSQFIyB9vFr+JZxJbA9HlKxq43xFEtQK9k a7t/TUzLwOfwRzXwygWf+MYgnsXcW8NxMgUbo49pjipSPQxAsquXWgPwY21DxHXHMSj5 DBBpA6Mn493t+YUXmDUGOXJvf/ChdVcjNzeYcd23fZ5Bt4aPhmpAnQPTv9I5s8Kx8T8H 45TDt6n1N60gUKsbUfmpuevx5oCASrAtKGEIjvl4xD+/8x/vO96ybmSAhD25wlg6ns7+ uM6yXJloaiFVyTPBwX96OSmrj4duPTyZuTDGK2A/jnEi0OX9Xg8W7L4C6jnHdNfFjLiI ucMA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:cc:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Wju8KxujUNBDoYn5ETlPhnSM4omg6MhSY6/xO87p4NU=; b=unO+z9c31jJxXUnZ2Q4s3VQuqym++r+Suf1MiP1DacDntb2srkvuhLQSPJkanJAL64 Pe8mSdODAoHeLGH+E0lZu0tJmBq4mFcj/lgxkx11C5+Fd0EJH7pqY5k0LsNfxLk2QNXk A6wOgCz9Kk6ujWQVUqZsm6zugxe7BSGLRNR/uzU6S/MuODHzgZhVECMY0Eu8k0xGk6Zk crXEPN7p3bhxZmppPf41SA68buO8JJuaw0eS3ot8NNC39gN6sifmSS6OdmfL7WhXZ2FS CkfcLkb9Zey5ltCZHKCsMcj3TwADVEfO6Pxe934lEPaekHeSqcbT2w4apNhlyqhl7tsi 2bLA==
X-Gm-Message-State: AOAM532hxZQrASJeH7IojdNLvb6xKriX2NC/SfC7ih+3EhnLStlaTxSl lwxEQUf9lihHZGdyglUkn3VEk99bSIrnsw==
X-Google-Smtp-Source: ABdhPJy+9PIEEmoG1K+apumIIB6u5jPy86zQvau8grZa3deREb5UfQ0/jgUuXEuE3O/P03i0dsgLbg==
X-Received: by 2002:a5d:6d48:: with SMTP id k8mr2072000wri.93.1617177101329; Wed, 31 Mar 2021 00:51:41 -0700 (PDT)
Received: from [192.168.1.202] (public-gprs409405.centertel.pl. [37.47.230.126]) by smtp.googlemail.com with ESMTPSA id n9sm2824142wrx.46.2021.03.31.00.51.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 31 Mar 2021 00:51:40 -0700 (PDT)
To: =?UTF-8?B?w4FuZ2Vs?= <angel@16bits.net>
References: <87eeg42gti.fsf@fifthhorseman.net> <f26e29d001224fc09e587b696416188a6fb6cc41.camel@16bits.net>
Cc: openpgp@ietf.org
From: Wiktor Kwapisiewicz <wiktor@metacode.biz>
Organization: Metacode
Message-ID: <bcffbe40-fd7d-cebf-3c17-087228ce3199@metacode.biz>
Date: Wed, 31 Mar 2021 09:51:43 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0
MIME-Version: 1.0
In-Reply-To: <f26e29d001224fc09e587b696416188a6fb6cc41.camel@16bits.net>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/cyaGxGuAzSN-ZUSm6Fi_64Bh0EM>
Subject: Re: [openpgp] Algorithm-specific data: problems with Simple Octet Strings, and possible alternatives
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.29
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: Wed, 31 Mar 2021 07:51:50 -0000

Hi Ángel,

Just a minor note from me reading the MPI section:

On 26.03.2021 03:44, Ángel wrote:
> Spurious leading zeroes (e.g. [00 09 00 00 00 01 FF]) are not allowed
> now.

If by "now" you mean MPIs then a careful reading of "3.2. 
Multiprecision Integers" [0] reveals that was is forbidden is counting 
leading zeros in length. If the length is properly computed ("starting 
from its most significant non-zero bit") then there is nothing that 
prevents implementations from inserting zero bytes between length and 
the first non-zero byte.

[0]: https://tools.ietf.org/html/rfc4880#section-3.2

Example:

"Thus, the MPI [00 02 01] is not formed correctly.  It should be [00 01 
01]."

But there is no rule that prevents [00 01 00 01] from being valid.

Kind regards,
Wiktor