Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
awcullen committed Sep 14, 2021
2 parents 49dba32 + 8d4f8d5 commit f850503
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion UaClient/ServiceModel/Ua/DirectoryStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Pkix;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Security.Certificates;
using Org.BouncyCastle.X509;
using Org.BouncyCastle.X509.Extension;
using Org.BouncyCastle.X509.Store;
Expand Down Expand Up @@ -277,6 +278,13 @@ public Task<bool> ValidateRemoteCertificateAsync(X509Certificate target, ILogger
throw new ArgumentNullException(nameof(target));
}

if (!target.IsValidNow)
{
logger?.LogError($"Error validatingRemoteCertificate. Certificate is expired or not yet valid.");
StoreInRejectedFolder(target);
return Task.FromResult(false);
}

var trustedCerts = new Org.BouncyCastle.Utilities.Collections.HashSet();
var trustedCertsInfo = new DirectoryInfo(Path.Combine(_pkiPath, "trusted"));
if (!trustedCertsInfo.Exists)
Expand Down Expand Up @@ -314,7 +322,7 @@ public Task<bool> ValidateRemoteCertificateAsync(X509Certificate target, ILogger
}
}
}

if (IsSelfSigned(target))
{
// Create the selector that specifies the starting certificate
Expand Down

0 comments on commit f850503

Please sign in to comment.