aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/s2k.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-29 00:15:14 +0000
committerlloyd <[email protected]>2008-09-29 00:15:14 +0000
commit68d3d539ad7752dc80c20c1a2ade909b1a4c4a6e (patch)
treec7e588d28427960c95eca9900844d5bf36c079df /src/core/s2k.h
parent8269e2897e0a652bbd949d38b74873976a98adeb (diff)
Move what is left of the uncategorized library to 'core'. There is still
a lot of public key stuff in here that needs to be extracted however, and probably 2-3 other modules worth of stuff to split off (engines, etc)
Diffstat (limited to 'src/core/s2k.h')
-rw-r--r--src/core/s2k.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/core/s2k.h b/src/core/s2k.h
new file mode 100644
index 000000000..031592513
--- /dev/null
+++ b/src/core/s2k.h
@@ -0,0 +1,45 @@
+/*************************************************
+* S2K Header File *
+* (C) 1999-2007 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_S2K_H__
+#define BOTAN_S2K_H__
+
+#include <botan/symkey.h>
+#include <botan/rng.h>
+
+namespace Botan {
+
+/*************************************************
+* S2K Interface *
+*************************************************/
+class BOTAN_DLL S2K
+ {
+ public:
+ virtual S2K* clone() const = 0;
+ virtual std::string name() const = 0;
+ virtual void clear() {}
+
+ OctetString derive_key(u32bit, const std::string&) const;
+
+ void set_iterations(u32bit);
+ void change_salt(const byte[], u32bit);
+ void change_salt(const MemoryRegion<byte>&);
+ void new_random_salt(RandomNumberGenerator& rng, u32bit);
+
+ u32bit iterations() const { return iter; }
+ SecureVector<byte> current_salt() const { return salt; }
+
+ S2K() { iter = 0; }
+ virtual ~S2K() {}
+ private:
+ virtual OctetString derive(u32bit, const std::string&,
+ const byte[], u32bit, u32bit) const = 0;
+ SecureVector<byte> salt;
+ u32bit iter;
+ };
+
+}
+
+#endif