aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/cert')
-rw-r--r--src/lib/cert/cvc/asn1_eac_str.cpp2
-rw-r--r--src/lib/cert/x509/certstor.h6
-rw-r--r--src/lib/cert/x509/crl_ent.h2
-rw-r--r--src/lib/cert/x509/pkcs10.h6
-rw-r--r--src/lib/cert/x509/x509_crl.h2
-rw-r--r--src/lib/cert/x509/x509_ext.cpp18
-rw-r--r--src/lib/cert/x509/x509_ext.h22
-rw-r--r--src/lib/cert/x509/x509cert.h6
-rw-r--r--src/lib/cert/x509/x509path.h2
9 files changed, 30 insertions, 36 deletions
diff --git a/src/lib/cert/cvc/asn1_eac_str.cpp b/src/lib/cert/cvc/asn1_eac_str.cpp
index 0134399d8..26bc7f09d 100644
--- a/src/lib/cert/cvc/asn1_eac_str.cpp
+++ b/src/lib/cert/cvc/asn1_eac_str.cpp
@@ -85,7 +85,7 @@ void ASN1_EAC_String::decode_from(BER_Decoder& source)
try
{
*this = ASN1_EAC_String(
- Charset::transcode(ASN1::to_string(obj), charset_is, LOCAL_CHARSET),
+ Charset::transcode(ASN1::to_string(obj), LOCAL_CHARSET, chaset_is),
obj.type_tag);
}
catch(Invalid_Argument& inv_arg)
diff --git a/src/lib/cert/x509/certstor.h b/src/lib/cert/x509/certstor.h
index eb42c6a49..29948c709 100644
--- a/src/lib/cert/x509/certstor.h
+++ b/src/lib/cert/x509/certstor.h
@@ -48,9 +48,9 @@ class BOTAN_DLL Certificate_Store_In_Memory : public Certificate_Store
* Attempt to parse all files in dir (including subdirectories)
* as certificates. Ignores errors.
*/
- Certificate_Store_In_Memory(const std::string& dir);
+ explicit Certificate_Store_In_Memory(const std::string& dir);
- Certificate_Store_In_Memory(const X509_Certificate& cert);
+ explicit Certificate_Store_In_Memory(const X509_Certificate& cert);
Certificate_Store_In_Memory() {}
@@ -74,7 +74,7 @@ class BOTAN_DLL Certificate_Store_In_Memory : public Certificate_Store
class BOTAN_DLL Certificate_Store_Overlay : public Certificate_Store
{
public:
- Certificate_Store_Overlay(const std::vector<X509_Certificate>& certs) :
+ explicit Certificate_Store_Overlay(const std::vector<X509_Certificate>& certs) :
m_certs(certs) {}
std::vector<X509_DN> all_subjects() const override;
diff --git a/src/lib/cert/x509/crl_ent.h b/src/lib/cert/x509/crl_ent.h
index ceefdb191..11ab34365 100644
--- a/src/lib/cert/x509/crl_ent.h
+++ b/src/lib/cert/x509/crl_ent.h
@@ -63,7 +63,7 @@ class BOTAN_DLL CRL_Entry final : public ASN1_Object
/**
* Construct an empty CRL entry.
*/
- CRL_Entry(bool throw_on_unknown_critical_extension = false);
+ explicit CRL_Entry(bool throw_on_unknown_critical_extension = false);
/**
* Construct an CRL entry.
diff --git a/src/lib/cert/x509/pkcs10.h b/src/lib/cert/x509/pkcs10.h
index 94db222cd..8c9f49d84 100644
--- a/src/lib/cert/x509/pkcs10.h
+++ b/src/lib/cert/x509/pkcs10.h
@@ -84,20 +84,20 @@ class BOTAN_DLL PKCS10_Request final : public X509_Object
* Create a PKCS#10 Request from a data source.
* @param source the data source providing the DER encoded request
*/
- PKCS10_Request(DataSource& source);
+ explicit PKCS10_Request(DataSource& source);
/**
* Create a PKCS#10 Request from a file.
* @param filename the name of the file containing the DER or PEM
* encoded request file
*/
- PKCS10_Request(const std::string& filename);
+ explicit PKCS10_Request(const std::string& filename);
/**
* Create a PKCS#10 Request from binary data.
* @param vec a std::vector containing the DER value
*/
- PKCS10_Request(const std::vector<byte>& vec);
+ explicit PKCS10_Request(const std::vector<byte>& vec);
private:
void force_decode() override;
void handle_attribute(const Attribute&);
diff --git a/src/lib/cert/x509/x509_crl.h b/src/lib/cert/x509/x509_crl.h
index 25556000d..29057e944 100644
--- a/src/lib/cert/x509/x509_crl.h
+++ b/src/lib/cert/x509/x509_crl.h
@@ -27,7 +27,7 @@ class BOTAN_DLL X509_CRL final : public X509_Object
*/
struct BOTAN_DLL X509_CRL_Error : public Exception
{
- X509_CRL_Error(const std::string& error) :
+ explicit X509_CRL_Error(const std::string& error) :
Exception("X509_CRL: " + error) {}
};
diff --git a/src/lib/cert/x509/x509_ext.cpp b/src/lib/cert/x509/x509_ext.cpp
index b4b918529..7dd4a3190 100644
--- a/src/lib/cert/x509/x509_ext.cpp
+++ b/src/lib/cert/x509/x509_ext.cpp
@@ -309,11 +309,8 @@ void Subject_Key_ID::contents_to(Data_Store& subject, Data_Store&) const
/*
* Subject_Key_ID Constructor
*/
-Subject_Key_ID::Subject_Key_ID(const std::vector<byte>& pub_key)
- {
- SHA_160 hash;
- m_key_id = unlock(hash.process(pub_key));
- }
+Subject_Key_ID::Subject_Key_ID(const std::vector<byte>& pub_key) : m_key_id(unlock(SHA_160().process(pub_key)))
+ {}
/*
* Encode the extension
@@ -384,11 +381,8 @@ void Alternative_Name::contents_to(Data_Store& subject_info,
* Alternative_Name Constructor
*/
Alternative_Name::Alternative_Name(const AlternativeName& alt_name,
- const std::string& oid_name_str)
- {
- this->m_alt_name = alt_name;
- this->m_oid_name_str = oid_name_str;
- }
+ const std::string& oid_name_str) : m_alt_name(alt_name), m_oid_name_str(oid_name_str)
+ {}
/*
* Subject_Alternative_Name Constructor
@@ -448,7 +442,7 @@ class Policy_Information : public ASN1_Object
OID oid;
Policy_Information() {}
- Policy_Information(const OID& oid_) : oid(oid_) {}
+ explicit Policy_Information(const OID& oid) : oid(oid) {}
void encode_into(DER_Encoder& codec) const override
{
@@ -476,7 +470,7 @@ std::vector<byte> Certificate_Policies::encode_inner() const
std::vector<Policy_Information> policies;
for(size_t i = 0; i != m_oids.size(); ++i)
- policies.push_back(m_oids[i]);
+ policies.push_back(Policy_Information(m_oids[i]));
return DER_Encoder()
.start_cons(SEQUENCE)
diff --git a/src/lib/cert/x509/x509_ext.h b/src/lib/cert/x509/x509_ext.h
index e9e718014..0614b9a52 100644
--- a/src/lib/cert/x509/x509_ext.h
+++ b/src/lib/cert/x509/x509_ext.h
@@ -70,7 +70,7 @@ class BOTAN_DLL Extensions : public ASN1_Object
Extensions& operator=(const Extensions&);
Extensions(const Extensions&);
- Extensions(bool st = true) : m_throw_on_unknown_critical(st) {}
+ explicit Extensions(bool st = true) : m_throw_on_unknown_critical(st) {}
~Extensions();
private:
static Certificate_Extension* get_extension(const OID&);
@@ -117,7 +117,7 @@ class BOTAN_DLL Key_Usage final : public Certificate_Extension
public:
Key_Usage* copy() const override { return new Key_Usage(m_constraints); }
- Key_Usage(Key_Constraints c = NO_CONSTRAINTS) : m_constraints(c) {}
+ explicit Key_Usage(Key_Constraints c = NO_CONSTRAINTS) : m_constraints(c) {}
Key_Constraints get_constraints() const { return m_constraints; }
private:
@@ -142,7 +142,7 @@ class BOTAN_DLL Subject_Key_ID final : public Certificate_Extension
{ return new Subject_Key_ID(m_key_id); }
Subject_Key_ID() {}
- Subject_Key_ID(const std::vector<byte>&);
+ explicit Subject_Key_ID(const std::vector<byte>&);
std::vector<byte> get_key_id() const { return m_key_id; }
private:
@@ -167,7 +167,7 @@ class BOTAN_DLL Authority_Key_ID final : public Certificate_Extension
{ return new Authority_Key_ID(m_key_id); }
Authority_Key_ID() {}
- Authority_Key_ID(const std::vector<byte>& k) : m_key_id(k) {}
+ explicit Authority_Key_ID(const std::vector<byte>& k) : m_key_id(k) {}
std::vector<byte> get_key_id() const { return m_key_id; }
private:
@@ -215,7 +215,7 @@ class BOTAN_DLL Subject_Alternative_Name : public Alternative_Name
Subject_Alternative_Name* copy() const override
{ return new Subject_Alternative_Name(get_alt_name()); }
- Subject_Alternative_Name(const AlternativeName& = AlternativeName());
+ explicit Subject_Alternative_Name(const AlternativeName& = AlternativeName());
};
/**
@@ -227,7 +227,7 @@ class BOTAN_DLL Issuer_Alternative_Name : public Alternative_Name
Issuer_Alternative_Name* copy() const override
{ return new Issuer_Alternative_Name(get_alt_name()); }
- Issuer_Alternative_Name(const AlternativeName& = AlternativeName());
+ explicit Issuer_Alternative_Name(const AlternativeName& = AlternativeName());
};
/**
@@ -240,7 +240,7 @@ class BOTAN_DLL Extended_Key_Usage final : public Certificate_Extension
{ return new Extended_Key_Usage(m_oids); }
Extended_Key_Usage() {}
- Extended_Key_Usage(const std::vector<OID>& o) : m_oids(o) {}
+ explicit Extended_Key_Usage(const std::vector<OID>& o) : m_oids(o) {}
std::vector<OID> get_oids() const { return m_oids; }
private:
@@ -265,7 +265,7 @@ class BOTAN_DLL Certificate_Policies final : public Certificate_Extension
{ return new Certificate_Policies(m_oids); }
Certificate_Policies() {}
- Certificate_Policies(const std::vector<OID>& o) : m_oids(o) {}
+ explicit Certificate_Policies(const std::vector<OID>& o) : m_oids(o) {}
std::vector<OID> get_oids() const { return m_oids; }
private:
@@ -288,7 +288,7 @@ class BOTAN_DLL Authority_Information_Access final : public Certificate_Extensio
Authority_Information_Access() {}
- Authority_Information_Access(const std::string& ocsp) :
+ explicit Authority_Information_Access(const std::string& ocsp) :
m_ocsp_responder(ocsp) {}
private:
@@ -338,7 +338,7 @@ class BOTAN_DLL CRL_ReasonCode final : public Certificate_Extension
CRL_ReasonCode* copy() const override
{ return new CRL_ReasonCode(m_reason); }
- CRL_ReasonCode(CRL_Code r = UNSPECIFIED) : m_reason(r) {}
+ explicit CRL_ReasonCode(CRL_Code r = UNSPECIFIED) : m_reason(r) {}
CRL_Code get_reason() const { return m_reason; }
private:
@@ -374,7 +374,7 @@ class BOTAN_DLL CRL_Distribution_Points final : public Certificate_Extension
CRL_Distribution_Points() {}
- CRL_Distribution_Points(const std::vector<Distribution_Point>& points) :
+ explicit CRL_Distribution_Points(const std::vector<Distribution_Point>& points) :
m_distribution_points(points) {}
std::vector<Distribution_Point> distribution_points() const
diff --git a/src/lib/cert/x509/x509cert.h b/src/lib/cert/x509/x509cert.h
index d5784f427..0329fde47 100644
--- a/src/lib/cert/x509/x509cert.h
+++ b/src/lib/cert/x509/x509cert.h
@@ -220,16 +220,16 @@ class BOTAN_DLL X509_Certificate final : public X509_Object
* PEM encoded certificate.
* @param source the data source
*/
- X509_Certificate(DataSource& source);
+ explicit X509_Certificate(DataSource& source);
/**
* Create a certificate from a file containing the DER or PEM
* encoded certificate.
* @param filename the name of the certificate file
*/
- X509_Certificate(const std::string& filename);
+ explicit X509_Certificate(const std::string& filename);
- X509_Certificate(const std::vector<byte>& in);
+ explicit X509_Certificate(const std::vector<byte>& in);
private:
void force_decode() override;
diff --git a/src/lib/cert/x509/x509path.h b/src/lib/cert/x509/x509path.h
index 08d92915d..b7061685a 100644
--- a/src/lib/cert/x509/x509path.h
+++ b/src/lib/cert/x509/x509path.h
@@ -120,7 +120,7 @@ class BOTAN_DLL Path_Validation_Result
Path_Validation_Result(std::vector<std::set<Certificate_Status_Code>> status,
std::vector<X509_Certificate>&& cert_chain);
- Path_Validation_Result(Certificate_Status_Code status) : m_overall(status) {}
+ explicit Path_Validation_Result(Certificate_Status_Code status) : m_overall(status) {}
private:
friend Path_Validation_Result BOTAN_DLL x509_path_validate(