aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk/pubkey/pk_ops.h
blob: 5413fc7cd17078e6a49dc326b6f5bb4165c335a0 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*************************************************
* Public Key Operations Header File              *
* (C) 1999-2008 Jack Lloyd                       *
*************************************************/

#ifndef BOTAN_PK_OPS_H__
#define BOTAN_PK_OPS_H__

#include <botan/bigint.h>
#include <botan/dl_group.h>

#if defined(BOTAN_HAS_ECDSA)
  #include <botan/point_gfp.h>
#endif

namespace Botan {

/*************************************************
* IF Operation                                   *
*************************************************/
class BOTAN_DLL IF_Operation
   {
   public:
      virtual BigInt public_op(const BigInt&) const = 0;
      virtual BigInt private_op(const BigInt&) const = 0;
      virtual IF_Operation* clone() const = 0;
      virtual ~IF_Operation() {}
   };

/*************************************************
* DSA Operation                                  *
*************************************************/
class BOTAN_DLL DSA_Operation
   {
   public:
      virtual bool verify(const byte[], u32bit,
                          const byte[], u32bit) const = 0;
      virtual SecureVector<byte> sign(const byte[], u32bit,
                                      const BigInt&) const = 0;
      virtual DSA_Operation* clone() const = 0;
      virtual ~DSA_Operation() {}
   };

/*************************************************
* NR Operation                                   *
*************************************************/
class BOTAN_DLL NR_Operation
   {
   public:
      virtual SecureVector<byte> verify(const byte[], u32bit) const = 0;
      virtual SecureVector<byte> sign(const byte[], u32bit,
                                      const BigInt&) const = 0;
      virtual NR_Operation* clone() const = 0;
      virtual ~NR_Operation() {}
   };

/*************************************************
* ElGamal Operation                              *
*************************************************/
class BOTAN_DLL ELG_Operation
   {
   public:
      virtual SecureVector<byte> encrypt(const byte[], u32bit,
                                         const BigInt&) const = 0;
      virtual BigInt decrypt(const BigInt&, const BigInt&) const = 0;
      virtual ELG_Operation* clone() const = 0;
      virtual ~ELG_Operation() {}
   };

/*************************************************
* DH Operation                                   *
*************************************************/
class BOTAN_DLL DH_Operation
   {
   public:
      virtual BigInt agree(const BigInt&) const = 0;
      virtual DH_Operation* clone() const = 0;
      virtual ~DH_Operation() {}
   };

#if defined(BOTAN_HAS_ECDSA)
/*************************************************
* ECDSA Operation                               *
*************************************************/
class BOTAN_DLL ECDSA_Operation
   {
   public:
      virtual bool verify(const byte sig[], u32bit sig_len,
                          const byte msg[], u32bit msg_len) const = 0;

      virtual SecureVector<byte> sign(const byte message[],
                                      u32bit mess_len) const = 0;

      virtual ECDSA_Operation* clone() const = 0;

      virtual ~ECDSA_Operation() {}
   };

/*************************************************
* ECKAEG Operation                               *
*************************************************/
class BOTAN_DLL ECKAEG_Operation
   {
   public:
      virtual SecureVector<byte> agree(const PointGFp&) const = 0;
      virtual ECKAEG_Operation* clone() const = 0;
      virtual ~ECKAEG_Operation() {}
   };
#endif

}

#endif