aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/pem
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pubkey/pem')
-rw-r--r--src/lib/pubkey/pem/pem.cpp20
-rw-r--r--src/lib/pubkey/pem/pem.h14
2 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/pubkey/pem/pem.cpp b/src/lib/pubkey/pem/pem.cpp
index 83b48c07b..bc94e3b53 100644
--- a/src/lib/pubkey/pem/pem.cpp
+++ b/src/lib/pubkey/pem/pem.cpp
@@ -40,7 +40,7 @@ std::string linewrap(size_t width, const std::string& in)
/*
* PEM encode BER/DER-encoded objects
*/
-std::string encode(const byte der[], size_t length, const std::string& label, size_t width)
+std::string encode(const uint8_t der[], size_t length, const std::string& label, size_t width)
{
const std::string PEM_HEADER = "-----BEGIN " + label + "-----\n";
const std::string PEM_TRAILER = "-----END " + label + "-----\n";
@@ -51,11 +51,11 @@ std::string encode(const byte der[], size_t length, const std::string& label, si
/*
* Decode PEM down to raw BER/DER
*/
-secure_vector<byte> decode_check_label(DataSource& source,
+secure_vector<uint8_t> decode_check_label(DataSource& source,
const std::string& label_want)
{
std::string label_got;
- secure_vector<byte> ber = decode(source, label_got);
+ secure_vector<uint8_t> ber = decode(source, label_got);
if(label_got != label_want)
throw Decoding_Error("PEM: Label mismatch, wanted " + label_want +
", got " + label_got);
@@ -65,7 +65,7 @@ secure_vector<byte> decode_check_label(DataSource& source,
/*
* Decode PEM down to raw BER/DER
*/
-secure_vector<byte> decode(DataSource& source, std::string& label)
+secure_vector<uint8_t> decode(DataSource& source, std::string& label)
{
const size_t RANDOM_CHAR_LIMIT = 8;
@@ -75,7 +75,7 @@ secure_vector<byte> decode(DataSource& source, std::string& label)
while(position != PEM_HEADER1.length())
{
- byte b;
+ uint8_t b;
if(!source.read_byte(b))
throw Decoding_Error("PEM: No PEM header found");
if(b == PEM_HEADER1[position])
@@ -88,7 +88,7 @@ secure_vector<byte> decode(DataSource& source, std::string& label)
position = 0;
while(position != PEM_HEADER2.length())
{
- byte b;
+ uint8_t b;
if(!source.read_byte(b))
throw Decoding_Error("PEM: No PEM header found");
if(b == PEM_HEADER2[position])
@@ -106,7 +106,7 @@ secure_vector<byte> decode(DataSource& source, std::string& label)
position = 0;
while(position != PEM_TRAILER.length())
{
- byte b;
+ uint8_t b;
if(!source.read_byte(b))
throw Decoding_Error("PEM: No PEM trailer found");
if(b == PEM_TRAILER[position])
@@ -121,14 +121,14 @@ secure_vector<byte> decode(DataSource& source, std::string& label)
return base64_decode(b64.data(), b64.size());
}
-secure_vector<byte> decode_check_label(const std::string& pem,
+secure_vector<uint8_t> decode_check_label(const std::string& pem,
const std::string& label_want)
{
DataSource_Memory src(pem);
return decode_check_label(src, label_want);
}
-secure_vector<byte> decode(const std::string& pem, std::string& label)
+secure_vector<uint8_t> decode(const std::string& pem, std::string& label)
{
DataSource_Memory src(pem);
return decode(src, label);
@@ -142,7 +142,7 @@ bool matches(DataSource& source, const std::string& extra,
{
const std::string PEM_HEADER = "-----BEGIN " + extra;
- secure_vector<byte> search_buf(search_range);
+ secure_vector<uint8_t> search_buf(search_range);
size_t got = source.peek(search_buf.data(), search_buf.size(), 0);
if(got < PEM_HEADER.length())
diff --git a/src/lib/pubkey/pem/pem.h b/src/lib/pubkey/pem/pem.h
index acbd40a77..1f9483ea8 100644
--- a/src/lib/pubkey/pem/pem.h
+++ b/src/lib/pubkey/pem/pem.h
@@ -21,7 +21,7 @@ namespace PEM_Code {
* @param label PEM label put after BEGIN and END
* @param line_width after this many characters, a new line is inserted
*/
-BOTAN_DLL std::string encode(const byte data[],
+BOTAN_DLL std::string encode(const uint8_t data[],
size_t data_len,
const std::string& label,
size_t line_width = 64);
@@ -32,7 +32,7 @@ BOTAN_DLL std::string encode(const byte data[],
* @param label PEM label
* @param line_width after this many characters, a new line is inserted
*/
-inline std::string encode(const std::vector<byte>& data,
+inline std::string encode(const std::vector<uint8_t>& data,
const std::string& label,
size_t line_width = 64)
{
@@ -45,7 +45,7 @@ inline std::string encode(const std::vector<byte>& data,
* @param label PEM label put after BEGIN and END
* @param line_width after this many characters, a new line is inserted
*/
-inline std::string encode(const secure_vector<byte>& data,
+inline std::string encode(const secure_vector<uint8_t>& data,
const std::string& label,
size_t line_width = 64)
{
@@ -57,7 +57,7 @@ inline std::string encode(const secure_vector<byte>& data,
* @param pem a datasource containing PEM encoded data
* @param label is set to the PEM label found for later inspection
*/
-BOTAN_DLL secure_vector<byte> decode(DataSource& pem,
+BOTAN_DLL secure_vector<uint8_t> decode(DataSource& pem,
std::string& label);
/**
@@ -65,7 +65,7 @@ BOTAN_DLL secure_vector<byte> decode(DataSource& pem,
* @param pem a string containing PEM encoded data
* @param label is set to the PEM label found for later inspection
*/
-BOTAN_DLL secure_vector<byte> decode(const std::string& pem,
+BOTAN_DLL secure_vector<uint8_t> decode(const std::string& pem,
std::string& label);
/**
@@ -73,7 +73,7 @@ BOTAN_DLL secure_vector<byte> decode(const std::string& pem,
* @param pem a datasource containing PEM encoded data
* @param label is what we expect the label to be
*/
-BOTAN_DLL secure_vector<byte> decode_check_label(
+BOTAN_DLL secure_vector<uint8_t> decode_check_label(
DataSource& pem,
const std::string& label);
@@ -82,7 +82,7 @@ BOTAN_DLL secure_vector<byte> decode_check_label(
* @param pem a string containing PEM encoded data
* @param label is what we expect the label to be
*/
-BOTAN_DLL secure_vector<byte> decode_check_label(
+BOTAN_DLL secure_vector<uint8_t> decode_check_label(
const std::string& pem,
const std::string& label);