Make the accessor methods in ssl_cert const.

This commit is contained in:
Sadie Powell 2022-02-14 15:59:20 +00:00
parent 5027a63e52
commit 4169e0e799

View File

@ -53,7 +53,7 @@ class ssl_cert : public refcountbase
/** Get certificate distinguished name
* @return Certificate DN
*/
const std::string& GetDN()
const std::string& GetDN() const
{
return dn;
}
@ -61,7 +61,7 @@ class ssl_cert : public refcountbase
/** Get Certificate issuer
* @return Certificate issuer
*/
const std::string& GetIssuer()
const std::string& GetIssuer() const
{
return issuer;
}
@ -70,7 +70,7 @@ class ssl_cert : public refcountbase
* @return The error associated with this users certificate,
* or an empty string if there is no error.
*/
const std::string& GetError()
const std::string& GetError() const
{
return error;
}
@ -78,7 +78,7 @@ class ssl_cert : public refcountbase
/** Get key fingerprint.
* @return The key fingerprint as a hex string.
*/
const std::string& GetFingerprint()
const std::string& GetFingerprint() const
{
return fingerprint;
}
@ -87,7 +87,7 @@ class ssl_cert : public refcountbase
* @return True if this is a trusted certificate
* (the certificate chain validates)
*/
bool IsTrusted()
bool IsTrusted() const
{
return trusted;
}
@ -96,7 +96,7 @@ class ssl_cert : public refcountbase
* @return True if the certificate itself is
* correctly formed.
*/
bool IsInvalid()
bool IsInvalid() const
{
return invalid;
}
@ -105,7 +105,7 @@ class ssl_cert : public refcountbase
* @return True if the certificate appears to be
* self-signed.
*/
bool IsUnknownSigner()
bool IsUnknownSigner() const
{
return unknownsigner;
}
@ -115,7 +115,7 @@ class ssl_cert : public refcountbase
* Note that this only works properly for GnuTLS
* right now.
*/
bool IsRevoked()
bool IsRevoked() const
{
return revoked;
}
@ -123,7 +123,7 @@ class ssl_cert : public refcountbase
/** Get certificate usability
* @return True if the certificate is not expired nor revoked
*/
bool IsUsable()
bool IsUsable() const
{
return !invalid && !revoked && error.empty();
}
@ -132,12 +132,12 @@ class ssl_cert : public refcountbase
* @return True if the certificate is issued by a CA
* and valid.
*/
bool IsCAVerified()
bool IsCAVerified() const
{
return IsUsable() && trusted && !unknownsigner;
}
std::string GetMetaLine()
std::string GetMetaLine() const
{
std::stringstream value;
bool hasError = !error.empty();