diff options
author | lloyd <[email protected]> | 2008-09-28 19:16:15 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 19:16:15 +0000 |
commit | 8534c9a67226ccffe7acbefbf3905aba10e88de3 (patch) | |
tree | 536e96a8b2763515104d6c90abddd3eb8aa74b19 /checks/x509.cpp | |
parent | 26ad026e8eb0521a9fb2f313f07f8fc7222d2ea8 (diff) |
Create an x509 module containing all of the X509 certificate and CA
code as well as the code for handling PKCS #10 requests.
Diffstat (limited to 'checks/x509.cpp')
-rw-r--r-- | checks/x509.cpp | 87 |
1 files changed, 50 insertions, 37 deletions
diff --git a/checks/x509.cpp b/checks/x509.cpp index f2517d02a..5f5c6b1fa 100644 --- a/checks/x509.cpp +++ b/checks/x509.cpp @@ -1,11 +1,15 @@ #include <botan/filters.h> +#include <botan/rsa.h> +#include <botan/dsa.h> + +#ifdef BOTAN_HAS_X509 #include <botan/x509self.h> #include <botan/x509stor.h> #include <botan/x509_ca.h> #include <botan/pkcs10.h> -#include <botan/rsa.h> -#include <botan/dsa.h> +#endif + using namespace Botan; #include <iostream> @@ -14,9 +18,7 @@ using namespace Botan; #include "validate.h" #include "common.h" -X509_Cert_Options ca_opts(); -X509_Cert_Options req_opts1(); -X509_Cert_Options req_opts2(); +#ifdef BOTAN_HAS_X509 namespace { @@ -44,6 +46,45 @@ u64bit key_id(const Public_Key* key) return id; } + +/* Return some option sets */ +X509_Cert_Options ca_opts() + { + X509_Cert_Options opts("Test CA/US/Botan Project/Testing"); + + opts.uri = "http://botan.randombit.net"; + opts.dns = "botan.randombit.net"; + opts.email = "[email protected]"; + + opts.CA_key(1); + + return opts; + } + +X509_Cert_Options req_opts1() + { + X509_Cert_Options opts("Test User 1/US/Botan Project/Testing"); + + opts.uri = "http://botan.randombit.net"; + opts.dns = "botan.randombit.net"; + opts.email = "[email protected]"; + + return opts; + } + +X509_Cert_Options req_opts2() + { + X509_Cert_Options opts("Test User 2/US/Botan Project/Testing"); + + opts.uri = "http://botan.randombit.net"; + opts.dns = "botan.randombit.net"; + opts.email = "[email protected]"; + + opts.add_ex_constraint("PKIX.EmailProtection"); + + return opts; + } + u32bit check_against_copy(const Private_Key& orig, RandomNumberGenerator& rng) { @@ -157,40 +198,12 @@ void do_x509_tests(RandomNumberGenerator& rng) std::cout << std::endl; } -/* Return some option sets */ -X509_Cert_Options ca_opts() - { - X509_Cert_Options opts("Test CA/US/Botan Project/Testing"); - - opts.uri = "http://botan.randombit.net"; - opts.dns = "botan.randombit.net"; - opts.email = "[email protected]"; - - opts.CA_key(1); - - return opts; - } +#else -X509_Cert_Options req_opts1() +void do_x509_tests(RandomNumberGenerator&) { - X509_Cert_Options opts("Test User 1/US/Botan Project/Testing"); - - opts.uri = "http://botan.randombit.net"; - opts.dns = "botan.randombit.net"; - opts.email = "[email protected]"; - - return opts; + std::cout << "Skipping Botan X.509 tests (disabled in build)\n"; } -X509_Cert_Options req_opts2() - { - X509_Cert_Options opts("Test User 2/US/Botan Project/Testing"); - - opts.uri = "http://botan.randombit.net"; - opts.dns = "botan.randombit.net"; - opts.email = "[email protected]"; +#endif - opts.add_ex_constraint("PKIX.EmailProtection"); - - return opts; - } |