aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert/x509/x509_obj.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/cert/x509/x509_obj.cpp')
-rw-r--r--src/lib/cert/x509/x509_obj.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/cert/x509/x509_obj.cpp b/src/lib/cert/x509/x509_obj.cpp
index e908e8cab..983be40b2 100644
--- a/src/lib/cert/x509/x509_obj.cpp
+++ b/src/lib/cert/x509/x509_obj.cpp
@@ -48,12 +48,12 @@ X509_Object::X509_Object(const std::vector<byte>& vec, const std::string& labels
*/
void X509_Object::init(DataSource& in, const std::string& labels)
{
- PEM_labels_allowed = split_on(labels, '/');
- if(PEM_labels_allowed.size() < 1)
+ m_PEM_labels_allowed = split_on(labels, '/');
+ if(m_PEM_labels_allowed.size() < 1)
throw Invalid_Argument("Bad labels argument to X509_Object");
- PEM_label_pref = PEM_labels_allowed[0];
- std::sort(PEM_labels_allowed.begin(), PEM_labels_allowed.end());
+ m_PEM_label_pref = m_PEM_labels_allowed[0];
+ std::sort(m_PEM_labels_allowed.begin(), m_PEM_labels_allowed.end());
try {
if(ASN1::maybe_BER(in) && !PEM_Code::matches(in))
@@ -66,8 +66,8 @@ void X509_Object::init(DataSource& in, const std::string& labels)
std::string got_label;
DataSource_Memory ber(PEM_Code::decode(in, got_label));
- if(!std::binary_search(PEM_labels_allowed.begin(),
- PEM_labels_allowed.end(), got_label))
+ if(!std::binary_search(m_PEM_labels_allowed.begin(),
+ m_PEM_labels_allowed.end(), got_label))
throw Decoding_Error("Invalid PEM label: " + got_label);
BER_Decoder dec(ber);
@@ -76,7 +76,7 @@ void X509_Object::init(DataSource& in, const std::string& labels)
}
catch(Decoding_Error& e)
{
- throw Decoding_Error(PEM_label_pref + " decoding failed: " + e.what());
+ throw Decoding_Error(m_PEM_label_pref + " decoding failed: " + e.what());
}
}
@@ -85,10 +85,10 @@ void X509_Object::encode_into(DER_Encoder& to) const
{
to.start_cons(SEQUENCE)
.start_cons(SEQUENCE)
- .raw_bytes(tbs_bits)
+ .raw_bytes(m_tbs_bits)
.end_cons()
- .encode(sig_algo)
- .encode(sig, BIT_STRING)
+ .encode(m_sig_algo)
+ .encode(m_sig, BIT_STRING)
.end_cons();
}
@@ -99,10 +99,10 @@ void X509_Object::decode_from(BER_Decoder& from)
{
from.start_cons(SEQUENCE)
.start_cons(SEQUENCE)
- .raw_bytes(tbs_bits)
+ .raw_bytes(m_tbs_bits)
.end_cons()
- .decode(sig_algo)
- .decode(sig, BIT_STRING)
+ .decode(m_sig_algo)
+ .decode(m_sig, BIT_STRING)
.verify_end()
.end_cons();
}
@@ -122,7 +122,7 @@ std::vector<byte> X509_Object::BER_encode() const
*/
std::string X509_Object::PEM_encode() const
{
- return PEM_Code::encode(BER_encode(), PEM_label_pref);
+ return PEM_Code::encode(BER_encode(), m_PEM_label_pref);
}
/*
@@ -130,7 +130,7 @@ std::string X509_Object::PEM_encode() const
*/
std::vector<byte> X509_Object::tbs_data() const
{
- return ASN1::put_in_sequence(tbs_bits);
+ return ASN1::put_in_sequence(m_tbs_bits);
}
/*
@@ -138,7 +138,7 @@ std::vector<byte> X509_Object::tbs_data() const
*/
std::vector<byte> X509_Object::signature() const
{
- return sig;
+ return m_sig;
}
/*
@@ -146,7 +146,7 @@ std::vector<byte> X509_Object::signature() const
*/
AlgorithmIdentifier X509_Object::signature_algorithm() const
{
- return sig_algo;
+ return m_sig_algo;
}
/*
@@ -155,11 +155,11 @@ AlgorithmIdentifier X509_Object::signature_algorithm() const
std::string X509_Object::hash_used_for_signature() const
{
std::vector<std::string> sig_info =
- split_on(OIDS::lookup(sig_algo.oid), '/');
+ split_on(OIDS::lookup(m_sig_algo.oid), '/');
if(sig_info.size() != 2)
throw Internal_Error("Invalid name format found for " +
- sig_algo.oid.as_string());
+ m_sig_algo.oid.as_string());
std::vector<std::string> pad_and_hash =
parse_algorithm_name(sig_info[1]);
@@ -176,10 +176,10 @@ std::string X509_Object::hash_used_for_signature() const
bool X509_Object::check_signature(const Public_Key* pub_key) const
{
if(!pub_key)
- throw Exception("No key provided for " + PEM_label_pref + " signature check");
+ throw Exception("No key provided for " + m_PEM_label_pref + " signature check");
std::unique_ptr<const Public_Key> key(pub_key);
return check_signature(*key);
- }
+}
/*
* Check the signature on an object
@@ -188,7 +188,7 @@ bool X509_Object::check_signature(const Public_Key& pub_key) const
{
try {
std::vector<std::string> sig_info =
- split_on(OIDS::lookup(sig_algo.oid), '/');
+ split_on(OIDS::lookup(m_sig_algo.oid), '/');
if(sig_info.size() != 2 || sig_info[0] != pub_key.algo_name())
return false;
@@ -234,12 +234,12 @@ void X509_Object::do_decode()
}
catch(Decoding_Error& e)
{
- throw Decoding_Error(PEM_label_pref + " decoding failed (" +
+ throw Decoding_Error(m_PEM_label_pref + " decoding failed (" +
e.what() + ")");
}
catch(Invalid_Argument& e)
{
- throw Decoding_Error(PEM_label_pref + " decoding failed (" +
+ throw Decoding_Error(m_PEM_label_pref + " decoding failed (" +
e.what() + ")");
}
}