Botan  1.11.15
Classes | Functions
Botan::OCSP Namespace Reference

Classes

class  CertID
class  Request
class  Response
class  SingleResponse

Functions

Response online_check (const X509_Certificate &issuer, const X509_Certificate &subject, const Certificate_Store *trusted_roots)

Function Documentation

BOTAN_DLL Response Botan::OCSP::online_check ( const X509_Certificate &  issuer,
const X509_Certificate &  subject,
const Certificate_Store *  trusted_roots 
)

Definition at line 225 of file ocsp.cpp.

References Botan::OCSP::Request::BER_encode(), Botan::X509_Certificate::ocsp_responder(), and Botan::HTTP::POST_sync().

   {
   const std::string responder_url = subject.ocsp_responder();

   if(responder_url == "")
      throw std::runtime_error("No OCSP responder specified");

   OCSP::Request req(issuer, subject);

   auto http = HTTP::POST_sync(responder_url,
                               "application/ocsp-request",
                               req.BER_encode());

   http.throw_unless_ok();

   // Check the MIME type?

   OCSP::Response response(*trusted_roots, http.body());

   return response;
   }