diff options
author | Daniel Neus <[email protected]> | 2016-06-17 11:37:18 +0200 |
---|---|---|
committer | Daniel Neus <[email protected]> | 2016-06-17 16:19:40 +0200 |
commit | 2ea6f9b1963795dad74489b41bc7d37f897d7a21 (patch) | |
tree | c9120503521633ee4a25ac2021b392f33d82e8d7 /src/tests/test_pkcs11.h | |
parent | 601f8f6d6075ff2f944c11d357f2309da0c4deb1 (diff) |
add PKCS#11 support
Diffstat (limited to 'src/tests/test_pkcs11.h')
-rw-r--r-- | src/tests/test_pkcs11.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/tests/test_pkcs11.h b/src/tests/test_pkcs11.h new file mode 100644 index 000000000..8606612d3 --- /dev/null +++ b/src/tests/test_pkcs11.h @@ -0,0 +1,50 @@ +/* +* (C) 2016 Daniel Neus +* +* Botan is released under the Simplified BSD License (see license.txt) +*/ + +#ifndef BOTAN_TESTS_PKCS11_H__ +#define BOTAN_TESTS_PKCS11_H__ + +#include "tests.h" + +#if defined(BOTAN_HAS_PKCS11) + #include <botan/p11.h> +#endif + +#include <botan/secmem.h> + +#include <string> +#include <vector> +#include <functional> + +namespace Botan_Tests { + +#if defined(BOTAN_HAS_PKCS11) + +// PIN is expected to be set to "123456" prior to running the tests +const std::string PIN = "123456"; +const auto PIN_SECVEC = Botan::PKCS11::secure_string(PIN.begin(), PIN.end()); + +const std::string TEST_PIN = "654321"; +const auto TEST_PIN_SECVEC = Botan::PKCS11::secure_string(TEST_PIN.begin(), TEST_PIN.end()); + +// SO PIN is expected to be set to "12345678" prior to running the tests +const std::string SO_PIN = "12345678"; +const auto SO_PIN_SECVEC = Botan::PKCS11::secure_string(SO_PIN.begin(), SO_PIN.end()); + +const std::string TEST_SO_PIN = "87654321"; +const auto TEST_SO_PIN_SECVEC = Botan::PKCS11::secure_string(TEST_SO_PIN.begin(), TEST_SO_PIN.end()); + +class PKCS11_Test : public Test + { + protected: + static std::vector<Test::Result> run_pkcs11_tests(const std::string& name, + std::vector<std::function<Test::Result()>>& fns); + }; + +#endif +} + +#endif |