aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-04 19:18:02 +0000
committerlloyd <[email protected]>2010-03-04 19:18:02 +0000
commit48ad7e66e77c8e6a536889f35530ec92e25a082d (patch)
tree94577b4ef1d667b66606ae3b4fa5d45addd9960c /src
parent23cec11e0c88af17280697a37cebb78ed02678ee (diff)
Clean up PK_Key_Agreement slightly
Diffstat (limited to 'src')
-rw-r--r--src/pubkey/pubkey.cpp15
-rw-r--r--src/pubkey/pubkey.h38
2 files changed, 32 insertions, 21 deletions
diff --git a/src/pubkey/pubkey.cpp b/src/pubkey/pubkey.cpp
index dc0a505f5..feb33a361 100644
--- a/src/pubkey/pubkey.cpp
+++ b/src/pubkey/pubkey.cpp
@@ -362,21 +362,6 @@ PK_Key_Agreement::PK_Key_Agreement(const PK_Key_Agreement_Key& k,
{
}
-/*
-* Perform Key Agreement Operation
-*/
-SymmetricKey PK_Key_Agreement::derive_key(u32bit key_len,
- const byte in[], u32bit in_len,
- const std::string& params) const
- {
- return derive_key(key_len, in, in_len,
- reinterpret_cast<const byte*>(params.data()),
- params.length());
- }
-
-/*
-* Perform Key Agreement Operation
-*/
SymmetricKey PK_Key_Agreement::derive_key(u32bit key_len, const byte in[],
u32bit in_len, const byte params[],
u32bit params_len) const
diff --git a/src/pubkey/pubkey.h b/src/pubkey/pubkey.h
index c73a54d35..6d48faa4f 100644
--- a/src/pubkey/pubkey.h
+++ b/src/pubkey/pubkey.h
@@ -263,17 +263,43 @@ class BOTAN_DLL PK_Verifier
class BOTAN_DLL PK_Key_Agreement
{
public:
- SymmetricKey derive_key(u32bit, const byte[], u32bit,
- const std::string& = "") const;
- SymmetricKey derive_key(u32bit, const byte[], u32bit,
- const byte[], u32bit) const;
+
+ /*
+ * Perform Key Agreement Operation
+ * @param key_len the desired key output size
+ * @param in the other parties key
+ * @param in_len the length of in in bytes
+ * @param params extra derivation params
+ * @param params_len the length of params in bytes
+ */
+ SymmetricKey derive_key(u32bit key_len,
+ const byte in[],
+ u32bit in_len,
+ const byte params[],
+ u32bit params_len) const;
+
+ /*
+ * Perform Key Agreement Operation
+ * @param key_len the desired key output size
+ * @param in the other parties key
+ * @param in_len the length of in in bytes
+ * @param params extra derivation params
+ */
+ SymmetricKey derive_key(u32bit key_len,
+ const byte in[], u32bit in_len,
+ const std::string& params = "") const
+ {
+ return derive_key(key_len, in, in_len,
+ reinterpret_cast<const byte*>(params.data()),
+ params.length());
+ }
/**
* Construct a PK Key Agreement.
* @param key the key to use
- * @param kdf the KDF to use
+ * @param kdf the KDF to use (or NULL for no KDF)
*/
- PK_Key_Agreement(const PK_Key_Agreement_Key& key, KDF* kdf);
+ PK_Key_Agreement(const PK_Key_Agreement_Key& key, KDF* kdf = 0);
~PK_Key_Agreement() { delete kdf; }
private: