aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-12-31 18:32:43 +0000
committerlloyd <[email protected]>2013-12-31 18:32:43 +0000
commitff380dedf10007a1bc0f4b7b874a9424bc6e1e4a (patch)
tree5fe57727c7864f7da5072813197d4afe040ecbc0 /doc/examples
parent95bcc74414a29d60fb8348d78977ec2a813f3363 (diff)
Compile fix
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/ocsp.cpp12
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";
}