Skip to content
Snippets Groups Projects
Commit c776dad9 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

crypto: add Certificate::getExpiration()

parent 31fedd52
Branches
Tags
No related merge requests found
......@@ -298,6 +298,8 @@ struct OPENDHT_PUBLIC Certificate {
/** Read certificate alternative names */
std::vector<std::pair<NameType, std::string>> getAltNames() const;
std::chrono::system_clock::time_point getExpiration() const;
/**
* Returns true if the certificate is marked as a Certificate Authority.
*/
......
......@@ -759,6 +759,15 @@ Certificate::addRevocationList(std::shared_ptr<RevocationList> list)
revocation_lists.emplace_back(std::move(list));
}
std::chrono::system_clock::time_point
Certificate::getExpiration() const
{
auto t = gnutls_x509_crt_get_expiration_time(cert);
if (t == (time_t)-1)
return std::chrono::system_clock::time_point::min();
return std::chrono::system_clock::from_time_t(t);
}
PrivateKey
PrivateKey::generate(unsigned key_length)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment