~ubuntu-branches/debian/sid/botan/sid

« back to all changes in this revision

Viewing changes to src/lib/pubkey/x509_key.h

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2018-03-01 22:23:25 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20180301222325-7p7vc45gu3hta34d
Tags: 2.4.0-2
* Don't remove .doctrees from the manual if it doesn't exist.
* Don't specify parallel to debhelper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* X.509 Public Key
 
3
* (C) 1999-2010 Jack Lloyd
 
4
*
 
5
* Botan is released under the Simplified BSD License (see license.txt)
 
6
*/
 
7
 
 
8
#ifndef BOTAN_X509_PUBLIC_KEY_H_
 
9
#define BOTAN_X509_PUBLIC_KEY_H_
 
10
 
 
11
#include <botan/pk_keys.h>
 
12
#include <botan/types.h>
 
13
#include <string>
 
14
#include <vector>
 
15
 
 
16
namespace Botan {
 
17
 
 
18
class RandomNumberGenerator;
 
19
class DataSource;
 
20
 
 
21
/**
 
22
* The two types of X509 encoding supported by Botan.
 
23
* This enum is not used anymore, and will be removed in a future major release.
 
24
*/
 
25
enum X509_Encoding { RAW_BER, PEM };
 
26
 
 
27
/**
 
28
* This namespace contains functions for handling X.509 public keys
 
29
*/
 
30
namespace X509 {
 
31
 
 
32
/**
 
33
* BER encode a key
 
34
* @param key the public key to encode
 
35
* @return BER encoding of this key
 
36
*/
 
37
BOTAN_PUBLIC_API(2,0) std::vector<uint8_t> BER_encode(const Public_Key& key);
 
38
 
 
39
/**
 
40
* PEM encode a public key into a string.
 
41
* @param key the key to encode
 
42
* @return PEM encoded key
 
43
*/
 
44
BOTAN_PUBLIC_API(2,0) std::string PEM_encode(const Public_Key& key);
 
45
 
 
46
/**
 
47
* Create a public key from a data source.
 
48
* @param source the source providing the DER or PEM encoded key
 
49
* @return new public key object
 
50
*/
 
51
BOTAN_PUBLIC_API(2,0) Public_Key* load_key(DataSource& source);
 
52
 
 
53
#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
 
54
/**
 
55
* Create a public key from a file
 
56
* @param filename pathname to the file to load
 
57
* @return new public key object
 
58
*/
 
59
BOTAN_PUBLIC_API(2,0) Public_Key* load_key(const std::string& filename);
 
60
#endif
 
61
 
 
62
/**
 
63
* Create a public key from a memory region.
 
64
* @param enc the memory region containing the DER or PEM encoded key
 
65
* @return new public key object
 
66
*/
 
67
BOTAN_PUBLIC_API(2,0) Public_Key* load_key(const std::vector<uint8_t>& enc);
 
68
 
 
69
/**
 
70
* Copy a key.
 
71
* @param key the public key to copy
 
72
* @return new public key object
 
73
*/
 
74
BOTAN_PUBLIC_API(2,0) Public_Key* copy_key(const Public_Key& key);
 
75
 
 
76
}
 
77
 
 
78
}
 
79
 
 
80
#endif