aboutsummaryrefslogtreecommitdiffstats
path: root/src/s2k/s2k.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/s2k/s2k.h')
-rw-r--r--src/s2k/s2k.h58
1 files changed, 9 insertions, 49 deletions
diff --git a/src/s2k/s2k.h b/src/s2k/s2k.h
index 7af92519b..82f5abeef 100644
--- a/src/s2k/s2k.h
+++ b/src/s2k/s2k.h
@@ -39,62 +39,22 @@ class BOTAN_DLL S2K
/**
* Derive a key from a passphrase with this S2K object. It will use
* the salt value and number of iterations configured in this object.
- * @param key_len the desired length of the key to produce
+ * @param output_len the desired length of the key to produce
* @param passphrase the password to derive the key from
+ * @param salt the randomly chosen salt
+ * @param salt_len length of salt in bytes
+ * @param iterations the number of iterations to use (use 10K or more)
*/
- OctetString derive_key(u32bit key_len,
- const std::string& passphrase) const;
+ virtual OctetString derive_key(u32bit output_len,
+ const std::string& passphrase,
+ const byte salt[], u32bit salt_len,
+ u32bit iterations) const = 0;
- /**
- * Set the number of iterations for the one-way function during
- * key generation.
- * @param n the desired number of iterations
- */
- void set_iterations(u32bit n);
-
- /**
- * Set a new salt value.
- * @param new_salt a byte array defining the new salt value
- * @param len the length of the above byte array
- */
- void change_salt(const byte new_salt[], u32bit len);
-
- /**
- * Set a new salt value.
- * @param new_salt the new salt value
- */
- void change_salt(const MemoryRegion<byte>& new_salt);
-
- /**
- * Create a new random salt value using the rng
- * @param rng the random number generator to use
- * @param len the desired length of the new salt value
- */
- void new_random_salt(RandomNumberGenerator& rng, u32bit len);
-
- /**
- * Get the number of iterations for the key derivation currently
- * configured in this S2K object.
- * @return the current number of iterations
- */
- u32bit iterations() const { return iter; }
-
- /**
- * Get the currently configured salt value of this S2K object.
- * @return the current salt value
- */
- SecureVector<byte> current_salt() const { return salt; }
-
- S2K() { iter = 0; }
+ S2K() {}
virtual ~S2K() {}
private:
S2K(const S2K&) {}
S2K& operator=(const S2K&) { return (*this); }
-
- virtual OctetString derive(u32bit, const std::string&,
- const byte[], u32bit, u32bit) const = 0;
- SecureVector<byte> salt;
- u32bit iter;
};
}