aboutsummaryrefslogtreecommitdiffstats
path: root/include/x509_key.h
blob: a07268e53e1f05627b19c31a13bc3d3b144e0bb9 (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
/*************************************************
* X.509 Public Key Header File                   *
* (C) 1999-2007 Jack Lloyd                       *
*************************************************/

#ifndef BOTAN_X509_PUBLIC_KEY_H__
#define BOTAN_X509_PUBLIC_KEY_H__

#include <botan/pipe.h>
#include <botan/pk_keys.h>
#include <botan/alg_id.h>

namespace Botan {

/*************************************************
* X.509 Public Key Encoder                       *
*************************************************/
class X509_Encoder
   {
   public:
      virtual AlgorithmIdentifier alg_id() const = 0;
      virtual MemoryVector<byte> key_bits() const = 0;
      virtual ~X509_Encoder() {}
   };

/*************************************************
* X.509 Public Key Decoder                       *
*************************************************/
class X509_Decoder
   {
   public:
      virtual void alg_id(const AlgorithmIdentifier&) = 0;
      virtual void key_bits(const MemoryRegion<byte>&) = 0;
      virtual ~X509_Decoder() {}
   };

namespace X509 {

/*************************************************
* X.509 Public Key Encoding/Decoding             *
*************************************************/
void encode(const Public_Key&, Pipe&, X509_Encoding = PEM);
std::string PEM_encode(const Public_Key&);

Public_Key* load_key(DataSource&);
Public_Key* load_key(const std::string&);
Public_Key* load_key(const MemoryRegion<byte>&);

Public_Key* copy_key(const Public_Key&);

Key_Constraints find_constraints(const Public_Key&, Key_Constraints);

}

}

#endif