summaryrefslogtreecommitdiffstats
path: root/botan/src/sym_algo/symkey.h
diff options
context:
space:
mode:
authorKeith Isdale <keith.isdale@nokia.com>2010-07-26 14:56:53 +1000
committerKeith Isdale <keith.isdale@nokia.com>2010-07-26 14:56:53 +1000
commit9f034793bcfc51c2b7c1dd14db806f7258f9a9eb (patch)
tree63bd0f50ce5b77828ad8205eafd7b9412810499e /botan/src/sym_algo/symkey.h
parent619d92cfef29e653bfdf852e83888e50cfc4348f (diff)
parent65271649dbc90f3af1184ad1b23bdb64c0c07d07 (diff)
Merge branch 'master' of git://git-nokia.trolltech.com.au/qtsoftware/research/qtuitest
Diffstat (limited to 'botan/src/sym_algo/symkey.h')
-rw-r--r--botan/src/sym_algo/symkey.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/botan/src/sym_algo/symkey.h b/botan/src/sym_algo/symkey.h
new file mode 100644
index 0000000..5504297
--- /dev/null
+++ b/botan/src/sym_algo/symkey.h
@@ -0,0 +1,62 @@
+/*
+* OctetString
+* (C) 1999-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_SYMKEY_H__
+#define BOTAN_SYMKEY_H__
+
+#include <botan/secmem.h>
+#include <string>
+
+namespace Botan {
+
+/*
+* Octet String
+*/
+class BOTAN_DLL OctetString
+ {
+ public:
+ u32bit length() const { return bits.size(); }
+ SecureVector<byte> bits_of() const { return bits; }
+
+ const byte* begin() const { return bits.begin(); }
+ const byte* end() const { return bits.end(); }
+
+ std::string as_string() const;
+
+ OctetString& operator^=(const OctetString&);
+
+ void set_odd_parity();
+
+ void change(const std::string&);
+ void change(const byte[], u32bit);
+ void change(const MemoryRegion<byte>& in) { bits = in; }
+
+ OctetString(class RandomNumberGenerator&, u32bit len);
+ OctetString(const std::string& str = "") { change(str); }
+ OctetString(const byte in[], u32bit len) { change(in, len); }
+ OctetString(const MemoryRegion<byte>& in) { change(in); }
+ private:
+ SecureVector<byte> bits;
+ };
+
+/*
+* Operations on Octet Strings
+*/
+BOTAN_DLL bool operator==(const OctetString&, const OctetString&);
+BOTAN_DLL bool operator!=(const OctetString&, const OctetString&);
+BOTAN_DLL OctetString operator+(const OctetString&, const OctetString&);
+BOTAN_DLL OctetString operator^(const OctetString&, const OctetString&);
+
+/*
+* Alternate Names
+*/
+typedef OctetString SymmetricKey;
+typedef OctetString InitializationVector;
+
+}
+
+#endif