Support unknown critical X509 certificate extension in Windows or .NET

Viewed 218

I'm trying to validate a certificate chain in .NET (4.5.2) with X509Chain, and my chain will not validate because the leaf certificate has a critical extension (Apple Pay) that is not recognised by, presumably, the underlying security engine that Windows provides the .NET framework.

Currently I can work around this by ensuring that the only errors with the certificate chain are the errors that seem to be caused by this extension:

  • one item in the leaf's ChainElementStatus with Status of X509ChainStatusFlags.InvalidExtension
  • one item in the leaf's ChainElementStatus with Status of (X509ChainStatusFlags)0x08000000 (amusingly the IDE gives this the name HasNotSupportedCriticalExtension but that value doesn't exist in the enum; I assume this is due to .NET framework changes)
  • that the leaf does have a Critical extension with the expected OID

This seems messy, though. I would far rather tell the framework to expect this extension upfront than to verify that it failed for the correct reasons.

I've found this question on how to achieve this with BouncyCastle (although it involves changing the source) but can't find a way to do this with the built-in X509Chain class.

I also can't find a way to "install" this extension into Windows to make it recognise it.

Is there a way to do this? Or is either stripping the extension or making the framework recognise it a worse "bad idea" than letting it fail and verifying exactly why it did?

0 Answers
Related