java.lang.Object
eu.europa.esig.dss.spi.DSSRevocationUtils
Utility class used to manipulate revocation data (OCSP, CRL)
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckIssuerValidAtRevocationProductionTime(RevocationToken<?> revocationToken, eu.europa.esig.dss.model.x509.CertificateToken issuerCertificateToken) Checks if the revocation has been produced during the issuer certificate validity rangestatic org.bouncycastle.cert.ocsp.OCSPRespfromBasicToResp(byte[] basicOCSPRespBinary) Convert a BasicOCSPResp in OCSPResp (connection status is set to SUCCESSFUL).static org.bouncycastle.cert.ocsp.OCSPRespfromBasicToResp(org.bouncycastle.cert.ocsp.BasicOCSPResp basicOCSPResp) Convert a BasicOCSPResp in OCSPResp (connection status is set to SUCCESSFUL).static org.bouncycastle.cert.ocsp.BasicOCSPRespfromRespToBasic(org.bouncycastle.cert.ocsp.OCSPResp ocspResp) This method returns theBasicOCSPRespfrom aOCSPResp.static org.bouncycastle.cert.ocsp.BasicOCSPRespgetBasicOcspResp(org.bouncycastle.asn1.ASN1Sequence asn1Sequence) This method allows to create aBasicOCSPRespfrom aASN1Sequence.static StringgetCRLRevocationTokenKey(String crlUrl) Gets CRL key (SHA-1 digest) of the urlgetCRLRevocationTokenKeys(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) static eu.europa.esig.dss.model.DigestgetDigest(org.bouncycastle.asn1.esf.OtherHash otherHash) ConvertsOtherHashtoDigeststatic org.bouncycastle.operator.DigestCalculatorgetDigestCalculator(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm) Gets aDigestCalculatorfor thedigestAlgorithmstatic ResponderIdgetDSSResponderId(org.bouncycastle.asn1.ocsp.ResponderID responderID) TransformsResponderIDtoResponderIdstatic ResponderIdgetDSSResponderId(org.bouncycastle.cert.ocsp.RespID respID) TransformsRespIDtoResponderIdstatic byte[]getEncoded(org.bouncycastle.cert.ocsp.OCSPResp ocspResp) Returns the encoded binaries of the OCSP responsestatic byte[]getEncodedFromBasicResp(org.bouncycastle.cert.ocsp.BasicOCSPResp basicOCSPResp) Gets ASN1 encoded binaries of thebasicOCSPRespstatic org.bouncycastle.cert.ocsp.SingleRespgetLatestSingleResponse(org.bouncycastle.cert.ocsp.BasicOCSPResp basicResponse, eu.europa.esig.dss.model.x509.CertificateToken certificate, eu.europa.esig.dss.model.x509.CertificateToken issuer) Gets the latest single response from the OCSP responsestatic org.bouncycastle.cert.ocsp.CertificateIDgetOCSPCertificateID(eu.europa.esig.dss.model.x509.CertificateToken cert, eu.europa.esig.dss.model.x509.CertificateToken issuerCert, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm) Returns theCertificateIDfor the given certificate and its issuer's certificate.static org.bouncycastle.cert.ocsp.OCSPRespgetOcspResp(org.bouncycastle.asn1.ASN1Sequence asn1Sequence) This method allows to create aOCSPRespfrom aASN1Sequence.static StringgetOcspRevocationKey(eu.europa.esig.dss.model.x509.CertificateToken certificateToken, String ocspUrl) Gets OCSP key (SHA-1 digest) of the urlgetOcspRevocationTokenKeys(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) static List<org.bouncycastle.cert.ocsp.SingleResp> getSingleResponses(org.bouncycastle.cert.ocsp.BasicOCSPResp basicResponse, eu.europa.esig.dss.model.x509.CertificateToken certificate, eu.europa.esig.dss.model.x509.CertificateToken issuer) Gets a list of single response from the OCSP responsestatic eu.europa.esig.dss.enumerations.DigestAlgorithmgetUsedDigestAlgorithm(org.bouncycastle.cert.ocsp.SingleResp singleResp) Returns a DigestAlgorithm used in the givensingleRespstatic org.bouncycastle.cert.ocsp.BasicOCSPResploadOCSPBase64Encoded(String base64Encoded) This method loads an OCSP response from the given base 64 encoded string.static org.bouncycastle.cert.ocsp.BasicOCSPResploadOCSPFromBinaries(byte[] binaries) This method loads an OCSP response from the given binaries.static booleanmatches(org.bouncycastle.cert.ocsp.CertificateID certId, org.bouncycastle.cert.ocsp.SingleResp singleResp) fix for certId.equals methods that doesn't work very well.
-
Method Details
-
getBasicOcspResp
public static org.bouncycastle.cert.ocsp.BasicOCSPResp getBasicOcspResp(org.bouncycastle.asn1.ASN1Sequence asn1Sequence) This method allows to create aBasicOCSPRespfrom aASN1Sequence. The value for response SHALL be the DER encoding of BasicOCSPResponse (RFC 2560).- Parameters:
asn1Sequence-ASN1Sequenceto convert toBasicOCSPResp- Returns:
BasicOCSPResp
-
getOcspResp
public static org.bouncycastle.cert.ocsp.OCSPResp getOcspResp(org.bouncycastle.asn1.ASN1Sequence asn1Sequence) This method allows to create aOCSPRespfrom aASN1Sequence.- Parameters:
asn1Sequence-ASN1Sequenceto convert toOCSPResp- Returns:
OCSPResp
-
fromRespToBasic
public static org.bouncycastle.cert.ocsp.BasicOCSPResp fromRespToBasic(org.bouncycastle.cert.ocsp.OCSPResp ocspResp) This method returns theBasicOCSPRespfrom aOCSPResp.- Parameters:
ocspResp-OCSPRespto analysed- Returns:
BasicOCSPResp
-
fromBasicToResp
public static org.bouncycastle.cert.ocsp.OCSPResp fromBasicToResp(org.bouncycastle.cert.ocsp.BasicOCSPResp basicOCSPResp) Convert a BasicOCSPResp in OCSPResp (connection status is set to SUCCESSFUL).- Parameters:
basicOCSPResp- theBasicOCSPRespto be converted toOCSPResp- Returns:
- the result of the conversion
-
getEncodedFromBasicResp
public static byte[] getEncodedFromBasicResp(org.bouncycastle.cert.ocsp.BasicOCSPResp basicOCSPResp) Gets ASN1 encoded binaries of thebasicOCSPResp- Parameters:
basicOCSPResp-BasicOCSPResp- Returns:
- ASN1 encoded binaries
-
fromBasicToResp
public static org.bouncycastle.cert.ocsp.OCSPResp fromBasicToResp(byte[] basicOCSPRespBinary) Convert a BasicOCSPResp in OCSPResp (connection status is set to SUCCESSFUL).- Parameters:
basicOCSPRespBinary- the binary of BasicOCSPResp- Returns:
- an instance of OCSPResp
-
getUsedDigestAlgorithm
public static eu.europa.esig.dss.enumerations.DigestAlgorithm getUsedDigestAlgorithm(org.bouncycastle.cert.ocsp.SingleResp singleResp) Returns a DigestAlgorithm used in the givensingleResp- Parameters:
singleResp-SingleRespto extract the used SingleResp from- Returns:
SingleResp
-
matches
public static boolean matches(org.bouncycastle.cert.ocsp.CertificateID certId, org.bouncycastle.cert.ocsp.SingleResp singleResp) fix for certId.equals methods that doesn't work very well.- Parameters:
certId-CertificateIDsingleResp-SingleResp- Returns:
- true if the certificate matches this included in
SingleResp
-
getOCSPCertificateID
public static org.bouncycastle.cert.ocsp.CertificateID getOCSPCertificateID(eu.europa.esig.dss.model.x509.CertificateToken cert, eu.europa.esig.dss.model.x509.CertificateToken issuerCert, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm) Returns theCertificateIDfor the given certificate and its issuer's certificate.- Parameters:
cert-CertificateTokenfor which the id is createdissuerCert-CertificateTokenissuer certificate of thecertdigestAlgorithm-DigestAlgorithmto be used for CertificateID hash calculation- Returns:
CertificateID
-
getDigestCalculator
public static org.bouncycastle.operator.DigestCalculator getDigestCalculator(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm) Gets aDigestCalculatorfor thedigestAlgorithm- Parameters:
digestAlgorithm-DigestAlgorithm- Returns:
DigestCalculator
-
loadOCSPBase64Encoded
public static org.bouncycastle.cert.ocsp.BasicOCSPResp loadOCSPBase64Encoded(String base64Encoded) throws IOException This method loads an OCSP response from the given base 64 encoded string.- Parameters:
base64Encoded- base 64 encoded OCSP response- Returns:
- the
BasicOCSPRespobject - Throws:
IOException- if IO error occurred
-
loadOCSPFromBinaries
public static org.bouncycastle.cert.ocsp.BasicOCSPResp loadOCSPFromBinaries(byte[] binaries) throws IOException This method loads an OCSP response from the given binaries.- Parameters:
binaries- byte array of OCSP response- Returns:
- the
BasicOCSPRespobject - Throws:
IOException- if IO error occurred
-
getEncoded
public static byte[] getEncoded(org.bouncycastle.cert.ocsp.OCSPResp ocspResp) Returns the encoded binaries of the OCSP response- Parameters:
ocspResp-OCSPResp- Returns:
- ASN1 encoded binaries of the OCSP response
-
getDSSResponderId
TransformsRespIDtoResponderId- Parameters:
respID-RespIDto get values from- Returns:
ResponderId
-
getDSSResponderId
TransformsResponderIDtoResponderId- Parameters:
responderID-ResponderIDto get values from- Returns:
ResponderId
-
getCRLRevocationTokenKeys
public static List<String> getCRLRevocationTokenKeys(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) - Parameters:
certificateToken-CertificateToken- Returns:
- list of
Stringrevocation keys
-
getCRLRevocationTokenKey
Gets CRL key (SHA-1 digest) of the url -
getOcspRevocationTokenKeys
public static List<String> getOcspRevocationTokenKeys(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) - Parameters:
certificateToken-CertificateToken- Returns:
- list of
Stringrevocation keys
-
getOcspRevocationKey
public static String getOcspRevocationKey(eu.europa.esig.dss.model.x509.CertificateToken certificateToken, String ocspUrl) Gets OCSP key (SHA-1 digest) of the url -
getLatestSingleResponse
public static org.bouncycastle.cert.ocsp.SingleResp getLatestSingleResponse(org.bouncycastle.cert.ocsp.BasicOCSPResp basicResponse, eu.europa.esig.dss.model.x509.CertificateToken certificate, eu.europa.esig.dss.model.x509.CertificateToken issuer) Gets the latest single response from the OCSP response- Parameters:
basicResponse-BasicOCSPRespcertificate-CertificateTokento get single response forissuer-CertificateTokenissuer of thecertificate- Returns:
SingleResp
-
getSingleResponses
public static List<org.bouncycastle.cert.ocsp.SingleResp> getSingleResponses(org.bouncycastle.cert.ocsp.BasicOCSPResp basicResponse, eu.europa.esig.dss.model.x509.CertificateToken certificate, eu.europa.esig.dss.model.x509.CertificateToken issuer) Gets a list of single response from the OCSP response- Parameters:
basicResponse-BasicOCSPRespcertificate-CertificateTokento get single response forissuer-CertificateTokenissuer of thecertificate- Returns:
- a list of
SingleResponses
-
getDigest
public static eu.europa.esig.dss.model.Digest getDigest(org.bouncycastle.asn1.esf.OtherHash otherHash) ConvertsOtherHashtoDigest- Parameters:
otherHash-OtherHash- Returns:
Digest
-
checkIssuerValidAtRevocationProductionTime
public static boolean checkIssuerValidAtRevocationProductionTime(RevocationToken<?> revocationToken, eu.europa.esig.dss.model.x509.CertificateToken issuerCertificateToken) Checks if the revocation has been produced during the issuer certificate validity range- Parameters:
revocationToken-RevocationTokento checkissuerCertificateToken-CertificateTokenused to issue the current revocation data- Returns:
- TRUE if the revocation producedAt time is in the issuer certificate's validity range, false otherwise
-