Skip to content

Commit

Permalink
See if we can specify the validation date for the certificates (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronAtDuo committed May 3, 2023
1 parent e44da7a commit 5c6b376
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/CertPinningTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ protected static X509Chain DuoApiChain()
{
// The certificate chain for api-*.duosecurity.com
var chain = new X509Chain();
// Verify as of a date that the certs are valid for
chain.ChainPolicy.VerificationTime = new DateTime(2023, 01, 01);
chain.ChainPolicy.ExtraStore.Add(CertFromString(DUO_API_CERT_ROOT));
chain.ChainPolicy.ExtraStore.Add(CertFromString(DUO_API_CERT_INTER));
bool valid = chain.Build(DuoApiServerCert());
Expand All @@ -33,6 +35,8 @@ protected static X509Chain MicrosoftComChain()
{
// A valid chain, but for www.microsoft.com, not Duo
var chain = new X509Chain();
// Verify as of a date that the certs are valid for
chain.ChainPolicy.VerificationTime = new DateTime(2023, 01, 01);
chain.ChainPolicy.ExtraStore.Add(CertFromString(MICROSOFT_COM_CERT_ROOT));
chain.ChainPolicy.ExtraStore.Add(CertFromString(MICROSOFT_COM_CERT_INTER));
bool valid = chain.Build(CertFromString(MICROSOFT_COM_CERT_SERVER));
Expand Down

0 comments on commit 5c6b376

Please sign in to comment.