Class OcspHelper
- java.lang.Object
-
- org.apache.pdfbox.examples.signature.cert.OcspHelper
-
public class OcspHelper extends java.lang.ObjectHelper Class for OCSP-Operations with bouncy castle.- Author:
- Alexis Suter
-
-
Constructor Summary
Constructors Constructor Description OcspHelper(java.security.cert.X509Certificate checkCertificate, java.util.Date signDate, java.security.cert.X509Certificate issuerCertificate, java.util.Set<java.security.cert.X509Certificate> additionalCerts, java.lang.String ocspUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.cert.X509CertificategetOcspResponderCertificate()Get responder certificate.org.bouncycastle.cert.ocsp.OCSPRespgetResponseOcsp()Performs and verifies the OCSP-RequestvoidverifyRespStatus(org.bouncycastle.cert.ocsp.OCSPResp resp)Helper method to verify response status.
-
-
-
Constructor Detail
-
OcspHelper
public OcspHelper(java.security.cert.X509Certificate checkCertificate, java.util.Date signDate, java.security.cert.X509Certificate issuerCertificate, java.util.Set<java.security.cert.X509Certificate> additionalCerts, java.lang.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 Detail
-
getResponseOcsp
public org.bouncycastle.cert.ocsp.OCSPResp getResponseOcsp() throws java.io.IOException, org.bouncycastle.cert.ocsp.OCSPException, RevokedCertificateException, java.net.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:
java.io.IOExceptionorg.bouncycastle.cert.ocsp.OCSPExceptionRevokedCertificateExceptionjava.net.URISyntaxException
-
getOcspResponderCertificate
public java.security.cert.X509Certificate 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.OCSPExceptionHelper method to verify response status.- Parameters:
resp- OCSP response- Throws:
org.bouncycastle.cert.ocsp.OCSPException- if the response status is not ok
-
-