aboutsummaryrefslogtreecommitdiffstats
path: root/include/s2k.h
blob: 0b1eb0b50abb9f4041f4d08dc01dea6f7b060219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*************************************************
* S2K Header File                                *
* (C) 1999-2006 The Botan Project                *
*************************************************/

#ifndef BOTAN_S2K_H__
#define BOTAN_S2K_H__

#include <botan/base.h>

namespace Botan {

/*************************************************
* S2K Interface                                  *
*************************************************/
class S2K : public Algorithm
   {
   public:
      virtual S2K* clone() const = 0;

      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(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