Botan 2.19.5 Crypto and TLS for C&

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/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
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
Botan::X509::copy_key
Public_Key * copy_key(const Public_Key &key)
Definition: x509_key.cpp:98
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::PEM_encode
std::string PEM_encode(const Public_Key &key)
Definition: x509_key.cpp:28
Botan
Definition: alg_id.cpp:13
Botan::X509_Encoding
X509_Encoding
Definition: x509_key.h:25
Botan::PEM
@ PEM
Definition: x509_key.h:25
Botan::RAW_BER
@ RAW_BER
Definition: x509_key.h:25
std
Definition: bigint.h:1155