Add support for OCSP on Linux, overhaul Linux X509Chain processing
authorJeremy Barton <jbarton@microsoft.com>
Fri, 22 Feb 2019 20:51:22 +0000 (12:51 -0800)
committerGitHub <noreply@github.com>
Fri, 22 Feb 2019 20:51:22 +0000 (12:51 -0800)
commit46ae7ef229723f6198b218cf6cd93537577a6b8e
tree853b817d68eed65ea16686473f3e5e15f2a3942c
parentd56b9711a5a73fbd7957166e1eec5e8fadc93de9
Add support for OCSP on Linux, overhaul Linux X509Chain processing

This change moves a lot of the chain building work from managed code into the native shim, largely to cut down on the number of P/Invokes required to set up the chain builder.

Once a chain has been built to a point where only one issuer will be considered, if revocation was requested and a CRL is not available, attempt an OCSP request if the certificate indicates the CA has an OCSP endpoint.

Based on CA/Browser Forum's requirements this expects CRL for all intermediates and only attempts OCSP for the end-entity certificate.

"Conforming" OCSP requests are opportunistically cached on the basis that local filesystem re-reads are more reliable (and faster) than doing a live request to the CA.

Commit migrated from https://github.com/dotnet/corefx/commit/0fbbb68a3f7be82d26e4b2dff5c25c192e3a2023
35 files changed:
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.ASN1.Nid.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Crypto.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Encode.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs [new file with mode: 0644]
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Stack.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509StoreCtx.cs
src/libraries/Common/src/Microsoft/Win32/SafeHandles/Asn1SafeHandles.Unix.cs
src/libraries/Common/src/System/Security/Cryptography/Oids.cs
src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt
src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.c
src/libraries/Native/Unix/System.Security.Cryptography.Native/apibridge.h
src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.c
src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl.h
src/libraries/Native/Unix/System.Security.Cryptography.Native/openssl_1_0_structs.h
src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.h
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_asn1.c
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_asn1.h
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ocsp.c [new file with mode: 0644]
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ocsp.h [new file with mode: 0644]
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509.c
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_x509.h
src/libraries/System.Net.Http/src/System/Net/Http/CurlHandler/CurlHandler.SslProvider.Linux.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/CertificateAssetDownloader.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/ChainPal.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/CollectionBackedStoreProvider.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/CrlCache.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/DirectoryBasedStoreProvider.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509CertificateReader.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/OpenSslX509ChainProcessor.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/StorePal.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/Internal/Cryptography/Pal.Unix/X509Persistence.cs
src/libraries/System.Security.Cryptography.X509Certificates/src/System.Security.Cryptography.X509Certificates.csproj
src/libraries/System.Security.Cryptography.X509Certificates/src/System/Security/Cryptography/X509Certificates/X509Store.cs
src/libraries/System.Security.Cryptography.X509Certificates/tests/ChainTests.cs