aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-01-24 12:52:08 +0000
committerlloyd <[email protected]>2012-01-24 12:52:08 +0000
commitefcf54fcd6858932ad4336c7eba5d30c32945bad (patch)
tree6094ea2176d723fdfa24fbdcb1e586e6ccc36832 /src
parent847b4b2e9756306517482568b36441103e146772 (diff)
New helpers taking a string
Diffstat (limited to 'src')
-rw-r--r--src/codec/pem/pem.cpp13
-rw-r--r--src/codec/pem/pem.h15
2 files changed, 28 insertions, 0 deletions
diff --git a/src/codec/pem/pem.cpp b/src/codec/pem/pem.cpp
index 005ec7310..52a22d8ef 100644
--- a/src/codec/pem/pem.cpp
+++ b/src/codec/pem/pem.cpp
@@ -110,6 +110,19 @@ SecureVector<byte> decode(DataSource& source, std::string& label)
return base64.read_all();
}
+SecureVector<byte> decode_check_label(const std::string& pem,
+ const std::string& label_want)
+ {
+ DataSource_Memory src(pem);
+ return decode_check_label(src, label_want);
+ }
+
+SecureVector<byte> decode(const std::string& pem, std::string& label)
+ {
+ DataSource_Memory src(pem);
+ return decode(src, label);
+ }
+
/*
* Search for a PEM signature
*/
diff --git a/src/codec/pem/pem.h b/src/codec/pem/pem.h
index 0bcb85f5a..10267f029 100644
--- a/src/codec/pem/pem.h
+++ b/src/codec/pem/pem.h
@@ -38,6 +38,13 @@ BOTAN_DLL SecureVector<byte> decode(DataSource& pem,
/**
* Decode PEM data
+* @param label is set to the PEM label found for later inspection
+*/
+BOTAN_DLL SecureVector<byte> decode(const std::string& pem,
+ std::string& label);
+
+/**
+* Decode PEM data
* @param label is what we expect the label to be
*/
BOTAN_DLL SecureVector<byte> decode_check_label(
@@ -45,6 +52,14 @@ BOTAN_DLL SecureVector<byte> decode_check_label(
const std::string& label);
/**
+* Decode PEM data
+* @param label is what we expect the label to be
+*/
+BOTAN_DLL SecureVector<byte> decode_check_label(
+ const std::string& pem,
+ const std::string& label);
+
+/**
* Heuristic test for PEM data.
*/
BOTAN_DLL bool matches(DataSource& source,