Botan  1.10.9
pk_filts.h
Go to the documentation of this file.
1 /*
2 * PK Filters
3 * (C) 1999-2009 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_PK_FILTERS_H__
9 #define BOTAN_PK_FILTERS_H__
10 
11 #include <botan/filter.h>
12 #include <botan/pubkey.h>
13 
14 namespace Botan {
15 
16 /**
17 * PK_Encryptor Filter
18 */
19 class BOTAN_DLL PK_Encryptor_Filter : public Filter
20  {
21  public:
22  std::string name() const { return "PK Encryptor"; }
23 
24  void write(const byte[], size_t);
25  void end_msg();
27  RandomNumberGenerator& rng_ref) :
28  cipher(c), rng(rng_ref) {}
29  ~PK_Encryptor_Filter() { delete cipher; }
30  private:
31  PK_Encryptor* cipher;
33  SecureVector<byte> buffer;
34  };
35 
36 /**
37 * PK_Decryptor Filter
38 */
39 class BOTAN_DLL PK_Decryptor_Filter : public Filter
40  {
41  public:
42  std::string name() const { return "PK Decryptor"; }
43 
44  void write(const byte[], size_t);
45  void end_msg();
46  PK_Decryptor_Filter(PK_Decryptor* c) : cipher(c) {}
47  ~PK_Decryptor_Filter() { delete cipher; }
48  private:
49  PK_Decryptor* cipher;
50  SecureVector<byte> buffer;
51  };
52 
53 /**
54 * PK_Signer Filter
55 */
56 class BOTAN_DLL PK_Signer_Filter : public Filter
57  {
58  public:
59  std::string name() const { return "PK Signer"; }
60 
61  void write(const byte[], size_t);
62  void end_msg();
63 
65  RandomNumberGenerator& rng_ref) :
66  signer(s), rng(rng_ref) {}
67 
68  ~PK_Signer_Filter() { delete signer; }
69  private:
70  PK_Signer* signer;
72  };
73 
74 /**
75 * PK_Verifier Filter
76 */
77 class BOTAN_DLL PK_Verifier_Filter : public Filter
78  {
79  public:
80  std::string name() const { return "PK Verifier"; }
81 
82  void write(const byte[], size_t);
83  void end_msg();
84 
85  void set_signature(const byte[], size_t);
86  void set_signature(const MemoryRegion<byte>&);
87 
88  PK_Verifier_Filter(PK_Verifier* v) : verifier(v) {}
89  PK_Verifier_Filter(PK_Verifier*, const byte[], size_t);
91  ~PK_Verifier_Filter() { delete verifier; }
92  private:
93  PK_Verifier* verifier;
94  SecureVector<byte> signature;
95  };
96 
97 }
98 
99 #endif
PK_Verifier_Filter(PK_Verifier *v)
Definition: pk_filts.h:88
std::string name() const
Definition: pk_filts.h:59
PK_Decryptor_Filter(PK_Decryptor *c)
Definition: pk_filts.h:46
unsigned char byte
Definition: types.h:22
RandomNumberGenerator * rng
Definition: global_rng.cpp:165
PK_Encryptor_Filter(PK_Encryptor *c, RandomNumberGenerator &rng_ref)
Definition: pk_filts.h:26
std::string name() const
Definition: pk_filts.h:22
std::string name() const
Definition: pk_filts.h:80
std::string name() const
Definition: pk_filts.h:42
PK_Signer_Filter(PK_Signer *s, RandomNumberGenerator &rng_ref)
Definition: pk_filts.h:64
size_t s
Definition: numthry.cpp:27