Re: [lamps] draft-ietf-lamps-samples: PKCS12 expertise needed (including objects for comparison)

Ryan Sleevi <ryan-ietf@sleevi.com> Thu, 05 August 2021 15:04 UTC

Return-Path: <ryan.sleevi@gmail.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 6D9C73A157E for <spasm@ietfa.amsl.com>; Thu, 5 Aug 2021 08:04:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.645
X-Spam-Level:
X-Spam-Status: No, score=-1.645 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
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 Nl4sJyHtgQ7N for <spasm@ietfa.amsl.com>; Thu, 5 Aug 2021 08:03:59 -0700 (PDT)
Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 262883A157A for <spasm@ietf.org>; Thu, 5 Aug 2021 08:03:59 -0700 (PDT)
Received: by mail-pj1-f43.google.com with SMTP id u5-20020a17090ae005b029017842fe8f82so909287pjy.0 for <spasm@ietf.org>; Thu, 05 Aug 2021 08:03:59 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NWoC1ToJYYPIvcwcCprqYOVF/wL8v9W/vbzCZV+YJk8=; b=sZHsI9Mi9+Sl6eN/q//kl095EOHC5KAYh9FMTS4KV+TAaJJmWdaWONzLxL3LITqXjo 2KPnomQmAVQNtEuZZU6czBxbfxyI2l1RanbHHHSi0T0kYRXvUPetGJYplheXWAhn0URu RNsgiD1xqcLKpwR8IXklEaGyQs8QRB+Tkx5tUzs2ym/LfG2cBYs/3aloVQIJ3Gs6kjH2 +9fmG+2yTcXAR23+c/n/MepYNcmM/xN+eBnwFzaFZVaRcSlqKHC0t4ntc95kG3ZVbCpp /CcwHewkQHFCVPR/ErL3vOc16FgWN6s6+3jgbtdUxAoCa9sQogyQ8UWMucj/eGE6TWKp w7/w==
X-Gm-Message-State: AOAM531jbwWtQnLtg9jR8yozNut+ogL0I0xxjmZ9iZ4ZesiLPvl9zddE qFBq4gQ4CFk8I/3SVDGC6aHHheT4xNY=
X-Google-Smtp-Source: ABdhPJyrTPrS/fmZmuSBLl+pMQnMd4yN2pFg0zYigI0v6hTf282pkh6X8k9hSAkOgd5tOCBqOwkYXA==
X-Received: by 2002:a17:90a:4b02:: with SMTP id g2mr5129837pjh.44.1628175838337; Thu, 05 Aug 2021 08:03:58 -0700 (PDT)
Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com. [209.85.216.52]) by smtp.gmail.com with ESMTPSA id v30sm8508626pgk.25.2021.08.05.08.03.58 for <spasm@ietf.org> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Aug 2021 08:03:58 -0700 (PDT)
Received: by mail-pj1-f52.google.com with SMTP id u13-20020a17090abb0db0290177e1d9b3f7so15507391pjr.1 for <spasm@ietf.org>; Thu, 05 Aug 2021 08:03:58 -0700 (PDT)
X-Received: by 2002:a17:90a:4306:: with SMTP id q6mr15461474pjg.202.1628175837891; Thu, 05 Aug 2021 08:03:57 -0700 (PDT)
MIME-Version: 1.0
References: <87czr0ww0d.fsf@fifthhorseman.net> <FF939B28-528B-47F9-9C0C-6585D1B02FBE@vigilsec.com> <87mtq3ukk0.fsf@fifthhorseman.net> <CAErg=HHQMZ1jk+bVxA=MzVvW+9ucie7bu-N6O8Asnp0V8Rf9Bg@mail.gmail.com> <30546.1627850836@localhost> <CAErg=HHKL-E5yT0UnPKcLfMQU41iDg7GGgjsSXs3eRg8daJRkg@mail.gmail.com> <87wnp347iu.fsf@fifthhorseman.net> <1388.1627996026@localhost> <87pmuu42hf.fsf@fifthhorseman.net> <87mtpy3zkl.fsf@fifthhorseman.net> <CAErg=HFvQ=5jN+BoDL-W33iYxHoPULov4TEzqYf9nONbtnANJQ@mail.gmail.com> <87a6lw4syd.fsf@fifthhorseman.net>
In-Reply-To: <87a6lw4syd.fsf@fifthhorseman.net>
From: Ryan Sleevi <ryan-ietf@sleevi.com>
Date: Thu, 05 Aug 2021 11:03:46 -0400
X-Gmail-Original-Message-ID: <CAErg=HFw2bS-G-q2LppCQZ8HZ9qL2pgOfebn7nnxA4Nh3WCnEQ@mail.gmail.com>
Message-ID: <CAErg=HFw2bS-G-q2LppCQZ8HZ9qL2pgOfebn7nnxA4Nh3WCnEQ@mail.gmail.com>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Cc: LAMPS WG <spasm@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000007310f405c8d13a1f"
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/bOv69FZzykRJZSlTvUTZWGF_MJ0>
Subject: Re: [lamps] draft-ietf-lamps-samples: PKCS12 expertise needed (including objects for comparison)
X-BeenThere: spasm@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "This is a venue for discussion of doing Some Pkix And SMime \(spasm\) work." <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: Thu, 05 Aug 2021 15:04:04 -0000

On Wed, Aug 4, 2021 at 8:49 PM Daniel Kahn Gillmor <dkg@fifthhorseman.net>
wrote:

> > As Russ and I both noticed, it would appear bob.p12 is going directly
> > to a SEQUENCE, rather than OCTET STRING -> SEQUENCE.
>
> The tooling i've been playing with confirms this read.
>

Right, but bob.p12 does not appear to match this (it goes data -> SEQUENCE,
not data -> OCTET STRING -> SEQUENCE, unless I'm truly holding things
wrong), and that's why I was trying to understand the process for that
being generated.


> From what i can tell, both of these PKCS12 objects are in the definite
> form (good), but both also appear to show only one layer of OCTET STRING
> encoding around the SEQUENCE.  Can you confirm?
>

Right, my previous message tried to explain that this is expected from DER
encoding. The single layer of OCTET STRING is the correct form, the
multiple layers I mentioned were a quirk of how indefinite BER (which NSS
was generating, and which I overlooked) was generating. So we should ignore
this as being the cause here - it was very much PEBKAC on my part for
overlooking the indefinite length on the BER.


> So, if my analysis is correct, maybe the issue isn't about layers of
> OCTET STRING but rather something about the struture of the PKCS#12
> object itself inside those layers?
>

Yes


> Some theories worth testing:
>
>  a) The order of the certificates and encrypted pkcs8 blobs might
>     matter.
>
>  b) The absence of the friendlyName on bob.p12[bag[1]] might matter.
>
> Are there rules for how a PKCS#12 interpreter is supposed to associate
> private keys with certificates that depend on both friendlyName and
> localKeyID matching within the bundle?
>

I don't see any such rules about matching, period, in RFC 7292.