aboutsummaryrefslogtreecommitdiffstats
path: root/src/codec/pem/pem.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-05-25 22:52:00 +0000
committerlloyd <[email protected]>2012-05-25 22:52:00 +0000
commit12090a7148d9ee73572cc1a7268fc489504a8173 (patch)
tree51e50ce0852c56231e9e6dc13f168b10edd45d01 /src/codec/pem/pem.h
parent9594979caf775dc4062850044715b804d1fda60c (diff)
parent65cc04445f8d40497f02a14bd8cb97081790e54b (diff)
propagate from branch 'net.randombit.botan.x509-path-validation' (head 63b5a20eab129ca13287fda33d2d02eec329708f)
to branch 'net.randombit.botan' (head 8b8150f09c55184f028f2929c4e7f7cd0d46d96e)
Diffstat (limited to 'src/codec/pem/pem.h')
-rw-r--r--src/codec/pem/pem.h71
1 files changed, 61 insertions, 10 deletions
diff --git a/src/codec/pem/pem.h b/src/codec/pem/pem.h
index d15bfe978..6c33c642d 100644
--- a/src/codec/pem/pem.h
+++ b/src/codec/pem/pem.h
@@ -14,18 +14,69 @@ namespace Botan {
namespace PEM_Code {
-/*
-* PEM Encoding/Decoding
+/**
+* Encode some binary data in PEM format
+*/
+BOTAN_DLL std::string encode(const byte data[],
+ size_t data_len,
+ const std::string& label,
+ size_t line_width = 64);
+
+/**
+* Encode some binary data in PEM format
+*/
+inline std::string encode(const std::vector<byte>& data,
+ const std::string& label,
+ size_t line_width = 64)
+ {
+ return encode(&data[0], data.size(), label, line_width);
+ }
+
+/**
+* Encode some binary data in PEM format
+*/
+inline std::string encode(const secure_vector<byte>& data,
+ const std::string& label,
+ size_t line_width = 64)
+ {
+ return encode(&data[0], data.size(), label, line_width);
+ }
+
+/**
+* Decode PEM data
+* @param label is set to the PEM label found for later inspection
*/
-BOTAN_DLL std::string encode(const byte[], size_t,
- const std::string&, size_t = 64);
-BOTAN_DLL std::string encode(const MemoryRegion<byte>&,
- const std::string&, size_t = 64);
+BOTAN_DLL secure_vector<byte> decode(DataSource& pem,
+ std::string& label);
-BOTAN_DLL SecureVector<byte> decode(DataSource&, std::string&);
-BOTAN_DLL SecureVector<byte> decode_check_label(DataSource&,
- const std::string&);
-BOTAN_DLL bool matches(DataSource&, const std::string& = "",
+/**
+* Decode PEM data
+* @param label is set to the PEM label found for later inspection
+*/
+BOTAN_DLL secure_vector<byte> decode(const std::string& pem,
+ std::string& label);
+
+/**
+* Decode PEM data
+* @param label is what we expect the label to be
+*/
+BOTAN_DLL secure_vector<byte> decode_check_label(
+ DataSource& pem,
+ const std::string& label);
+
+/**
+* Decode PEM data
+* @param label is what we expect the label to be
+*/
+BOTAN_DLL secure_vector<byte> decode_check_label(
+ const std::string& pem,
+ const std::string& label);
+
+/**
+* Heuristic test for PEM data.
+*/
+BOTAN_DLL bool matches(DataSource& source,
+ const std::string& extra = "",
size_t search_range = 4096);
}