java.lang.Object
br.ufsc.labsec.signature.conformanceVerifier.OCSPUtils

public class OCSPUtils
extends Object
  • Field Summary

    Fields
    Modifier and Type Field Description
    static String UNABLE_TO_GET_OCSP_ENCODED  
  • Constructor Summary

    Constructors
    Constructor Description
    OCSPUtils()  
  • Method Summary

    Modifier and Type Method Description
    static Optional<org.bouncycastle.cert.ocsp.OCSPReq> buildOCSPRequest​(Object certificate, Object issuer)
    Cria uma requisição para servidor OCSP
    static byte[] digest​(String algorithm, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static byte[] digest​(org.bouncycastle.asn1.ASN1ObjectIdentifier identifier, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static byte[] digest​(org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static byte[] digest​(org.bouncycastle.asn1.ocsp.OCSPRequest ocsp)  
    static byte[] digest​(org.bouncycastle.asn1.ocsp.OCSPResponse ocsp)  
    static byte[] digest​(org.bouncycastle.cert.ocsp.OCSPReq ocsp)  
    static byte[] DIGEST​(String algorithm, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static byte[] DIGEST​(org.bouncycastle.asn1.ASN1ObjectIdentifier identifier, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static byte[] DIGEST​(org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static Collection<org.bouncycastle.asn1.ocsp.BasicOCSPResponse> filterBasicOCSPResponses​(Collection<org.bouncycastle.cert.ocsp.OCSPResp> ocsps)  
    static String getOCSPURL​(Object certificate)
    Busca a URL do servidor OCSP presente na AIA do certificado dado
    static boolean ISDIGEST​(byte[] expectedDigest, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static boolean ISDIGEST​(String algorithm, byte[] expectedDigest, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static boolean ISDIGEST​(org.bouncycastle.asn1.ASN1ObjectIdentifier identifier, byte[] expectedDigest, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)  
    static org.bouncycastle.cert.ocsp.OCSPResp requestOCSPResponse​(String url, org.bouncycastle.cert.ocsp.OCSPReq ocspReq)
    Faz a requisição para o servidor OCSP presente na URL dada

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • OCSPUtils

      public OCSPUtils()
  • Method Details

    • buildOCSPRequest

      public static Optional<org.bouncycastle.cert.ocsp.OCSPReq> buildOCSPRequest​(Object certificate, Object issuer)
      Cria uma requisição para servidor OCSP
      Parameters:
      certificate - Certificado a ser validado
      issuer - Certificado do emissor
      Returns:
      A requisição para servidor OCSP gerada
    • requestOCSPResponse

      public static org.bouncycastle.cert.ocsp.OCSPResp requestOCSPResponse​(String url, org.bouncycastle.cert.ocsp.OCSPReq ocspReq) throws IOException
      Faz a requisição para o servidor OCSP presente na URL dada
      Parameters:
      url - A URL do servidor OCSP
      ocspReq - A requisição a ser enviada
      Returns:
      A resposta do servidor OCSP
      Throws:
      IOException - Exceção em caso de má formação da requisição
    • getOCSPURL

      public static String getOCSPURL​(Object certificate) throws AIAException
      Busca a URL do servidor OCSP presente na AIA do certificado dado
      Parameters:
      certificate - Certificado a ser analisado
      Returns:
      A URL do servidor OCSP identificada na AIA do certificado
      Throws:
      AIAException - Exceção em caso de má formação da AIA do certificado
    • filterBasicOCSPResponses

      public static Collection<org.bouncycastle.asn1.ocsp.BasicOCSPResponse> filterBasicOCSPResponses​(Collection<org.bouncycastle.cert.ocsp.OCSPResp> ocsps)
    • digest

      public static byte[] digest​(org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp) throws NoSuchAlgorithmException, IOException
      Throws:
      NoSuchAlgorithmException
      IOException
    • digest

      public static byte[] digest​(org.bouncycastle.asn1.ocsp.OCSPResponse ocsp) throws NoSuchAlgorithmException, IOException
      Throws:
      NoSuchAlgorithmException
      IOException
    • digest

      public static byte[] digest​(org.bouncycastle.cert.ocsp.OCSPReq ocsp) throws NoSuchAlgorithmException, IOException
      Throws:
      NoSuchAlgorithmException
      IOException
    • digest

      public static byte[] digest​(org.bouncycastle.asn1.ocsp.OCSPRequest ocsp) throws NoSuchAlgorithmException, IOException
      Throws:
      NoSuchAlgorithmException
      IOException
    • digest

      public static byte[] digest​(org.bouncycastle.asn1.ASN1ObjectIdentifier identifier, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp) throws NoSuchAlgorithmException, IOException
      Throws:
      NoSuchAlgorithmException
      IOException
    • digest

      public static byte[] digest​(String algorithm, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp) throws NoSuchAlgorithmException, IOException
      Throws:
      NoSuchAlgorithmException
      IOException
    • DIGEST

      public static byte[] DIGEST​(org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)
    • DIGEST

      public static byte[] DIGEST​(org.bouncycastle.asn1.ASN1ObjectIdentifier identifier, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)
    • DIGEST

      public static byte[] DIGEST​(String algorithm, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)
    • ISDIGEST

      public static boolean ISDIGEST​(byte[] expectedDigest, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)
    • ISDIGEST

      public static boolean ISDIGEST​(org.bouncycastle.asn1.ASN1ObjectIdentifier identifier, byte[] expectedDigest, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)
    • ISDIGEST

      public static boolean ISDIGEST​(String algorithm, byte[] expectedDigest, org.bouncycastle.asn1.ocsp.BasicOCSPResponse ocsp)