aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-08-23 05:50:30 +0000
committerlloyd <[email protected]>2006-08-23 05:50:30 +0000
commit6b688d86c95da868dfe600c9d39485a4fafda0f8 (patch)
tree1e647b6d40c787eaea17ddcc032cf3423c530460
parent6584d0c80a7f6e34d1507f23e2e6a49c15aa8bb7 (diff)
Add a new version of the StreamCipher_Filter constructor that takes a key
as well as the cipher name
-rw-r--r--include/filters.h1
-rw-r--r--src/filters.cpp11
2 files changed, 12 insertions, 0 deletions
diff --git a/include/filters.h b/include/filters.h
index 377181d63..c088e36a4 100644
--- a/include/filters.h
+++ b/include/filters.h
@@ -28,6 +28,7 @@ class StreamCipher_Filter : public Keyed_Filter
void write(const byte[], u32bit);
StreamCipher_Filter(const std::string&);
+ StreamCipher_Filter(const std::string&, const SymmetricKey&);
~StreamCipher_Filter() { delete cipher; }
private:
SecureVector<byte> buffer;
diff --git a/src/filters.cpp b/src/filters.cpp
index aadc32c4e..9ea082980 100644
--- a/src/filters.cpp
+++ b/src/filters.cpp
@@ -19,6 +19,17 @@ StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name) :
}
/*************************************************
+* StreamCipher_Filter Constructor *
+*************************************************/
+StreamCipher_Filter::StreamCipher_Filter(const std::string& sc_name,
+ const SymmetricKey& key) :
+ buffer(DEFAULT_BUFFERSIZE)
+ {
+ base_ptr = cipher = get_stream_cipher(sc_name);
+ cipher->set_key(key);
+ }
+
+/*************************************************
* Set the IV of a stream cipher *
*************************************************/
void StreamCipher_Filter::set_iv(const InitializationVector& iv)