Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

x509_key.h
Go to the documentation of this file.
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/alg_id.h>
13 #include <botan/data_src.h>
14 #include <string>
15
16 namespace Botan {
17
18 /**
19 * The two types of X509 encoding supported by Botan.
20 */
21 enum X509_Encoding { RAW_BER, PEM };
22
23 /**
24 * This namespace contains functions for handling X.509 public keys
25 */
26 namespace X509 {
27
28 /**
29 * BER encode a key
30 * @param key the public key to encode
31 * @return BER encoding of this key
32 */
33 BOTAN_DLL std::vector<uint8_t> BER_encode(const Public_Key& key);
34
35 /**
36 * PEM encode a public key into a string.
37 * @param key the key to encode
38 * @return PEM encoded key
39 */
40 BOTAN_DLL std::string PEM_encode(const Public_Key& key);
41
42 /**
43 * Create a public key from a data source.
44 * @param source the source providing the DER or PEM encoded key
45 * @return new public key object
46 */
47 BOTAN_DLL Public_Key* load_key(DataSource& source);
48
49 #if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
50 /**
51 * Create a public key from a file
52 * @param filename pathname to the file to load
53 * @return new public key object
54 */
55 BOTAN_DLL Public_Key* load_key(const std::string& filename);
56 #endif
57
58 /**
59 * Create a public key from a memory region.
60 * @param enc the memory region containing the DER or PEM encoded key
61 * @return new public key object
62 */
63 BOTAN_DLL Public_Key* load_key(const std::vector<uint8_t>& enc);
64
65 /**
66 * Copy a key.
67 * @param key the public key to copy
68 * @return new public key object
69 */
70 BOTAN_DLL Public_Key* copy_key(const Public_Key& key);
71
72 }
73
74 }
75
76 #endif
Botan::X509::BER_encode
std::vector< uint8_t > BER_encode(const Public_Key &key)
Definition: x509_key.cpp:19
Botan::X509::load_key
Public_Key * load_key(DataSource &source)
Definition: x509_key.cpp:37
Botan::X509_Encoding
X509_Encoding
Definition: x509_key.h:21
Botan::X509::PEM_encode
std::string PEM_encode(const Public_Key &key)
Definition: x509_key.cpp:28
Botan
Definition: alg_id.cpp:13
Botan::PEM
Definition: x509_key.h:21
Botan::X509::copy_key
Public_Key * copy_key(const Public_Key &key)
Definition: x509_key.cpp:98
Botan::RAW_BER
Definition: x509_key.h:21