Class OcspHelper

java.lang.Object
org.apache.pdfbox.examples.signature.cert.OcspHelper

public class OcspHelper extends Object
Helper Class for OCSP-Operations with bouncy castle.
Author:
Alexis Suter
  • Constructor Details

    • OcspHelper

      public OcspHelper(X509Certificate checkCertificate, Date signDate, X509Certificate issuerCertificate, Set<X509Certificate> additionalCerts, String ocspUrl)
      Parameters:
      checkCertificate - Certificate to be OCSP-checked
      signDate - the date when the signing took place
      issuerCertificate - Certificate of the issuer
      additionalCerts - Set of trusted root CA certificates that will be used as "trust anchors" and intermediate CA certificates that will be used as part of the certification chain. All self-signed certificates are considered to be trusted root CA certificates. All the rest are considered to be intermediate CA certificates.
      ocspUrl - where to fetch for OCSP
  • Method Details

    • getResponseOcsp

      public org.bouncycastle.cert.ocsp.OCSPResp getResponseOcsp() throws IOException, org.bouncycastle.cert.ocsp.OCSPException, RevokedCertificateException, URISyntaxException
      Performs and verifies the OCSP-Request
      Returns:
      the OCSPResp, when the request was successful, else a corresponding exception will be thrown. Never returns null.
      Throws:
      IOException
      org.bouncycastle.cert.ocsp.OCSPException
      RevokedCertificateException
      URISyntaxException
    • getOcspResponderCertificate

      public X509Certificate getOcspResponderCertificate()
      Get responder certificate. This is available after getResponseOcsp() has been called. This method should be used instead of basicResponse.getCerts()[0]
      Returns:
      The certificate of the responder.
    • verifyRespStatus

      public void verifyRespStatus(org.bouncycastle.cert.ocsp.OCSPResp resp) throws org.bouncycastle.cert.ocsp.OCSPException
      Helper method to verify response status.
      Parameters:
      resp - OCSP response
      Throws:
      org.bouncycastle.cert.ocsp.OCSPException - if the response status is not ok