Skip to content

Commit

Permalink
dealt with expiring certificate in test
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Feb 10, 2025
1 parent f13def6 commit 9706d9a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;

Expand Down Expand Up @@ -121,9 +122,13 @@ private static boolean verifyDetached(byte[] data, byte[] detachedCms,

// Validate signer's certificate chain
X509CertSelector constraints = new X509CertSelector();
constraints.setCertificate(getX509Certificate(signerCert));
X509Certificate x509Certificate = getX509Certificate(signerCert);
constraints.setCertificate(x509Certificate);

PKIXBuilderParameters params = new PKIXBuilderParameters(trustAnchors, constraints);

params.setDate(new Date(x509Certificate.getNotAfter().getTime() - 5000L));

JcaCertStoreBuilder certStoreBuilder = new JcaCertStoreBuilder();
certStoreBuilder.addCertificate(signerCert);

Expand Down

0 comments on commit 9706d9a

Please sign in to comment.