/src/botan/build/include/public/botan/pem.h
Line | Count | Source |
1 | | /* |
2 | | * PEM Encoding/Decoding |
3 | | * (C) 1999-2007 Jack Lloyd |
4 | | * |
5 | | * Botan is released under the Simplified BSD License (see license.txt) |
6 | | */ |
7 | | |
8 | | #ifndef BOTAN_PEM_H_ |
9 | | #define BOTAN_PEM_H_ |
10 | | |
11 | | #include <botan/secmem.h> |
12 | | #include <string> |
13 | | #include <string_view> |
14 | | |
15 | | BOTAN_FUTURE_INTERNAL_HEADER(pem.h) |
16 | | |
17 | | namespace Botan { |
18 | | |
19 | | class DataSource; |
20 | | |
21 | | namespace PEM_Code { |
22 | | |
23 | | /** |
24 | | * Encode some binary data in PEM format |
25 | | * @param data binary data to encode |
26 | | * @param data_len length of binary data in bytes |
27 | | * @param label PEM label put after BEGIN and END |
28 | | * @param line_width after this many characters, a new line is inserted |
29 | | */ |
30 | | BOTAN_PUBLIC_API(2, 0) |
31 | | std::string encode(const uint8_t data[], size_t data_len, std::string_view label, size_t line_width = 64); |
32 | | |
33 | | /** |
34 | | * Encode some binary data in PEM format |
35 | | * @param data binary data to encode |
36 | | * @param label PEM label |
37 | | * @param line_width after this many characters, a new line is inserted |
38 | | */ |
39 | | template <typename Alloc> |
40 | 0 | std::string encode(const std::vector<uint8_t, Alloc>& data, std::string_view label, size_t line_width = 64) { |
41 | 0 | return encode(data.data(), data.size(), label, line_width); |
42 | 0 | } Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Botan::PEM_Code::encode<std::__1::allocator<unsigned char> >(std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > const&, std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned long) Unexecuted instantiation: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > Botan::PEM_Code::encode<Botan::secure_allocator<unsigned char> >(std::__1::vector<unsigned char, Botan::secure_allocator<unsigned char> > const&, std::__1::basic_string_view<char, std::__1::char_traits<char> >, unsigned long) |
43 | | |
44 | | /** |
45 | | * Decode PEM data |
46 | | * @param pem a datasource containing PEM encoded data |
47 | | * @param label is set to the PEM label found for later inspection |
48 | | */ |
49 | | BOTAN_PUBLIC_API(2, 0) secure_vector<uint8_t> decode(DataSource& pem, std::string& label); |
50 | | |
51 | | /** |
52 | | * Decode PEM data |
53 | | * @param pem a string containing PEM encoded data |
54 | | * @param label is set to the PEM label found for later inspection |
55 | | */ |
56 | | BOTAN_PUBLIC_API(2, 0) secure_vector<uint8_t> decode(std::string_view pem, std::string& label); |
57 | | |
58 | | /** |
59 | | * Decode PEM data |
60 | | * @param pem a datasource containing PEM encoded data |
61 | | * @param label is what we expect the label to be |
62 | | */ |
63 | | BOTAN_PUBLIC_API(2, 0) |
64 | | secure_vector<uint8_t> decode_check_label(DataSource& pem, std::string_view label); |
65 | | |
66 | | /** |
67 | | * Decode PEM data |
68 | | * @param pem a string containing PEM encoded data |
69 | | * @param label is what we expect the label to be |
70 | | */ |
71 | | BOTAN_PUBLIC_API(2, 0) |
72 | | secure_vector<uint8_t> decode_check_label(std::string_view pem, std::string_view label); |
73 | | |
74 | | /** |
75 | | * Heuristic test for PEM data. |
76 | | */ |
77 | | BOTAN_PUBLIC_API(2, 0) bool matches(DataSource& source, std::string_view extra = "", size_t search_range = 4096); |
78 | | |
79 | | } // namespace PEM_Code |
80 | | |
81 | | } // namespace Botan |
82 | | |
83 | | #endif |