diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/ocsp.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/doc/examples/ocsp.cpp b/doc/examples/ocsp.cpp index 4d0c34b25..81cfa198b 100644 --- a/doc/examples/ocsp.cpp +++ b/doc/examples/ocsp.cpp @@ -1,6 +1,7 @@ #include <botan/botan.h> #include <botan/x509cert.h> #include <botan/certstor.h> +#include <botan/x509path.h> #include <botan/ocsp.h> #include <iostream> @@ -9,15 +10,20 @@ using namespace Botan; int main(int argc, char* argv[]) { + if(argc != 2) + std::cout << "Usage: ocsp subject.pem issuer.pem"; + X509_Certificate subject(argv[1]); X509_Certificate issuer(argv[2]); Certificate_Store_In_Memory cas; cas.add_certificate(issuer); - OCSP::Response resp = OCSP::online_check(issuer, subject, cas); + OCSP::Response resp = OCSP::online_check(issuer, subject, &cas); + + auto status = resp.status_for(issuer, subject); - if(resp.affirmative_response_for(issuer, subject)) + if(status == Certificate_Status_Code::VERIFIED) std::cout << "OCSP check OK\n"; else - std::cout << "OCSP check failed\n"; + std::cout << "OCSP check failed " << Path_Validation_Result::status_string(status) << "\n"; } |