monotone

monotone Mtn Source Tree

Root/botan/pk_keys.h

1/*************************************************
2* PK Key Types Header File *
3* (C) 1999-2006 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_PK_KEYS_H__
7#define BOTAN_PK_KEYS_H__
8
9#include <botan/base.h>
10#include <botan/asn1_oid.h>
11
12namespace Botan {
13
14/*************************************************
15* Public Key Base Class *
16*************************************************/
17class Public_Key
18 {
19 public:
20 virtual std::string algo_name() const = 0;
21 virtual OID get_oid() const;
22
23 virtual bool check_key(bool) const { return true; }
24 virtual u32bit message_parts() const { return 1; }
25 virtual u32bit message_part_size() const { return 0; }
26 virtual u32bit max_input_bits() const = 0;
27
28 virtual class X509_Encoder* x509_encoder() const { return 0; }
29 virtual class X509_Decoder* x509_decoder() { return 0; }
30
31 virtual ~Public_Key() {}
32 protected:
33 virtual void load_check() const;
34 };
35
36/*************************************************
37* Private Key Base Class *
38*************************************************/
39class Private_Key : public virtual Public_Key
40 {
41 public:
42 virtual class PKCS8_Encoder* pkcs8_encoder() const { return 0; }
43 virtual class PKCS8_Decoder* pkcs8_decoder() { return 0; }
44 protected:
45 void load_check() const;
46 void gen_check() const;
47 };
48
49/*************************************************
50* PK Encrypting Key *
51*************************************************/
52class PK_Encrypting_Key : public virtual Public_Key
53 {
54 public:
55 virtual SecureVector<byte> encrypt(const byte[], u32bit) const = 0;
56 virtual ~PK_Encrypting_Key() {}
57 };
58
59/*************************************************
60* PK Decrypting Key *
61*************************************************/
62class PK_Decrypting_Key : public virtual Private_Key
63 {
64 public:
65 virtual SecureVector<byte> decrypt(const byte[], u32bit) const = 0;
66 virtual ~PK_Decrypting_Key() {}
67 };
68
69/*************************************************
70* PK Signing Key *
71*************************************************/
72class PK_Signing_Key : public virtual Private_Key
73 {
74 public:
75 virtual SecureVector<byte> sign(const byte[], u32bit) const = 0;
76 virtual ~PK_Signing_Key() {}
77 };
78
79/*************************************************
80* PK Verifying Key, Message Recovery Version *
81*************************************************/
82class PK_Verifying_with_MR_Key : public virtual Public_Key
83 {
84 public:
85 virtual SecureVector<byte> verify(const byte[], u32bit) const = 0;
86 virtual ~PK_Verifying_with_MR_Key() {}
87 };
88
89/*************************************************
90* PK Verifying Key, No Message Recovery Version *
91*************************************************/
92class PK_Verifying_wo_MR_Key : public virtual Public_Key
93 {
94 public:
95 virtual bool verify(const byte[], u32bit,
96 const byte[], u32bit) const = 0;
97 virtual ~PK_Verifying_wo_MR_Key() {}
98 };
99
100/*************************************************
101* PK Secret Value Derivation Key *
102*************************************************/
103class PK_Key_Agreement_Key : public virtual Private_Key
104 {
105 public:
106 virtual SecureVector<byte> derive_key(const byte[], u32bit) const = 0;
107 virtual MemoryVector<byte> public_value() const = 0;
108 virtual ~PK_Key_Agreement_Key() {}
109 };
110
111/*************************************************
112* Typedefs *
113*************************************************/
114typedef PK_Key_Agreement_Key PK_KA_Key;
115typedef Public_Key X509_PublicKey;
116typedef Private_Key PKCS8_PrivateKey;
117
118}
119
120#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status