Skip to content

Commit

Permalink
Fix thread-safety by creating a new DigestCalculator each time Subjec…
Browse files Browse the repository at this point in the history
…tCertificateNotRevokedValidator.getCertificateId() is called

WE2-1068

Signed-off-by: Mart Somermaa <mrts@users.noreply.github.com>
  • Loading branch information
mrts committed Mar 4, 2025
1 parent be477cb commit 23d5748
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
public final class SubjectCertificateNotRevokedValidator {

private static final Logger LOG = LoggerFactory.getLogger(SubjectCertificateNotRevokedValidator.class);
private static final DigestCalculator DIGEST_CALCULATOR = DigestCalculatorImpl.sha1();

private final SubjectCertificateTrustedValidator trustValidator;
private final OcspClient ocspClient;
Expand Down Expand Up @@ -197,7 +196,8 @@ private static void checkNonce(OCSPReq request, BasicOCSPResp response) throws U

private static CertificateID getCertificateId(X509Certificate subjectCertificate, X509Certificate issuerCertificate) throws CertificateEncodingException, IOException, OCSPException {
final BigInteger serial = subjectCertificate.getSerialNumber();
return new CertificateID(DIGEST_CALCULATOR,
final DigestCalculator digestCalculator = DigestCalculatorImpl.sha1();
return new CertificateID(digestCalculator,
new X509CertificateHolder(issuerCertificate.getEncoded()), serial);
}

Expand Down

0 comments on commit 23d5748

Please sign in to comment.