Skip to content

Commit f2404c0

Browse files
JoeShookjstedfast
authored andcommitted
Respect the CheckCertificateRevocation property.
1 parent b8e9a95 commit f2404c0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

MimeKit/Cryptography/BouncyCastleSecureMimeContext.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,12 @@ protected IList<X509Certificate> BuildCertificateChain (X509Certificate certific
694694

695695
var parameters = new PkixBuilderParameters (GetTrustedAnchors (), selector) {
696696
ValidityModel = PkixParameters.PkixValidityModel,
697-
IsRevocationEnabled = false,
697+
IsRevocationEnabled = CheckCertificateRevocation,
698698
Date = DateTime.UtcNow
699699
};
700700
parameters.AddStoreCert (intermediates);
701701
parameters.AddStoreCert (GetIntermediateCertificates ());
702+
parameters.AddStoreCrl (GetCertificateRevocationLists ());
702703

703704
var builder = new PkixCertPathBuilder ();
704705
var result = builder.Build (parameters);
@@ -725,7 +726,7 @@ PkixCertPath BuildCertPath (ISet<TrustAnchor> anchors, IStore<X509Certificate> c
725726

726727
var parameters = new PkixBuilderParameters (anchors, selector) {
727728
ValidityModel = PkixParameters.PkixValidityModel,
728-
IsRevocationEnabled = false
729+
IsRevocationEnabled = CheckCertificateRevocation
729730
};
730731
parameters.AddStoreCert (intermediates);
731732
parameters.AddStoreCrl (crls);

UnitTests/Cryptography/ApplicationPkcs7MimeTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ public async Task TestSignAndEncryptDnsNamesAsync ()
927927
[TestFixture]
928928
public class ApplicationPkcs7MimeTests : ApplicationPkcs7MimeTestsBase
929929
{
930-
readonly TemporarySecureMimeContext ctx = new TemporarySecureMimeContext (new SecureRandom (new CryptoApiRandomGenerator ())) { CheckCertificateRevocation = true };
930+
readonly TemporarySecureMimeContext ctx = new TemporarySecureMimeContext (new SecureRandom (new CryptoApiRandomGenerator ())) { CheckCertificateRevocation = false };
931931

932932
public ApplicationPkcs7MimeTests ()
933933
{
@@ -947,7 +947,7 @@ class MySecureMimeContext : DefaultSecureMimeContext
947947
{
948948
public MySecureMimeContext () : base ("pkcs7.db", "no.secret")
949949
{
950-
CheckCertificateRevocation = true;
950+
CheckCertificateRevocation = false;
951951
}
952952
}
953953

UnitTests/Cryptography/SecureMimeTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,7 @@ public async Task TestSecureMimeVerifyMixedLineEndingsAsync ()
27342734
[TestFixture]
27352735
public class SecureMimeTests : SecureMimeTestsBase
27362736
{
2737-
readonly TemporarySecureMimeContext ctx = new TemporarySecureMimeContext (new SecureRandom (new CryptoApiRandomGenerator ())) { CheckCertificateRevocation = true };
2737+
readonly TemporarySecureMimeContext ctx = new TemporarySecureMimeContext (new SecureRandom (new CryptoApiRandomGenerator ())) { CheckCertificateRevocation = false };
27382738

27392739
protected override SecureMimeContext CreateContext ()
27402740
{
@@ -2749,7 +2749,7 @@ class MySecureMimeContext : DefaultSecureMimeContext
27492749
{
27502750
public MySecureMimeContext () : base ("smime.db", "no.secret")
27512751
{
2752-
CheckCertificateRevocation = true;
2752+
CheckCertificateRevocation = false;
27532753
}
27542754
}
27552755

0 commit comments

Comments
 (0)