Re: [apps-discuss] [pkix] PKIX text encodings

Paul Hoffman <> Sat, 28 January 2012 04:29 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id B1BC621F8508; Fri, 27 Jan 2012 20:29:30 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -102.554
X-Spam-Status: No, score=-102.554 tagged_above=-999 required=5 tests=[AWL=0.045, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id a--o+5S0Gyju; Fri, 27 Jan 2012 20:29:30 -0800 (PST)
Received: from (IPv6.Hoffman.Proper.COM [IPv6:2605:8e00:100:41::81]) by (Postfix) with ESMTP id 2DA4A21F84FF; Fri, 27 Jan 2012 20:29:30 -0800 (PST)
Received: from [] ( []) (authenticated bits=0) by (8.14.5/8.14.3) with ESMTP id q0S4TRt7084777 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 27 Jan 2012 21:29:28 -0700 (MST) (envelope-from
Mime-Version: 1.0 (Apple Message framework v1251.1)
Content-Type: text/plain; charset="iso-8859-1"
From: Paul Hoffman <>
In-Reply-To: <>
Date: Fri, 27 Jan 2012 20:29:27 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <>
References: <>
X-Mailer: Apple Mail (2.1251.1)
Subject: Re: [apps-discuss] [pkix] PKIX text encodings
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Sat, 28 Jan 2012 04:29:30 -0000

On Jan 27, 2012, at 4:37 PM, Martin Rex wrote:

> Paul Hoffman wrote:
>> Martin Rex wrote:
>>> the Label that is used within '-----BEGIN <some-label>----'
>>> should be ignored on the receiver side, and all implemented formats
>>> should be tried, that are applicable for the requested operation.
>> This would cause things like private keys and public keys to be mixed up.
> Not necessarily.  If your ASN.1 decoder can not distinguish your private
> from your public key, then you have a whole different kind of problem.

Indeed, but it is a new problem that you probably didn't plan for. There is no need to introduce the problem at this late date.

>> I propose this is not a good idea from a security perspective.
> Huh?  That textual label is not integrity protected in any way,
> so how should this be a security problem?

These blobs are often handed around out-of-band, so removing a bit of information can indeed introduce a security problem.

> This is really only about convenience for admins.

That's one view, but not the only one.

>> Instead, Simon might add some text saying that some applications
>> sometimes ignore the label in order to be more liberal, but in doing
>> so can cause problems with systems that assume those labels are important.
> HUH?  How could being liberal on *INPUT* possibly cause problems?
> Any reasonable ASN.1 decoder can reliably tell apart
>  - X.509 certificates
>  - private keys
>  - encrypted private keys
>  - pkcs10 requests
>  - crls
>  - pkcs7/cms 
>  - pkcs7/cms as certificate bag
>  - pkcs7/cms as crl bag
>  - pkcs12
> So any implementation that is ignoring the explicit label, will have to
> use the implicit label from successfuly ASN.1 decode of the types
> of objects that are applicable for the requested operation.

You are assuming, I believe incorrectly, that the ASN.1 decoding is happening in the same part of the system as the base64 decoding. That's not a safe assumption. In your code, it might be fine; it is probably not fine in all code. Why throw away valuable information?

> Microsoft seems to ignore the label.  If you double-click on
> a pkcs7 file (extension .p7s or .p7b) it will be PEM-decoded independent
> of what label is used.  Same for certificate (.cer).

Um, so? That's one implementation.

> I find it much more confusing when only a few, but non-unique labels
> are accepted:
> OpenSSL seems to accept certs with "X509 CERTIFICATE" and "CERTIFICATE"
> and PKCS7 as "PKCS7" or "CERTIFICATE" but _not_ "X509 CERTIFICATE"

Fully agree. That's why it is good that someone (Simon!) is doing this work.

>> Just a thought: we define *new* labels that do what we think everyone
>> should do, such as multiple items in the block. There would not be much
>> uptake on those new labels in the short run, but could become the
>> standard 20 years from now.
> For OUTPUT we should try to find an reuse the most commonly used label,
> because the installed base is going to be with us another 10+ years.

You and I live in different universes.

--Paul Hoffman