Skip to content

Commit db453e3

Browse files
committed
PDFBOX-5936: refactor for future change
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1923250 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0b7570d commit db453e3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

examples/src/main/java/org/apache/pdfbox/examples/signature/validation/AddValidationInformation.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,19 +370,22 @@ private void fetchCrlData(CertSignatureInformation certInfo) throws IOException
370370
private void addOcspData(CertSignatureInformation certInfo) throws IOException, OCSPException,
371371
CertificateProccessingException, RevokedCertificateException, URISyntaxException
372372
{
373-
if (ocspChecked.contains(certInfo.getCertificate()))
373+
X509Certificate certificate = certInfo.getCertificate();
374+
X509Certificate issuerCertificate = certInfo.getIssuerCertificate();
375+
String ocspURL = certInfo.getOcspUrl();
376+
if (ocspChecked.contains(certificate))
374377
{
375378
// This certificate has been OCSP-checked before
376379
return;
377380
}
378381
OcspHelper ocspHelper = new OcspHelper(
379-
certInfo.getCertificate(),
382+
certificate,
380383
signDate.getTime(),
381-
certInfo.getIssuerCertificate(),
384+
issuerCertificate,
382385
new HashSet<>(certInformationHelper.getCertificateSet()),
383-
certInfo.getOcspUrl());
386+
ocspURL);
384387
OCSPResp ocspResp = ocspHelper.getResponseOcsp();
385-
ocspChecked.add(certInfo.getCertificate());
388+
ocspChecked.add(certificate);
386389
BasicOCSPResp basicResponse = (BasicOCSPResp) ocspResp.getResponseObject();
387390
X509Certificate ocspResponderCertificate = ocspHelper.getOcspResponderCertificate();
388391
certInformationHelper.addAllCertsFromHolders(basicResponse.getCerts());
@@ -424,7 +427,7 @@ private void addOcspData(CertSignatureInformation certInfo) throws IOException,
424427
{
425428
correspondingOCSPs.add(ocspStream);
426429
}
427-
foundRevocationInformation.add(certInfo.getCertificate());
430+
foundRevocationInformation.add(certificate);
428431
}
429432

430433
/**

0 commit comments

Comments
 (0)