Class OcspHelper
java.lang.Object
org.apache.pdfbox.examples.signature.cert.OcspHelper
Helper Class for OCSP-Operations with bouncy castle.
- Author:
- Alexis Suter
-
Constructor Summary
ConstructorsConstructorDescriptionOcspHelper(X509Certificate checkCertificate, Date signDate, X509Certificate issuerCertificate, Set<X509Certificate> additionalCerts, String ocspUrl) -
Method Summary
Modifier and TypeMethodDescriptionGet responder certificate.org.bouncycastle.cert.ocsp.OCSPRespPerforms and verifies the OCSP-RequestvoidverifyRespStatus(org.bouncycastle.cert.ocsp.OCSPResp resp) Helper method to verify response status.
-
Constructor Details
-
OcspHelper
public OcspHelper(X509Certificate checkCertificate, Date signDate, X509Certificate issuerCertificate, Set<X509Certificate> additionalCerts, String ocspUrl) - Parameters:
checkCertificate- Certificate to be OCSP-checkedsignDate- the date when the signing took placeissuerCertificate- Certificate of the issueradditionalCerts- 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, URISyntaxExceptionPerforms and verifies the OCSP-Request- Returns:
- the OCSPResp, when the request was successful, else a corresponding exception will be thrown. Never returns null.
- Throws:
IOExceptionorg.bouncycastle.cert.ocsp.OCSPExceptionRevokedCertificateExceptionURISyntaxException
-
getOcspResponderCertificate
Get responder certificate. This is available aftergetResponseOcsp()has been called. This method should be used instead ofbasicResponse.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
-