aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/asn1')
-rw-r--r--src/lib/asn1/alg_id.h3
-rw-r--r--src/lib/asn1/asn1_alt_name.cpp26
-rw-r--r--src/lib/asn1/asn1_alt_name.h4
-rw-r--r--src/lib/asn1/asn1_attribute.h3
-rw-r--r--src/lib/asn1/asn1_obj.h3
-rw-r--r--src/lib/asn1/asn1_oid.cpp42
-rw-r--r--src/lib/asn1/asn1_oid.h6
-rw-r--r--src/lib/asn1/asn1_str.cpp38
-rw-r--r--src/lib/asn1/asn1_str.h4
-rw-r--r--src/lib/asn1/ber_dec.cpp88
-rw-r--r--src/lib/asn1/ber_dec.h8
-rw-r--r--src/lib/asn1/der_enc.cpp48
-rw-r--r--src/lib/asn1/der_enc.h10
-rw-r--r--src/lib/asn1/x509_dn.cpp20
-rw-r--r--src/lib/asn1/x509_dn.h4
15 files changed, 158 insertions, 149 deletions
diff --git a/src/lib/asn1/alg_id.h b/src/lib/asn1/alg_id.h
index 9e36fd120..1516e41ef 100644
--- a/src/lib/asn1/alg_id.h
+++ b/src/lib/asn1/alg_id.h
@@ -32,7 +32,10 @@ class BOTAN_DLL AlgorithmIdentifier : public ASN1_Object
AlgorithmIdentifier(const OID&, const std::vector<byte>&);
AlgorithmIdentifier(const std::string&, const std::vector<byte>&);
+ // public member variable:
OID oid;
+
+ // public member variable:
std::vector<byte> parameters;
};
diff --git a/src/lib/asn1/asn1_alt_name.cpp b/src/lib/asn1/asn1_alt_name.cpp
index 131152521..bd23bdff1 100644
--- a/src/lib/asn1/asn1_alt_name.cpp
+++ b/src/lib/asn1/asn1_alt_name.cpp
@@ -58,12 +58,12 @@ void AlternativeName::add_attribute(const std::string& type,
if(type.empty() || str.empty())
return;
- auto range = alt_info.equal_range(type);
+ auto range = m_alt_info.equal_range(type);
for(auto j = range.first; j != range.second; ++j)
if(j->second == str)
return;
- multimap_insert(alt_info, type, str);
+ multimap_insert(m_alt_info, type, str);
}
/*
@@ -74,7 +74,7 @@ void AlternativeName::add_othername(const OID& oid, const std::string& value,
{
if(value.empty())
return;
- multimap_insert(othernames, oid, ASN1_String(value, type));
+ multimap_insert(m_othernames, oid, ASN1_String(value, type));
}
/*
@@ -82,7 +82,7 @@ void AlternativeName::add_othername(const OID& oid, const std::string& value,
*/
std::multimap<std::string, std::string> AlternativeName::get_attributes() const
{
- return alt_info;
+ return m_alt_info;
}
/*
@@ -90,7 +90,7 @@ std::multimap<std::string, std::string> AlternativeName::get_attributes() const
*/
std::multimap<OID, ASN1_String> AlternativeName::get_othernames() const
{
- return othernames;
+ return m_othernames;
}
/*
@@ -100,10 +100,10 @@ std::multimap<std::string, std::string> AlternativeName::contents() const
{
std::multimap<std::string, std::string> names;
- for(auto i = alt_info.begin(); i != alt_info.end(); ++i)
+ for(auto i = m_alt_info.begin(); i != m_alt_info.end(); ++i)
multimap_insert(names, i->first, i->second);
- for(auto i = othernames.begin(); i != othernames.end(); ++i)
+ for(auto i = m_othernames.begin(); i != m_othernames.end(); ++i)
multimap_insert(names, OIDS::lookup(i->first), i->second.value());
return names;
@@ -114,7 +114,7 @@ std::multimap<std::string, std::string> AlternativeName::contents() const
*/
bool AlternativeName::has_items() const
{
- return (alt_info.size() > 0 || othernames.size() > 0);
+ return (m_alt_info.size() > 0 || m_othernames.size() > 0);
}
namespace {
@@ -154,12 +154,12 @@ void AlternativeName::encode_into(DER_Encoder& der) const
{
der.start_cons(SEQUENCE);
- encode_entries(der, alt_info, "RFC822", ASN1_Tag(1));
- encode_entries(der, alt_info, "DNS", ASN1_Tag(2));
- encode_entries(der, alt_info, "URI", ASN1_Tag(6));
- encode_entries(der, alt_info, "IP", ASN1_Tag(7));
+ encode_entries(der, m_alt_info, "RFC822", ASN1_Tag(1));
+ encode_entries(der, m_alt_info, "DNS", ASN1_Tag(2));
+ encode_entries(der, m_alt_info, "URI", ASN1_Tag(6));
+ encode_entries(der, m_alt_info, "IP", ASN1_Tag(7));
- for(auto i = othernames.begin(); i != othernames.end(); ++i)
+ for(auto i = m_othernames.begin(); i != m_othernames.end(); ++i)
{
der.start_explicit(0)
.encode(i->first)
diff --git a/src/lib/asn1/asn1_alt_name.h b/src/lib/asn1/asn1_alt_name.h
index 91ba2bcf1..3b4120fc3 100644
--- a/src/lib/asn1/asn1_alt_name.h
+++ b/src/lib/asn1/asn1_alt_name.h
@@ -38,8 +38,8 @@ class BOTAN_DLL AlternativeName : public ASN1_Object
AlternativeName(const std::string& = "", const std::string& = "",
const std::string& = "", const std::string& = "");
private:
- std::multimap<std::string, std::string> alt_info;
- std::multimap<OID, ASN1_String> othernames;
+ std::multimap<std::string, std::string> m_alt_info;
+ std::multimap<OID, ASN1_String> m_othernames;
};
}
diff --git a/src/lib/asn1/asn1_attribute.h b/src/lib/asn1/asn1_attribute.h
index 371b0f99a..3abdaaeb9 100644
--- a/src/lib/asn1/asn1_attribute.h
+++ b/src/lib/asn1/asn1_attribute.h
@@ -23,7 +23,10 @@ class BOTAN_DLL Attribute : public ASN1_Object
void encode_into(class DER_Encoder& to) const override;
void decode_from(class BER_Decoder& from) override;
+ // public member variable:
OID oid;
+
+ // public member variable:
std::vector<byte> parameters;
Attribute() {}
diff --git a/src/lib/asn1/asn1_obj.h b/src/lib/asn1/asn1_obj.h
index f68ef675e..2bd2b1ed5 100644
--- a/src/lib/asn1/asn1_obj.h
+++ b/src/lib/asn1/asn1_obj.h
@@ -84,7 +84,10 @@ class BOTAN_DLL BER_Object
public:
void assert_is_a(ASN1_Tag, ASN1_Tag);
+ // public member variable:
ASN1_Tag type_tag, class_tag;
+
+ // public member variable:
secure_vector<byte> value;
};
diff --git a/src/lib/asn1/asn1_oid.cpp b/src/lib/asn1/asn1_oid.cpp
index 3232d24e6..67af91afc 100644
--- a/src/lib/asn1/asn1_oid.cpp
+++ b/src/lib/asn1/asn1_oid.cpp
@@ -22,16 +22,16 @@ OID::OID(const std::string& oid_str)
{
try
{
- id = parse_asn1_oid(oid_str);
+ m_id = parse_asn1_oid(oid_str);
}
catch(...)
{
throw Invalid_OID(oid_str);
}
- if(id.size() < 2 || id[0] > 2)
+ if(m_id.size() < 2 || m_id[0] > 2)
throw Invalid_OID(oid_str);
- if((id[0] == 0 || id[0] == 1) && id[1] > 39)
+ if((m_id[0] == 0 || m_id[0] == 1) && m_id[1] > 39)
throw Invalid_OID(oid_str);
}
}
@@ -41,7 +41,7 @@ OID::OID(const std::string& oid_str)
*/
void OID::clear()
{
- id.clear();
+ m_id.clear();
}
/*
@@ -50,10 +50,10 @@ void OID::clear()
std::string OID::as_string() const
{
std::string oid_str;
- for(size_t i = 0; i != id.size(); ++i)
+ for(size_t i = 0; i != m_id.size(); ++i)
{
- oid_str += std::to_string(id[i]);
- if(i != id.size() - 1)
+ oid_str += std::to_string(m_id[i]);
+ if(i != m_id.size() - 1)
oid_str += ".";
}
return oid_str;
@@ -64,10 +64,10 @@ std::string OID::as_string() const
*/
bool OID::operator==(const OID& oid) const
{
- if(id.size() != oid.id.size())
+ if(m_id.size() != oid.m_id.size())
return false;
- for(size_t i = 0; i != id.size(); ++i)
- if(id[i] != oid.id[i])
+ for(size_t i = 0; i != m_id.size(); ++i)
+ if(m_id[i] != oid.m_id[i])
return false;
return true;
}
@@ -77,7 +77,7 @@ bool OID::operator==(const OID& oid) const
*/
OID& OID::operator+=(u32bit component)
{
- id.push_back(component);
+ m_id.push_back(component);
return (*this);
}
@@ -126,24 +126,24 @@ bool operator<(const OID& a, const OID& b)
*/
void OID::encode_into(DER_Encoder& der) const
{
- if(id.size() < 2)
+ if(m_id.size() < 2)
throw Invalid_Argument("OID::encode_into: OID is invalid");
std::vector<byte> encoding;
- encoding.push_back(40 * id[0] + id[1]);
+ encoding.push_back(40 * m_id[0] + m_id[1]);
- for(size_t i = 2; i != id.size(); ++i)
+ for(size_t i = 2; i != m_id.size(); ++i)
{
- if(id[i] == 0)
+ if(m_id[i] == 0)
encoding.push_back(0);
else
{
- size_t blocks = high_bit(id[i]) + 6;
+ size_t blocks = high_bit(m_id[i]) + 6;
blocks = (blocks - (blocks % 7)) / 7;
for(size_t j = 0; j != blocks - 1; ++j)
- encoding.push_back(0x80 | ((id[i] >> 7*(blocks-j-1)) & 0x7F));
- encoding.push_back(id[i] & 0x7F);
+ encoding.push_back(0x80 | ((m_id[i] >> 7*(blocks-j-1)) & 0x7F));
+ encoding.push_back(m_id[i] & 0x7F);
}
}
der.add_object(OBJECT_ID, UNIVERSAL, encoding);
@@ -163,8 +163,8 @@ void OID::decode_from(BER_Decoder& decoder)
clear();
- id.push_back(obj.value[0] / 40);
- id.push_back(obj.value[0] % 40);
+ m_id.push_back(obj.value[0] / 40);
+ m_id.push_back(obj.value[0] % 40);
size_t i = 0;
while(i != obj.value.size() - 1)
@@ -182,7 +182,7 @@ void OID::decode_from(BER_Decoder& decoder)
if(!(obj.value[i] & 0x80))
break;
}
- id.push_back(component);
+ m_id.push_back(component);
}
}
diff --git a/src/lib/asn1/asn1_oid.h b/src/lib/asn1/asn1_oid.h
index 7cdb9f58f..5c3053ee0 100644
--- a/src/lib/asn1/asn1_oid.h
+++ b/src/lib/asn1/asn1_oid.h
@@ -27,13 +27,13 @@ class BOTAN_DLL OID : public ASN1_Object
* Find out whether this OID is empty
* @return true is no OID value is set
*/
- bool empty() const { return id.size() == 0; }
+ bool empty() const { return m_id.size() == 0; }
/**
* Get this OID as list (vector) of its components.
* @return vector representing this OID
*/
- const std::vector<u32bit>& get_id() const { return id; }
+ const std::vector<u32bit>& get_id() const { return m_id; }
/**
* Get this OID as a string
@@ -65,7 +65,7 @@ class BOTAN_DLL OID : public ASN1_Object
*/
OID(const std::string& str = "");
private:
- std::vector<u32bit> id;
+ std::vector<u32bit> m_id;
};
/**
diff --git a/src/lib/asn1/asn1_str.cpp b/src/lib/asn1/asn1_str.cpp
index 05be90e3d..809448888 100644
--- a/src/lib/asn1/asn1_str.cpp
+++ b/src/lib/asn1/asn1_str.cpp
@@ -62,22 +62,22 @@ ASN1_Tag choose_encoding(const std::string& str,
/*
* Create an ASN1_String
*/
-ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : tag(t)
+ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_tag(t)
{
- iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET);
-
- if(tag == DIRECTORY_STRING)
- tag = choose_encoding(iso_8859_str, "latin1");
-
- if(tag != NUMERIC_STRING &&
- tag != PRINTABLE_STRING &&
- tag != VISIBLE_STRING &&
- tag != T61_STRING &&
- tag != IA5_STRING &&
- tag != UTF8_STRING &&
- tag != BMP_STRING)
+ m_iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET);
+
+ if(m_tag == DIRECTORY_STRING)
+ m_tag = choose_encoding(m_iso_8859_str, "latin1");
+
+ if(m_tag != NUMERIC_STRING &&
+ m_tag != PRINTABLE_STRING &&
+ m_tag != VISIBLE_STRING &&
+ m_tag != T61_STRING &&
+ m_tag != IA5_STRING &&
+ m_tag != UTF8_STRING &&
+ m_tag != BMP_STRING)
throw Invalid_Argument("ASN1_String: Unknown string type " +
- std::to_string(tag));
+ std::to_string(m_tag));
}
/*
@@ -85,8 +85,8 @@ ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : tag(t)
*/
ASN1_String::ASN1_String(const std::string& str)
{
- iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET);
- tag = choose_encoding(iso_8859_str, "latin1");
+ m_iso_8859_str = Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET);
+ m_tag = choose_encoding(m_iso_8859_str, "latin1");
}
/*
@@ -94,7 +94,7 @@ ASN1_String::ASN1_String(const std::string& str)
*/
std::string ASN1_String::iso_8859() const
{
- return iso_8859_str;
+ return m_iso_8859_str;
}
/*
@@ -102,7 +102,7 @@ std::string ASN1_String::iso_8859() const
*/
std::string ASN1_String::value() const
{
- return Charset::transcode(iso_8859_str, LATIN1_CHARSET, LOCAL_CHARSET);
+ return Charset::transcode(m_iso_8859_str, LATIN1_CHARSET, LOCAL_CHARSET);
}
/*
@@ -110,7 +110,7 @@ std::string ASN1_String::value() const
*/
ASN1_Tag ASN1_String::tagging() const
{
- return tag;
+ return m_tag;
}
/*
diff --git a/src/lib/asn1/asn1_str.h b/src/lib/asn1/asn1_str.h
index 84458e517..69370036c 100644
--- a/src/lib/asn1/asn1_str.h
+++ b/src/lib/asn1/asn1_str.h
@@ -29,8 +29,8 @@ class BOTAN_DLL ASN1_String : public ASN1_Object
ASN1_String(const std::string& = "");
ASN1_String(const std::string&, ASN1_Tag);
private:
- std::string iso_8859_str;
- ASN1_Tag tag;
+ std::string m_iso_8859_str;
+ ASN1_Tag m_tag;
};
}
diff --git a/src/lib/asn1/ber_dec.cpp b/src/lib/asn1/ber_dec.cpp
index 80dfba3bb..1d981cb8b 100644
--- a/src/lib/asn1/ber_dec.cpp
+++ b/src/lib/asn1/ber_dec.cpp
@@ -154,7 +154,7 @@ void BER_Object::assert_is_a(ASN1_Tag type_tag, ASN1_Tag class_tag)
*/
bool BER_Decoder::more_items() const
{
- if(source->end_of_data() && (pushed.type_tag == NO_OBJECT))
+ if(m_source->end_of_data() && (m_pushed.type_tag == NO_OBJECT))
return false;
return true;
}
@@ -164,7 +164,7 @@ bool BER_Decoder::more_items() const
*/
BER_Decoder& BER_Decoder::verify_end()
{
- if(!source->end_of_data() || (pushed.type_tag != NO_OBJECT))
+ if(!m_source->end_of_data() || (m_pushed.type_tag != NO_OBJECT))
throw Invalid_State("BER_Decoder::verify_end called, but data remains");
return (*this);
}
@@ -176,7 +176,7 @@ BER_Decoder& BER_Decoder::raw_bytes(secure_vector<byte>& out)
{
out.clear();
byte buf;
- while(source->read_byte(buf))
+ while(m_source->read_byte(buf))
out.push_back(buf);
return (*this);
}
@@ -185,7 +185,7 @@ BER_Decoder& BER_Decoder::raw_bytes(std::vector<byte>& out)
{
out.clear();
byte buf;
- while(source->read_byte(buf))
+ while(m_source->read_byte(buf))
out.push_back(buf);
return (*this);
}
@@ -196,7 +196,7 @@ BER_Decoder& BER_Decoder::raw_bytes(std::vector<byte>& out)
BER_Decoder& BER_Decoder::discard_remaining()
{
byte buf;
- while(source->read_byte(buf))
+ while(m_source->read_byte(buf))
;
return (*this);
}
@@ -208,23 +208,23 @@ BER_Object BER_Decoder::get_next_object()
{
BER_Object next;
- if(pushed.type_tag != NO_OBJECT)
+ if(m_pushed.type_tag != NO_OBJECT)
{
- next = pushed;
- pushed.class_tag = pushed.type_tag = NO_OBJECT;
+ next = m_pushed;
+ m_pushed.class_tag = m_pushed.type_tag = NO_OBJECT;
return next;
}
- decode_tag(source, next.type_tag, next.class_tag);
+ decode_tag(m_source, next.type_tag, next.class_tag);
if(next.type_tag == NO_OBJECT)
return next;
- const size_t length = decode_length(source);
- if(!source->check_available(length))
+ const size_t length = decode_length(m_source);
+ if(!m_source->check_available(length))
throw BER_Decoding_Error("Value truncated");
next.value.resize(length);
- if(source->read(next.value.data(), length) != length)
+ if(m_source->read(next.value.data(), length) != length)
throw BER_Decoding_Error("Value truncated");
if(next.type_tag == EOC && next.class_tag == UNIVERSAL)
@@ -244,9 +244,9 @@ BER_Decoder& BER_Decoder::get_next(BER_Object& ber)
*/
void BER_Decoder::push_back(const BER_Object& obj)
{
- if(pushed.type_tag != NO_OBJECT)
+ if(m_pushed.type_tag != NO_OBJECT)
throw Invalid_State("BER_Decoder: Only one push back is allowed");
- pushed = obj;
+ m_pushed = obj;
}
/*
@@ -259,7 +259,7 @@ BER_Decoder BER_Decoder::start_cons(ASN1_Tag type_tag,
obj.assert_is_a(type_tag, ASN1_Tag(class_tag | CONSTRUCTED));
BER_Decoder result(obj.value.data(), obj.value.size());
- result.parent = this;
+ result.m_parent = this;
return result;
}
@@ -268,11 +268,11 @@ BER_Decoder BER_Decoder::start_cons(ASN1_Tag type_tag,
*/
BER_Decoder& BER_Decoder::end_cons()
{
- if(!parent)
+ if(!m_parent)
throw Invalid_State("BER_Decoder::end_cons called with NULL parent");
- if(!source->end_of_data())
+ if(!m_source->end_of_data())
throw Decoding_Error("BER_Decoder::end_cons called with data left");
- return (*parent);
+ return (*m_parent);
}
/*
@@ -280,10 +280,10 @@ BER_Decoder& BER_Decoder::end_cons()
*/
BER_Decoder::BER_Decoder(DataSource& src)
{
- source = &src;
- owns = false;
- pushed.type_tag = pushed.class_tag = NO_OBJECT;
- parent = nullptr;
+ m_source = &src;
+ m_owns = false;
+ m_pushed.type_tag = m_pushed.class_tag = NO_OBJECT;
+ m_parent = nullptr;
}
/*
@@ -291,10 +291,10 @@ BER_Decoder::BER_Decoder(DataSource& src)
*/
BER_Decoder::BER_Decoder(const byte data[], size_t length)
{
- source = new DataSource_Memory(data, length);
- owns = true;
- pushed.type_tag = pushed.class_tag = NO_OBJECT;
- parent = nullptr;
+ m_source = new DataSource_Memory(data, length);
+ m_owns = true;
+ m_pushed.type_tag = m_pushed.class_tag = NO_OBJECT;
+ m_parent = nullptr;
}
/*
@@ -302,10 +302,10 @@ BER_Decoder::BER_Decoder(const byte data[], size_t length)
*/
BER_Decoder::BER_Decoder(const secure_vector<byte>& data)
{
- source = new DataSource_Memory(data);
- owns = true;
- pushed.type_tag = pushed.class_tag = NO_OBJECT;
- parent = nullptr;
+ m_source = new DataSource_Memory(data);
+ m_owns = true;
+ m_pushed.type_tag = m_pushed.class_tag = NO_OBJECT;
+ m_parent = nullptr;
}
/*
@@ -313,10 +313,10 @@ BER_Decoder::BER_Decoder(const secure_vector<byte>& data)
*/
BER_Decoder::BER_Decoder(const std::vector<byte>& data)
{
- source = new DataSource_Memory(data.data(), data.size());
- owns = true;
- pushed.type_tag = pushed.class_tag = NO_OBJECT;
- parent = nullptr;
+ m_source = new DataSource_Memory(data.data(), data.size());
+ m_owns = true;
+ m_pushed.type_tag = m_pushed.class_tag = NO_OBJECT;
+ m_parent = nullptr;
}
/*
@@ -324,15 +324,15 @@ BER_Decoder::BER_Decoder(const std::vector<byte>& data)
*/
BER_Decoder::BER_Decoder(const BER_Decoder& other)
{
- source = other.source;
- owns = false;
- if(other.owns)
+ m_source = other.m_source;
+ m_owns = false;
+ if(other.m_owns)
{
- other.owns = false;
- owns = true;
+ other.m_owns = false;
+ m_owns = true;
}
- pushed.type_tag = pushed.class_tag = NO_OBJECT;
- parent = other.parent;
+ m_pushed.type_tag = m_pushed.class_tag = NO_OBJECT;
+ m_parent = other.m_parent;
}
/*
@@ -340,9 +340,9 @@ BER_Decoder::BER_Decoder(const BER_Decoder& other)
*/
BER_Decoder::~BER_Decoder()
{
- if(owns)
- delete source;
- source = nullptr;
+ if(m_owns)
+ delete m_source;
+ m_source = nullptr;
}
/*
diff --git a/src/lib/asn1/ber_dec.h b/src/lib/asn1/ber_dec.h
index 98cfcb10f..b755251c5 100644
--- a/src/lib/asn1/ber_dec.h
+++ b/src/lib/asn1/ber_dec.h
@@ -168,10 +168,10 @@ class BOTAN_DLL BER_Decoder
BER_Decoder(const BER_Decoder&);
~BER_Decoder();
private:
- BER_Decoder* parent;
- DataSource* source;
- BER_Object pushed;
- mutable bool owns;
+ BER_Decoder* m_parent;
+ DataSource* m_source;
+ BER_Object m_pushed;
+ mutable bool m_owns;
};
/*
diff --git a/src/lib/asn1/der_enc.cpp b/src/lib/asn1/der_enc.cpp
index f1bcf634e..871171153 100644
--- a/src/lib/asn1/der_enc.cpp
+++ b/src/lib/asn1/der_enc.cpp
@@ -70,21 +70,21 @@ secure_vector<byte> encode_length(size_t length)
*/
secure_vector<byte> DER_Encoder::DER_Sequence::get_contents()
{
- const ASN1_Tag real_class_tag = ASN1_Tag(class_tag | CONSTRUCTED);
+ const ASN1_Tag real_class_tag = ASN1_Tag(m_class_tag | CONSTRUCTED);
- if(type_tag == SET)
+ if(m_type_tag == SET)
{
- std::sort(set_contents.begin(), set_contents.end());
- for(size_t i = 0; i != set_contents.size(); ++i)
- contents += set_contents[i];
- set_contents.clear();
+ std::sort(m_set_contents.begin(), m_set_contents.end());
+ for(size_t i = 0; i != m_set_contents.size(); ++i)
+ m_contents += m_set_contents[i];
+ m_set_contents.clear();
}
secure_vector<byte> result;
- result += encode_tag(type_tag, real_class_tag);
- result += encode_length(contents.size());
- result += contents;
- contents.clear();
+ result += encode_tag(m_type_tag, real_class_tag);
+ result += encode_length(m_contents.size());
+ result += m_contents;
+ m_contents.clear();
return result;
}
@@ -94,10 +94,10 @@ secure_vector<byte> DER_Encoder::DER_Sequence::get_contents()
*/
void DER_Encoder::DER_Sequence::add_bytes(const byte data[], size_t length)
{
- if(type_tag == SET)
- set_contents.push_back(secure_vector<byte>(data, data + length));
+ if(m_type_tag == SET)
+ m_set_contents.push_back(secure_vector<byte>(data, data + length));
else
- contents += std::make_pair(data, length);
+ m_contents += std::make_pair(data, length);
}
/*
@@ -105,14 +105,14 @@ void DER_Encoder::DER_Sequence::add_bytes(const byte data[], size_t length)
*/
ASN1_Tag DER_Encoder::DER_Sequence::tag_of() const
{
- return ASN1_Tag(type_tag | class_tag);
+ return ASN1_Tag(m_type_tag | m_class_tag);
}
/*
* DER_Sequence Constructor
*/
DER_Encoder::DER_Sequence::DER_Sequence(ASN1_Tag t1, ASN1_Tag t2) :
- type_tag(t1), class_tag(t2)
+ m_type_tag(t1), m_class_tag(t2)
{
}
@@ -121,11 +121,11 @@ DER_Encoder::DER_Sequence::DER_Sequence(ASN1_Tag t1, ASN1_Tag t2) :
*/
secure_vector<byte> DER_Encoder::get_contents()
{
- if(subsequences.size() != 0)
+ if(m_subsequences.size() != 0)
throw Invalid_State("DER_Encoder: Sequence hasn't been marked done");
secure_vector<byte> output;
- std::swap(output, contents);
+ std::swap(output, m_contents);
return output;
}
@@ -135,7 +135,7 @@ secure_vector<byte> DER_Encoder::get_contents()
DER_Encoder& DER_Encoder::start_cons(ASN1_Tag type_tag,
ASN1_Tag class_tag)
{
- subsequences.push_back(DER_Sequence(type_tag, class_tag));
+ m_subsequences.push_back(DER_Sequence(type_tag, class_tag));
return (*this);
}
@@ -144,11 +144,11 @@ DER_Encoder& DER_Encoder::start_cons(ASN1_Tag type_tag,
*/
DER_Encoder& DER_Encoder::end_cons()
{
- if(subsequences.empty())
+ if(m_subsequences.empty())
throw Invalid_State("DER_Encoder::end_cons: No such sequence");
- secure_vector<byte> seq = subsequences[subsequences.size()-1].get_contents();
- subsequences.pop_back();
+ secure_vector<byte> seq = m_subsequences[m_subsequences.size()-1].get_contents();
+ m_subsequences.pop_back();
raw_bytes(seq);
return (*this);
}
@@ -192,10 +192,10 @@ DER_Encoder& DER_Encoder::raw_bytes(const std::vector<byte>& val)
*/
DER_Encoder& DER_Encoder::raw_bytes(const byte bytes[], size_t length)
{
- if(subsequences.size())
- subsequences[subsequences.size()-1].add_bytes(bytes, length);
+ if(m_subsequences.size())
+ m_subsequences[m_subsequences.size()-1].add_bytes(bytes, length);
else
- contents += std::make_pair(bytes, length);
+ m_contents += std::make_pair(bytes, length);
return (*this);
}
diff --git a/src/lib/asn1/der_enc.h b/src/lib/asn1/der_enc.h
index dbb97d1aa..78cb4c38d 100644
--- a/src/lib/asn1/der_enc.h
+++ b/src/lib/asn1/der_enc.h
@@ -123,13 +123,13 @@ class BOTAN_DLL DER_Encoder
void add_bytes(const byte[], size_t);
DER_Sequence(ASN1_Tag, ASN1_Tag);
private:
- ASN1_Tag type_tag, class_tag;
- secure_vector<byte> contents;
- std::vector< secure_vector<byte> > set_contents;
+ ASN1_Tag m_type_tag, m_class_tag;
+ secure_vector<byte> m_contents;
+ std::vector< secure_vector<byte> > m_set_contents;
};
- secure_vector<byte> contents;
- std::vector<DER_Sequence> subsequences;
+ secure_vector<byte> m_contents;
+ std::vector<DER_Sequence> m_subsequences;
};
}
diff --git a/src/lib/asn1/x509_dn.cpp b/src/lib/asn1/x509_dn.cpp
index 80bbe81a3..9c36cd695 100644
--- a/src/lib/asn1/x509_dn.cpp
+++ b/src/lib/asn1/x509_dn.cpp
@@ -58,13 +58,13 @@ void X509_DN::add_attribute(const OID& oid, const std::string& str)
if(str.empty())
return;
- auto range = dn_info.equal_range(oid);
+ auto range = m_dn_info.equal_range(oid);
for(auto i = range.first; i != range.second; ++i)
if(i->second.value() == str)
return;
- multimap_insert(dn_info, oid, ASN1_String(str));
- dn_bits.clear();
+ multimap_insert(m_dn_info, oid, ASN1_String(str));
+ m_dn_bits.clear();
}
/*
@@ -73,7 +73,7 @@ void X509_DN::add_attribute(const OID& oid, const std::string& str)
std::multimap<OID, std::string> X509_DN::get_attributes() const
{
std::multimap<OID, std::string> retval;
- for(auto i = dn_info.begin(); i != dn_info.end(); ++i)
+ for(auto i = m_dn_info.begin(); i != m_dn_info.end(); ++i)
multimap_insert(retval, i->first, i->second.value());
return retval;
}
@@ -84,7 +84,7 @@ std::multimap<OID, std::string> X509_DN::get_attributes() const
std::multimap<std::string, std::string> X509_DN::contents() const
{
std::multimap<std::string, std::string> retval;
- for(auto i = dn_info.begin(); i != dn_info.end(); ++i)
+ for(auto i = m_dn_info.begin(); i != m_dn_info.end(); ++i)
multimap_insert(retval, OIDS::lookup(i->first), i->second.value());
return retval;
}
@@ -96,7 +96,7 @@ std::vector<std::string> X509_DN::get_attribute(const std::string& attr) const
{
const OID oid = OIDS::lookup(deref_info_field(attr));
- auto range = dn_info.equal_range(oid);
+ auto range = m_dn_info.equal_range(oid);
std::vector<std::string> values;
for(auto i = range.first; i != range.second; ++i)
@@ -109,7 +109,7 @@ std::vector<std::string> X509_DN::get_attribute(const std::string& attr) const
*/
std::vector<byte> X509_DN::get_bits() const
{
- return dn_bits;
+ return m_dn_bits;
}
/*
@@ -227,8 +227,8 @@ void X509_DN::encode_into(DER_Encoder& der) const
der.start_cons(SEQUENCE);
- if(!dn_bits.empty())
- der.raw_bytes(dn_bits);
+ if(!m_dn_bits.empty())
+ der.raw_bytes(m_dn_bits);
else
{
do_ava(der, dn_info, PRINTABLE_STRING, "X520.Country");
@@ -275,7 +275,7 @@ void X509_DN::decode_from(BER_Decoder& source)
}
}
- dn_bits = bits;
+ m_dn_bits = bits;
}
namespace {
diff --git a/src/lib/asn1/x509_dn.h b/src/lib/asn1/x509_dn.h
index cf1fbc03b..9daa68f1c 100644
--- a/src/lib/asn1/x509_dn.h
+++ b/src/lib/asn1/x509_dn.h
@@ -41,8 +41,8 @@ class BOTAN_DLL X509_DN : public ASN1_Object
X509_DN(const std::multimap<OID, std::string>&);
X509_DN(const std::multimap<std::string, std::string>&);
private:
- std::multimap<OID, ASN1_String> dn_info;
- std::vector<byte> dn_bits;
+ std::multimap<OID, ASN1_String> m_dn_info;
+ std::vector<byte> m_dn_bits;
};
bool BOTAN_DLL operator==(const X509_DN&, const X509_DN&);