aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_tls_policy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/unit_tls_policy.cpp')
-rw-r--r--src/tests/unit_tls_policy.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/tests/unit_tls_policy.cpp b/src/tests/unit_tls_policy.cpp
index 66080a283..909a3cd57 100644
--- a/src/tests/unit_tls_policy.cpp
+++ b/src/tests/unit_tls_policy.cpp
@@ -9,30 +9,30 @@
#include "tests.h"
#if defined(BOTAN_HAS_TLS)
- #include <botan/pubkey.h>
- #include <botan/oids.h>
- #include <botan/tls_policy.h>
- #include <botan/tls_exceptn.h>
+ #include <botan/pubkey.h>
+ #include <botan/oids.h>
+ #include <botan/tls_policy.h>
+ #include <botan/tls_exceptn.h>
#endif
#if defined(BOTAN_HAS_RSA)
- #include <botan/rsa.h>
+ #include <botan/rsa.h>
#endif
#if defined(BOTAN_HAS_ECDH)
- #include <botan/ecdh.h>
+ #include <botan/ecdh.h>
#endif
#if defined(BOTAN_HAS_ECDSA)
- #include <botan/ecdsa.h>
+ #include <botan/ecdsa.h>
#endif
#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
- #include <botan/dh.h>
+ #include <botan/dh.h>
#endif
#if defined(BOTAN_HAS_DSA)
- #include <botan/dsa.h>
+ #include <botan/dsa.h>
#endif
namespace Botan_Tests {
@@ -60,9 +60,9 @@ class TLS_Policy_Unit_Tests : public Test
{
Test::Result result("TLS Policy RSA key verification");
#if defined(BOTAN_HAS_RSA)
- std::unique_ptr<Botan::Private_Key> rsa_key_1024 (new Botan::RSA_PrivateKey(Test::rng(), 1024));
+ std::unique_ptr<Botan::Private_Key> rsa_key_1024(new Botan::RSA_PrivateKey(Test::rng(), 1024));
Botan::TLS::Policy policy;
-
+
try
{
policy.check_peer_key_acceptable(*rsa_key_1024);
@@ -72,20 +72,20 @@ class TLS_Policy_Unit_Tests : public Test
{
result.test_success("Correctly rejecting 1024 bit RSA keys");
}
-
- std::unique_ptr<Botan::Private_Key> rsa_key_2048 (new Botan::RSA_PrivateKey(Test::rng(), 2048));
+
+ std::unique_ptr<Botan::Private_Key> rsa_key_2048(new Botan::RSA_PrivateKey(Test::rng(), 2048));
policy.check_peer_key_acceptable(*rsa_key_2048);
result.test_success("Correctly accepting 2048 bit RSA keys");
#endif
return result;
}
-
+
Test::Result test_peer_key_acceptable_ecdh()
{
Test::Result result("TLS Policy ECDH key verification");
-#if defined(BOTAN_HAS_ECDH)
+#if defined(BOTAN_HAS_ECDH)
Botan::EC_Group group_192("secp192r1");
- std::unique_ptr<Botan::Private_Key> ecdh_192 (new Botan::ECDH_PrivateKey(Test::rng(), group_192));
+ std::unique_ptr<Botan::Private_Key> ecdh_192(new Botan::ECDH_PrivateKey(Test::rng(), group_192));
Botan::TLS::Policy policy;
try
@@ -97,21 +97,21 @@ class TLS_Policy_Unit_Tests : public Test
{
result.test_success("Correctly rejecting 192 bit EC keys");
}
-
+
Botan::EC_Group group_256("secp256r1");
- std::unique_ptr<Botan::Private_Key> ecdh_256 (new Botan::ECDH_PrivateKey(Test::rng(), group_256));
+ std::unique_ptr<Botan::Private_Key> ecdh_256(new Botan::ECDH_PrivateKey(Test::rng(), group_256));
policy.check_peer_key_acceptable(*ecdh_256);
result.test_success("Correctly accepting 256 bit EC keys");
#endif
return result;
}
-
+
Test::Result test_peer_key_acceptable_ecdsa()
{
Test::Result result("TLS Policy ECDSA key verification");
-#if defined(BOTAN_HAS_ECDSA)
+#if defined(BOTAN_HAS_ECDSA)
Botan::EC_Group group_192("secp192r1");
- std::unique_ptr<Botan::Private_Key> ecdsa_192 (new Botan::ECDSA_PrivateKey(Test::rng(), group_192));
+ std::unique_ptr<Botan::Private_Key> ecdsa_192(new Botan::ECDSA_PrivateKey(Test::rng(), group_192));
Botan::TLS::Policy policy;
try
@@ -123,25 +123,25 @@ class TLS_Policy_Unit_Tests : public Test
{
result.test_success("Correctly rejecting 192 bit EC keys");
}
-
+
Botan::EC_Group group_256("secp256r1");
- std::unique_ptr<Botan::Private_Key> ecdsa_256 (new Botan::ECDSA_PrivateKey(Test::rng(), group_256));
+ std::unique_ptr<Botan::Private_Key> ecdsa_256(new Botan::ECDSA_PrivateKey(Test::rng(), group_256));
policy.check_peer_key_acceptable(*ecdsa_256);
result.test_success("Correctly accepting 256 bit EC keys");
#endif
return result;
}
-
+
Test::Result test_peer_key_acceptable_dh()
{
Test::Result result("TLS Policy DH key verification");
-#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
+#if defined(BOTAN_HAS_DIFFIE_HELLMAN)
const BigInt g("2");
const BigInt p("58458002095536094658683755258523362961421200751439456159756164191494576279467");
const Botan::DL_Group grp(p, g);
const Botan::BigInt x("46205663093589612668746163860870963912226379131190812163519349848291472898748");
- std::unique_ptr<Botan::Private_Key> dhkey (new Botan::DH_PrivateKey(Test::rng(), grp, x));
-
+ std::unique_ptr<Botan::Private_Key> dhkey(new Botan::DH_PrivateKey(Test::rng(), grp, x));
+
Botan::TLS::Policy policy;
try
{