diff options
author | lloyd <[email protected]> | 2014-01-01 23:41:07 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-01 23:41:07 +0000 |
commit | 1119da3d0f6f8edf3dfa39672a9900ee009c5619 (patch) | |
tree | 4deabe57f5107ddb8547392468cc417f21d3db48 | |
parent | 7323f3ff83ff2199b1090f9d5f729b08ccac3151 (diff) |
Moar
-rw-r--r-- | src/apps/apps.h | 4 | ||||
-rw-r--r-- | src/apps/cert_verify.cpp (renamed from doc/examples/cert_verify.cpp) | 5 | ||||
-rw-r--r-- | src/apps/dsa_sign.cpp (renamed from doc/examples/dsa_sign.cpp) | 6 | ||||
-rw-r--r-- | src/apps/dsa_ver.cpp (renamed from doc/examples/dsa_ver.cpp) | 7 | ||||
-rw-r--r-- | src/apps/ocsp.cpp (renamed from doc/examples/ocsp.cpp) | 13 | ||||
-rw-r--r-- | src/main.cpp | 2 |
6 files changed, 24 insertions, 13 deletions
diff --git a/src/apps/apps.h b/src/apps/apps.h index babbea080..18a25b935 100644 --- a/src/apps/apps.h +++ b/src/apps/apps.h @@ -17,6 +17,10 @@ DEFINE_EXAMPLE(factor); DEFINE_EXAMPLE(fpe); DEFINE_EXAMPLE(hash); DEFINE_EXAMPLE(keygen); +DEFINE_EXAMPLE(dsa_sign); +DEFINE_EXAMPLE(dsa_verify); +DEFINE_EXAMPLE(cert_verify); +DEFINE_EXAMPLE(ocsp_check); DEFINE_EXAMPLE(pkcs10); DEFINE_EXAMPLE(read_ssh); DEFINE_EXAMPLE(self_sig); diff --git a/doc/examples/cert_verify.cpp b/src/apps/cert_verify.cpp index d9b170ef0..78d82e9a5 100644 --- a/doc/examples/cert_verify.cpp +++ b/src/apps/cert_verify.cpp @@ -5,14 +5,14 @@ * Distributed under the terms of the Botan license */ -#include <botan/botan.h> +#include "apps.h" #include <botan/x509cert.h> #include <botan/x509path.h> #include <iostream> using namespace Botan; -int main(int argc, char* argv[]) +int cert_verify(int argc, char* argv[]) { if(argc <= 2) { @@ -20,7 +20,6 @@ int main(int argc, char* argv[]) return 1; } - LibraryInitializer init; X509_Certificate subject_cert(argv[1]); Certificate_Store_In_Memory certs; diff --git a/doc/examples/dsa_sign.cpp b/src/apps/dsa_sign.cpp index 3511eacfa..31aaf7aeb 100644 --- a/doc/examples/dsa_sign.cpp +++ b/src/apps/dsa_sign.cpp @@ -1,10 +1,10 @@ +#include "apps.h" #include <iostream> #include <iomanip> #include <fstream> #include <string> #include <memory> -#include <botan/botan.h> #include <botan/pubkey.h> #include <botan/dsa.h> #include <botan/base64.h> @@ -12,7 +12,7 @@ using namespace Botan; const std::string SUFFIX = ".sig"; -int main(int argc, char* argv[]) +int dsa_sign(int argc, char* argv[]) { if(argc != 4) { @@ -21,8 +21,6 @@ int main(int argc, char* argv[]) return 1; } - Botan::LibraryInitializer init; - try { std::string passphrase(argv[3]); diff --git a/doc/examples/dsa_ver.cpp b/src/apps/dsa_ver.cpp index e6910a4e1..9cf0ed969 100644 --- a/doc/examples/dsa_ver.cpp +++ b/src/apps/dsa_ver.cpp @@ -1,3 +1,4 @@ +#include "apps.h" #include <iostream> #include <iomanip> #include <fstream> @@ -5,9 +6,9 @@ #include <string> #include <memory> -#include <botan/botan.h> #include <botan/pubkey.h> #include <botan/dsa.h> +#include <botan/b64_filt.h> using namespace Botan; namespace { @@ -21,7 +22,7 @@ secure_vector<byte> b64_decode(const std::string& in) } -int main(int argc, char* argv[]) +int dsa_verify(int argc, char* argv[]) { if(argc != 4) { @@ -32,8 +33,6 @@ int main(int argc, char* argv[]) try { - Botan::LibraryInitializer init; - std::ifstream message(argv[2], std::ios::binary); if(!message) { diff --git a/doc/examples/ocsp.cpp b/src/apps/ocsp.cpp index 81cfa198b..853debbe3 100644 --- a/doc/examples/ocsp.cpp +++ b/src/apps/ocsp.cpp @@ -1,4 +1,4 @@ -#include <botan/botan.h> +#include "apps.h" #include <botan/x509cert.h> #include <botan/certstor.h> #include <botan/x509path.h> @@ -8,10 +8,13 @@ using namespace Botan; -int main(int argc, char* argv[]) +int ocsp_check(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]); @@ -23,7 +26,13 @@ int main(int argc, char* argv[]) 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; + } } diff --git a/src/main.cpp b/src/main.cpp index 956413d4c..f1451becf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -155,6 +155,8 @@ int main(int argc, char* argv[]) CALL_CMD(fpe); CALL_CMD(hash); CALL_CMD(keygen); + CALL_CMD(dsa_sign); + CALL_CMD(dsa_verify); CALL_CMD(pkcs10); CALL_CMD(read_ssh); CALL_CMD(self_sig); |