On Tue, Aug 05, 2025 at 07:47:50PM -0500, Thomas Anderson wrote:
> Here's a CSR I kinda hacked together:
>
> -----BEGIN NEW CERTIFICATE REQUEST-----
> MIIBADCBqAIBADATMREwDwYDVQQKDAh3aGF0ZXZlcjBZMBMGByqGSM49AgEGCCqG
> SM49AwEHA0IABInX+1ey1zZ9zM4z4rxTJVxdtMpBNlrwK9mae1DaPkGqvtXCr/ER
> AJpPDgWJcT2j9W5EjvrMtUxe5yujJw210DSgMzAxBgkqhkiG9w0BCQ4xJDANMAsG
> A1UdDwQEAwIBhjATMBEGA1UdDgQKBAhkZWFkYmVlZjAKBggqhkjOPQQDAgNHADBE
> AiAORfemho2gtZudBD8BGUvKBeQOVeg4fzkJTYTkqk4cKwIgGhdlouh2dVGbCa4t
> Iq3EaI+b4OMe2uEb3mmftiefvok=
> -----END NEW CERTIFICATE REQUEST-----
The above CSR is not consistent with section 5.4.2 of RFC2985 (PKCS#9).
https://datatracker.ietf.org/doc/html/rfc2985#page-17
which defines the "extensionRequest" attribute to consist (as a set of
values) of a single element which is a sequence of extensions.
> Here's the output of openssl asn1parse -i -in test.pem :
While what you have above is a set of two 1-element sequences. Sadly, a
set of two 1-element sequences is not the same as a set containing a
single 2-element sequence.
{ [a], [b] } != { [[a], [b]] }
> So it's showing "X509v3 Subject Key Identifier" and "X509v3 Key Usage".
Yes, but not in the format specified in PKCS#9.
> To understand this let's consider this CSR:
>
> -----BEGIN NEW CERTIFICATE REQUEST-----
> MIH/MIGmAgEAMBMxETAPBgNVBAoMCHdoYXRldmVyMFkwEwYHKoZIzj0CAQYIKoZI
> zj0DAQcDQgAEXj0aPYgbLFMlCwD89DQCjIBG+axx6uiq6t4ZgUOK+9piM3+3aScq
> CKEDRDY8dmFYetIxS8xW3t513N+1BTwWSqAxMC8GCSqGSIb3DQEJDjEiMCAwCwYD
> VR0PBAQDAgGGMBEGA1UdDgQKBAhkZWFkYmVlZjAKBggqhkjOPQQDAgNIADBFAiEA
> uutZz9KNjvXw0fqa3NOIZRHQP4rS+tLrLxfmb8lgKi4CIA/m3oLwSxNDom0q406p
> FUp0Wt/MkYMrHiKG2InRK9V+
> -----END NEW CERTIFICATE REQUEST-----
This CSR is consistent with the specification.
This has a set with a single element which is a 2-element sequence
in conformance with PKCS#9.
> My question is... *should* the first CSR be showing both extension
> requests or shouldn't it be?
It is not a well-formed CSR. It would ideally be rejected by the CSR
parser, because the multiplicitly of the requested extensions set is
incorrect. Unfortunately, it excess requested extensions elements
appear to be silently ignored. If there isn't yet an open issue on
Github covering this, please open one.
> I mean, right now it isn't, but how *ought* a CSR like the first one
> behave?
It isn't a valid CSR, so its behaviour is undefined, but rejection is
likely the right outcome.
--
Viktor. 🇺🇦 Слава Україні!