aboutsummaryrefslogtreecommitdiffstats
path: root/checks/x509.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'checks/x509.cpp')
-rw-r--r--checks/x509.cpp87
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;
- }