diff options
author | Jack Lloyd <[email protected]> | 2019-03-01 08:50:11 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-03-01 08:50:11 -0500 |
commit | ff9174588a7ab7c1f7c2c88f24cb9a01dc6381f8 (patch) | |
tree | 76144525d43cca22b673e870a047c2c42ff1d6ed /src | |
parent | cbb0e622a5cec3f9f74da77657326eac5eba3818 (diff) |
Constify a few things in X509_Certificate::to_string()
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/x509/x509cert.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/x509/x509cert.cpp b/src/lib/x509/x509cert.cpp index 5bc04a9a2..6c2ec033d 100644 --- a/src/lib/x509/x509cert.cpp +++ b/src/lib/x509/x509cert.cpp @@ -793,7 +793,7 @@ std::string X509_Certificate::to_string() const out << " Decipher Only\n"; } - const std::vector<OID> policies = this->certificate_policy_oids(); + const std::vector<OID>& policies = this->certificate_policy_oids(); if(!policies.empty()) { out << "Policies: " << "\n"; @@ -801,12 +801,19 @@ std::string X509_Certificate::to_string() const out << " " << oid.as_string() << "\n"; } - std::vector<OID> ex_constraints = this->extended_key_usage(); + const std::vector<OID>& ex_constraints = this->extended_key_usage(); if(!ex_constraints.empty()) { out << "Extended Constraints:\n"; - for(size_t i = 0; i != ex_constraints.size(); i++) - out << " " << OIDS::oid2str(ex_constraints[i]) << "\n"; + for(auto&& oid : ex_constraints) + { + const std::string oid_str = OIDS::oid2str(oid); + + if(oid_str.empty()) + out << " " << oid.as_string() << "\n"; + else + out << " " << oid_str << "\n"; + } } const NameConstraints& name_constraints = this->name_constraints(); @@ -839,7 +846,7 @@ std::string X509_Certificate::to_string() const if(!ocsp_responder().empty()) out << "OCSP responder " << ocsp_responder() << "\n"; - std::vector<std::string> ca_issuers = this->ca_issuers(); + const std::vector<std::string> ca_issuers = this->ca_issuers(); if(!ca_issuers.empty()) { out << "CA Issuers:\n"; |