monotone

monotone Mtn Source Tree

Root/botan/pk_keys.h

1/*************************************************
2* PK Key Types Header File *
3* (C) 1999-2005 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* Generic PK Key *
16*************************************************/
17class PK_Key
18 {
19 public:
20 virtual std::string algo_name() const = 0;
21
22 virtual OID get_oid() const;
23 virtual u32bit max_input_bits() const { return 0; }
24 virtual bool check_key(bool) const { return true; }
25 virtual u32bit message_parts() const { return 1; }
26 virtual u32bit message_part_size() const { return 0; }
27 virtual ~PK_Key() {}
28 protected:
29 void check_loaded_public() const;
30 void check_loaded_private() const;
31 void check_generated_private() const;
32 };
33
34/*************************************************
35* PK Encrypting Key *
36*************************************************/
37class PK_Encrypting_Key : public virtual PK_Key
38 {
39 public:
40 virtual SecureVector<byte> encrypt(const byte[], u32bit) const = 0;
41 virtual ~PK_Encrypting_Key() {}
42 };
43
44/*************************************************
45* PK Decrypting Key *
46*************************************************/
47class PK_Decrypting_Key : public virtual PK_Key
48 {
49 public:
50 virtual SecureVector<byte> decrypt(const byte[], u32bit) const = 0;
51 virtual ~PK_Decrypting_Key() {}
52 };
53
54/*************************************************
55* PK Signing Key *
56*************************************************/
57class PK_Signing_Key : public virtual PK_Key
58 {
59 public:
60 virtual SecureVector<byte> sign(const byte[], u32bit) const = 0;
61 virtual ~PK_Signing_Key() {}
62 };
63
64/*************************************************
65* PK Verifying Key, Message Recovery Version *
66*************************************************/
67class PK_Verifying_with_MR_Key : public virtual PK_Key
68 {
69 public:
70 virtual SecureVector<byte> verify(const byte[], u32bit) const = 0;
71 virtual ~PK_Verifying_with_MR_Key() {}
72 };
73
74/*************************************************
75* PK Verifying Key, No Message Recovery Version *
76*************************************************/
77class PK_Verifying_wo_MR_Key : public virtual PK_Key
78 {
79 public:
80 virtual bool verify(const byte[], u32bit,
81 const byte[], u32bit) const = 0;
82 virtual ~PK_Verifying_wo_MR_Key() {}
83 };
84
85/*************************************************
86* PK Secret Value Derivation Key *
87*************************************************/
88class PK_Key_Agreement_Key : public virtual PK_Key
89 {
90 public:
91 virtual SecureVector<byte> derive_key(const byte[], u32bit) const = 0;
92 virtual MemoryVector<byte> public_value() const = 0;
93 virtual ~PK_Key_Agreement_Key() {}
94 };
95
96typedef PK_Key_Agreement_Key PK_KA_Key;
97
98}
99
100#endif

Archive Download this file

Branches

Tags

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