diff options
author | lloyd <[email protected]> | 2014-01-10 00:08:13 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-10 00:08:13 +0000 |
commit | 57789bdfc55061002b2727d0b32587612829a37c (patch) | |
tree | 99f36631b4ec50c5187a1b0a7c256b99182373ad /src/cmd/ocsp.cpp | |
parent | 94968c917407a63d888fd3eb4d02491f60de6ebc (diff) |
Split up test vectors into per-algo files and app into botan-test for
the tests and botan for everything else.
Diffstat (limited to 'src/cmd/ocsp.cpp')
-rw-r--r-- | src/cmd/ocsp.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/cmd/ocsp.cpp b/src/cmd/ocsp.cpp new file mode 100644 index 000000000..98324caff --- /dev/null +++ b/src/cmd/ocsp.cpp @@ -0,0 +1,38 @@ +#include "apps.h" +#include <botan/x509cert.h> +#include <botan/certstor.h> +#include <botan/x509path.h> +#include <botan/ocsp.h> + +#include <iostream> + +using namespace Botan; + +int ocsp_check_main(int argc, char* argv[]) + { + if(argc != 2) + { + std::cout << "Usage: ocsp subject.pem issuer.pem"; + return 2; + } + + 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); + + auto status = resp.status_for(issuer, subject); + + if(status == Certificate_Status_Code::VERIFIED) + { + std::cout << "OCSP check OK\n"; + return 0; + } + else + { + std::cout << "OCSP check failed " << Path_Validation_Result::status_string(status) << "\n"; + return 1; + } + } |