Re: [lamps] WG Last Call for draft-ietf-lamps-pkcs12-pbmac1-02

Hubert Kario <hkario@redhat.com> Mon, 06 November 2023 19:53 UTC

Return-Path: <hkario@redhat.com>
X-Original-To: spasm@ietfa.amsl.com
Delivered-To: spasm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B8135C18FCDA for <spasm@ietfa.amsl.com>; Mon, 6 Nov 2023 11:53:51 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.106
X-Spam-Level:
X-Spam-Status: No, score=-2.106 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.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 N91ltPtRQdhw for <spasm@ietfa.amsl.com>; Mon, 6 Nov 2023 11:53:51 -0800 (PST)
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 02528C18FCC3 for <spasm@ietf.org>; Mon, 6 Nov 2023 11:53:50 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699300430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UQV9ZsVQEV8n7Nc/C3D7/X80gxJk8D0nobGHzg/I2I4=; b=YuWqzE24hnXrcZGU14DOddPL2Sk1Tovb2e5Z00/5ZSy3QXUjwgZ3385rs1UgBWBfR4oXuV O8uRcxYLpvcDpNjO3u/mxxXNYaKLs3lpTgIksWvq7S3DoifhdyTnD1GJzKMLYl9XiCaI0m y+ByrghNfjYB5Bhf3Z2pUPOGH7hVGFc=
Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-rK-AgAduM32IYOQcu1BwOA-1; Mon, 06 Nov 2023 14:53:38 -0500
X-MC-Unique: rK-AgAduM32IYOQcu1BwOA-1
Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-54455e2a5c8so1680887a12.3 for <spasm@ietf.org>; Mon, 06 Nov 2023 11:53:38 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699300418; x=1699905218; h=content-transfer-encoding:user-agent:organization:references :in-reply-to:message-id:mime-version:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XKK76lgnhGBnAa3z7HCXsShCAD68WrhwE+qqa9SiTKA=; b=bQkhD1/92Ex2T3wLw1IHjSmCssqSgCvRoC8JEhlDlxuYwKmQl4Vm+5R0Iygc2a8I+a /1YDgjDsTXL9bJs/ZCMehTx4Xc2OtKeXYlGe/VjwJ1dWsf63WOBYGR04hzw8gp21YMbS jmmNYfVfhDyeDysy/WtVD4eYS5q+wiZ3oXVMvPlo1HOwvzdRaowCEd2tpPCelTHRq4QJ FHT0WuyL60TCKYU9JKCMua4hdCEakwqpNggccLoCD21BI/+y4n2G0G2jEiJPSyW/iCuz xD+LceUH2GOvcxBr8sAQ59KjGHS9k5DaKZtJk9L0AzM+1P/emhKci59QI9bbdSUPVCNf 7DEA==
X-Gm-Message-State: AOJu0Yz+rHSm+M2H2Pc1pnv3aezy3bNCBSzS7Q1z6A+ml/dYPjPIgWNq 1C8B+vkHlwuzgHfA5uaZIU7YIXuHjPzM93nnx0P18xjW2CN8O4wp62KKdCUsTh7pKZbB107S1BU TUPUKEw==
X-Received: by 2002:a50:a45b:0:b0:543:5fc0:de22 with SMTP id v27-20020a50a45b000000b005435fc0de22mr17946848edb.24.1699300417753; Mon, 06 Nov 2023 11:53:37 -0800 (PST)
X-Google-Smtp-Source: AGHT+IH0ULAhRrCh0sNvtUts8WrgVO4vMXWhIORvXGwBmN6FnPpDdJXgaMgZHxnj2hbmF6NkI3ccEA==
X-Received: by 2002:a50:a45b:0:b0:543:5fc0:de22 with SMTP id v27-20020a50a45b000000b005435fc0de22mr17946838edb.24.1699300417451; Mon, 06 Nov 2023 11:53:37 -0800 (PST)
Received: from localhost ([213.235.133.41]) by smtp.gmail.com with ESMTPSA id e18-20020a50d4d2000000b00543820cd70asm4806094edj.93.2023.11.06.11.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 11:53:37 -0800 (PST)
From: Hubert Kario <hkario@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: "Salz, Rich" <rsalz=40akamai.com@dmarc.ietf.org>, Russ Housley <housley@vigilsec.com>, LAMPS <spasm@ietf.org>
Date: Mon, 06 Nov 2023 20:53:35 +0100
MIME-Version: 1.0
Message-ID: <117b8392-dc50-4780-bbcf-6f5a0b265276@redhat.com>
In-Reply-To: <23453e52e5128cd4eb96e04c3da2d294c3df0579.camel@infradead.org>
References: <C61AE8CA-3692-43E0-ACE4-8BB0DEDB6D8B@vigilsec.com> <49C2F154-5545-4B33-8F82-F0E117E27A72@akamai.com> <11ee8b09d53b1e250b931384bb05e92bbcbf8191.camel@infradead.org> <78114a97-b76e-414f-bef1-ce93bb93728a@redhat.com> <029c803a7d4a931076d9b1ac52881f127fd99272.camel@infradead.org> <6cc34c56-3211-421f-b94d-dcd5e73bbe1e@redhat.com> <244e5470c740a85bb87e83645b537883dcdf4aa0.camel@infradead.org> <eb3f87cc-af9a-463a-a17e-2f056ee1e14f@redhat.com> <7825bd846ac983257be347b991f455d44e087681.camel@infradead.org> <b5da4714-fead-4a95-9d4c-4169d79acf3c@redhat.com> <23453e52e5128cd4eb96e04c3da2d294c3df0579.camel@infradead.org>
Organization: Red Hat
User-Agent: Trojita/0.7-git; Qt/5.15.9; xcb; Linux; Fedora release 37 (Thirty Seven)
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/JzZnY7DKLzGsiOrjIUogdApRlYs>
Subject: Re: [lamps] WG Last Call for draft-ietf-lamps-pkcs12-pbmac1-02
X-BeenThere: spasm@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: This is the mail list for the LAMPS Working Group <spasm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/spasm>, <mailto:spasm-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/spasm/>
List-Post: <mailto:spasm@ietf.org>
List-Help: <mailto:spasm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/spasm>, <mailto:spasm-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 06 Nov 2023 19:53:51 -0000

On Monday, 6 November 2023 18:44:19 CET, David Woodhouse wrote:
> On Mon, 2023-11-06 at 16:50 +0100, Hubert Kario wrote:
>> On Monday, 6 November 2023 15:55:07 CET, David Woodhouse wrote:
>>> On Wed, 2023-11-01 at 19:48 +0100, Hubert Kario wrote: ...
>> 
>> I have no problem with requiring BMPString. That's exactly what I want to
>> happen and what must happen for interoperability.
>> 
>> Please propose a phrasing for that section that you find sufficient
>> for that.
>
> Happy to do so! I had thought we were arguing about the necessity of
> doing just that :)
>
>     <section title="Password encoding">
>         <t>As documented in <xref target="RFC7292">Appendix B.1 of RFC
>         7292</xref> handling of password encoding in the 
> underlying standards
>         is underspecified. However, just as with PBES1 and 
> PBES2 when used in
>         the context of PKCS#12 objects, all passwords used with PBMAC1 MUST
>         be created from BMPStrings with a NULL terminator.
>         </t>
>     </section>
>
> https://github.com/tomato42/id-pkcs12-pbmac1/pull/5
>
>
> I didn't manage to slip in the part about recommending that the *same*
> password be used for all encrypted PDUs and the overall MAC. That would
> want to be in a separate section rather than 'Password encoding', I
> think?

It's just a recommendation, and already established general practice anyway
(I know of only openssl being able to create files with different
passwords, and just few implementations can handle them anyway),
so I'm fine with it being omitted.

> If we are indeed agreeing that the password encoding MUST be a
> BMPString, can I have another try at persuading you that the test
> password you use should be more adventurous? I thought you were
> previously saying that a more interesting test password would overstep
> the mark of what's actually being specified... but I don't think it
> does?
>
> My preferred test suite password is just two characters:
>
>    U+0102 LATIN CAPITAL LETTER A WITH BREVE
>    U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE
>
> That would give 0x01 0x02 0x01 0x7b 0x00 0x00 for the BMPString
> encoding.
>
> And that's completely specified and required by the wording above,
> which I hope reflects what you agreed? So could we use something like
> that instead of just "1234"? 

First let me be cheeky: but that file is encrypted with a Unicode password 
of
'①²³4', it just uses the correct Unicode NFKC normalisation!
That is:
U+2460    CIRCLED DIGIT ONE
U+00B2    SUPERSCRIPT TWO
U+00B3    SUPERSCRIPT THREE
U+FF14 	FULLWIDTH DIGIT FOUR

Secondly, more serious answer:
While users do expect that password entered using different input methods
ends up deriving the same encryption keys, the way to do that isn't exactly
straight-forward.

Because while having "ó" (U+00F3 LATIN SMALL LETTER O WITH ACUTE)
and the "ó" (U+006F LATIN SMALL LETTER O, U+0301 COMBINING ACUTE ACCENT)
producing the same password is expected and even, I'd say, wanted, 
having symbols like "²" (SUPERSCRIPT TWO) being converted to ASCII "2" 
isn't.
Ligatures are an area where we do want the "ffi" (LATIN SMALL LIGATURE FFI)
to be converted to "ffi".

So, what kind of normalisation should be used is the first issue.

The other issue is how you achieve that: the library to handle that
normalisation is anything but small. We'd be asking people to link their
cryptographic libraries with libraries two to four times the size of the
crypto lib.

Lastly, how do you handle legacy files, from before when "²" were converted
to "2"? What if the file was created with a Unicode library version that
didn't recognise the new emoji with "1" in it as a digit and convert it
to arabic numeral 1 under NFKD?

All of that would have to be agreed on and specified. We would end up with
a document longer than the existing one.

So, I'm against including it not because I don't think it's important,
but because I'm well aware of the scope of work to do it right.
-- 
Regards,
Hubert Kario
Principal Quality Engineer, RHEL Crypto team
Web: www.cz.redhat.com
Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno, Czech Republic