aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1/asn1_oid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/asn1/asn1_oid.cpp')
-rw-r--r--src/lib/asn1/asn1_oid.cpp42
1 files changed, 21 insertions, 21 deletions
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);
}
}