3
* (C) 1999-2010 Jack Lloyd
5
* Botan is released under the Simplified BSD License (see license.txt)
8
#ifndef BOTAN_X509_PUBLIC_KEY_H_
9
#define BOTAN_X509_PUBLIC_KEY_H_
11
#include <botan/pk_keys.h>
12
#include <botan/types.h>
18
class RandomNumberGenerator;
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.
25
enum X509_Encoding { RAW_BER, PEM };
28
* This namespace contains functions for handling X.509 public keys
34
* @param key the public key to encode
35
* @return BER encoding of this key
37
BOTAN_PUBLIC_API(2,0) std::vector<uint8_t> BER_encode(const Public_Key& key);
40
* PEM encode a public key into a string.
41
* @param key the key to encode
42
* @return PEM encoded key
44
BOTAN_PUBLIC_API(2,0) std::string PEM_encode(const Public_Key& key);
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
51
BOTAN_PUBLIC_API(2,0) Public_Key* load_key(DataSource& source);
53
#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
55
* Create a public key from a file
56
* @param filename pathname to the file to load
57
* @return new public key object
59
BOTAN_PUBLIC_API(2,0) Public_Key* load_key(const std::string& filename);
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
67
BOTAN_PUBLIC_API(2,0) Public_Key* load_key(const std::vector<uint8_t>& enc);
71
* @param key the public key to copy
72
* @return new public key object
74
BOTAN_PUBLIC_API(2,0) Public_Key* copy_key(const Public_Key& key);