Subject: Re: [lamps] X.509 certificate linting [was: Re: Encoding errors in draft-ietf-lamps-samples-01]

From: "David A. Cooper" <[email-masked]>
Date: Thu, 13 May 2021 08:34:41 -0400

I haven't made the certificate checker that I wrote publicly available 
yet, but it is something that I should do at some point.

I ran all of the certificates from draft-ietf-lamps-samples-02 through 
the program and it only noted one problem. The sMIMECapabilities 
extensions in the certificates in Sections 7.3 and 8.3 are not correctly 
encoded.

According to RFC 4262, the sMIMECapabilities extension is defined as 
follows:

    SMIMECapabilities ::= SEQUENCE OF SMIMECapability

    SMIMECapability ::= SEQUENCE {
        capabilityID OBJECT IDENTIFIER,
        parameters ANY DEFINED BY capabilityID OPTIONAL }

The extensions in your certificates contain just a single SMIMECapability:

    SEQUENCE {
       OBJECT IDENTIFIER ecdhHKDF-SHA256(1 2 840 113549 1 9 16 3 19)
       SEQUENCE {
         OBJECT IDENTIFIER aes128-wrap (2 16 840 1 101 3 4 1 5)
         }
       }

|So, I believe you should just need to change the line in 
encrypt.25519.template from:|

    |add_extension "1.2.840.113549.1.9.15
    0x301A060B2A864886F70D0109100313300B0609608648016503040105"|

|to|

    ||add_extension "1.2.840.113549.1.9.15
    0x301C301A060B2A864886F70D0109100313300B0609608648016503040105"||

||so that you then have a SEQUENCE of one SMIMECapability.||

I didn't check all of the certificates with https://crt.sh/lintcert, but 
I tried one of the certificates with the sMIMECapabilities extension, 
and it caught the problem as well.

On 05/13/21 6:05am, Daniel Kahn Gillmor wrote:

> Hi David (and other LAMPS folks)--
>
> On Tue 2021-05-11 10:35:48 -0400, David A. Cooper wrote:
>> I ran the ten sample certificates in draft-ietf-lamps-samples-01 through
>> a certificate checker that I wrote several years ago and it highlighted
>> a couple of issues with the sample certificates.
>
>
> Is that certificate checker something that is publicly available?  It
> sounds like it would be a pretty useful thing to have!
>
> I found the following X.509 certificate "linters" with a quick search, but
> i haven't tried running them on the certs in the draft yet:
>
>    https://github.com/zmap/zlint  <https://github.com/zmap/zlint>
>    https://github.com/certlint/certlint  <https://github.com/certlint/certlint>
>    https://github.com/globalsign/certlint  <https://github.com/globalsign/certlint>
>
> I'd be curious to hear any results from anyone working on them.
>
> Are there any other linters that folks know of that are worth trying?
>
>      --dkg

---

From: Daniel Kahn Gillmor <[email-masked]>
Date: Thu, 13 May 2021 21:11:46 -0400

> ||so that you then have a SEQUENCE of one SMIMECapability.||

Thanks, this will be fixed in the next revision of the draft.

        --dkg