aboutsummaryrefslogtreecommitdiffstats
path: root/checks/ecdh.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-08 15:36:18 +0000
committerlloyd <[email protected]>2010-03-08 15:36:18 +0000
commit8a47f6f2bbf169a2ea0853234f81b49070c770df (patch)
tree2633ed0d927faf23a067aa88d6cceb9de29f0be4 /checks/ecdh.cpp
parent05f6d6c8edec9907778f362c927f368140fee6a2 (diff)
Modify pubkey classes to take names instead of object pointers.
Remove use of look_pk from the source and examples, instead instantiate classes directly.
Diffstat (limited to 'checks/ecdh.cpp')
-rw-r--r--checks/ecdh.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/checks/ecdh.cpp b/checks/ecdh.cpp
index 92b2f58e8..a63742f2f 100644
--- a/checks/ecdh.cpp
+++ b/checks/ecdh.cpp
@@ -17,7 +17,7 @@
#include <iostream>
#include <fstream>
-#include <botan/look_pk.h>
+#include <botan/pubkey.h>
#include <botan/ecdh.h>
#include <botan/x509self.h>
#include <botan/der_enc.h>
@@ -39,11 +39,11 @@ void test_ecdh_normal_derivation(RandomNumberGenerator& rng)
ECDH_PrivateKey private_b(rng, dom_pars); //public_a.getCurve()
- std::auto_ptr<PK_Key_Agreement> ka(get_pk_kas(private_a, "KDF2(SHA-1)"));
- std::auto_ptr<PK_Key_Agreement> kb(get_pk_kas(private_b, "KDF2(SHA-1)"));
+ PK_Key_Agreement ka(private_a, "KDF2(SHA-1)");
+ PK_Key_Agreement kb(private_b, "KDF2(SHA-1)");
- SymmetricKey alice_key = ka->derive_key(32, private_b.public_value());
- SymmetricKey bob_key = kb->derive_key(32, private_a.public_value());
+ SymmetricKey alice_key = ka.derive_key(32, private_b.public_value());
+ SymmetricKey bob_key = kb.derive_key(32, private_a.public_value());
if(alice_key != bob_key)
{
@@ -70,11 +70,11 @@ void test_ecdh_some_dp(RandomNumberGenerator& rng)
ECDH_PrivateKey private_a(rng, dom_pars);
ECDH_PrivateKey private_b(rng, dom_pars);
- std::auto_ptr<PK_Key_Agreement> ka(get_pk_kas(private_a, "KDF2(SHA-1)"));
- std::auto_ptr<PK_Key_Agreement> kb(get_pk_kas(private_b, "KDF2(SHA-1)"));
+ PK_Key_Agreement ka(private_a, "KDF2(SHA-1)");
+ PK_Key_Agreement kb(private_b, "KDF2(SHA-1)");
- SymmetricKey alice_key = ka->derive_key(32, private_b.public_value());
- SymmetricKey bob_key = kb->derive_key(32, private_a.public_value());
+ SymmetricKey alice_key = ka.derive_key(32, private_b.public_value());
+ SymmetricKey bob_key = kb.derive_key(32, private_a.public_value());
CHECK_MESSAGE(alice_key == bob_key, "different keys - " << "Alice's key was: " << alice_key.as_string() << ", Bob's key was: " << bob_key.as_string());
}
@@ -99,11 +99,11 @@ void test_ecdh_der_derivation(RandomNumberGenerator& rng)
MemoryVector<byte> key_a = private_a.public_value();
MemoryVector<byte> key_b = private_b.public_value();
- std::auto_ptr<PK_Key_Agreement> ka(get_pk_kas(private_a, "KDF2(SHA-1)"));
- std::auto_ptr<PK_Key_Agreement> kb(get_pk_kas(private_b, "KDF2(SHA-1)"));
+ PK_Key_Agreement ka(private_a, "KDF2(SHA-1)");
+ PK_Key_Agreement kb(private_b, "KDF2(SHA-1)");
- SymmetricKey alice_key = ka->derive_key(32, key_b);
- SymmetricKey bob_key = kb->derive_key(32, key_a);
+ SymmetricKey alice_key = ka.derive_key(32, key_b);
+ SymmetricKey bob_key = kb.derive_key(32, key_a);
CHECK_MESSAGE(alice_key == bob_key, "different keys - " << "Alice's key was: " << alice_key.as_string() << ", Bob's key was: " << bob_key.as_string());
//cout << "key: " << alice_key.as_string() << endl;