Botan 2.19.3
Crypto and TLS for C&
|
#include <asn1_obj.h>
Public Member Functions | |
ASN1_Time ()=default | |
Create an invalid ASN1_Time. | |
ASN1_Time (const std::chrono::system_clock::time_point &time) | |
Create a ASN1_Time from a time point. | |
ASN1_Time (const std::string &t_spec, ASN1_Tag tag) | |
Create an ASN1_Time from string. | |
std::vector< uint8_t > | BER_encode () const |
int32_t | cmp (const ASN1_Time &other) const |
Compare this time against another. | |
void | decode_from (BER_Decoder &) override |
void | encode_into (DER_Encoder &) const override |
DER encode a ASN1_Time. | |
std::string | readable_string () const |
Returns a human friendly string replesentation of no particular formatting. | |
bool | time_is_set () const |
Return if the time has been set somehow. | |
uint64_t | time_since_epoch () const |
Return time since epoch. | |
std::chrono::system_clock::time_point | to_std_timepoint () const |
Returns a STL timepoint object. | |
std::string | to_string () const |
Return an internal string representation of the time. | |
Time (GeneralizedTime/UniversalTime)
Definition at line 327 of file asn1_obj.h.
|
default |
Create an invalid ASN1_Time.
|
explicit |
Create a ASN1_Time from a time point.
Definition at line 19 of file asn1_time.cpp.
References Botan::calendar_value(), Botan::GENERALIZED_TIME, Botan::calendar_point::get_day(), Botan::calendar_point::get_hour(), Botan::calendar_point::get_minutes(), Botan::calendar_point::get_month(), Botan::calendar_point::get_seconds(), Botan::calendar_point::get_year(), and Botan::UTC_TIME.
Botan::ASN1_Time::ASN1_Time | ( | const std::string & | t_spec, |
ASN1_Tag | tag | ||
) |
Create an ASN1_Time from string.
Definition at line 33 of file asn1_time.cpp.
|
inherited |
Return the encoding of this object. This is a convenience method when just one object needs to be serialized. Use DER_Encoder for complicated encodings.
Definition at line 16 of file asn1_obj.cpp.
References Botan::ASN1_Object::encode_into().
Referenced by Botan::PSSR::config_for_x509(), Botan::Certificate_Store_In_SQL::find_all_certs(), Botan::Certificate_Store_In_SQL::find_cert(), Botan::X509_Certificate::fingerprint(), Botan::Certificate_Store_In_SQL::insert_cert(), Botan::X509_Object::PEM_encode(), and Botan::Certificate_Store_In_SQL::revoke_cert().
int32_t Botan::ASN1_Time::cmp | ( | const ASN1_Time & | other | ) | const |
Compare this time against another.
Definition at line 118 of file asn1_time.cpp.
References time_is_set().
Referenced by Botan::operator!=(), Botan::operator<(), Botan::operator<=(), Botan::operator==(), Botan::operator>(), and Botan::operator>=().
|
overridevirtual |
Decode whatever this object is from from
from | the BER_Decoder that will be read from |
Implements Botan::ASN1_Object.
Definition at line 46 of file asn1_time.cpp.
References Botan::BER_Decoder::get_next_object(), Botan::ASN1::to_string(), and Botan::BER_Object::type().
|
overridevirtual |
DER encode a ASN1_Time.
Implements Botan::ASN1_Object.
Definition at line 38 of file asn1_time.cpp.
References Botan::DER_Encoder::add_object(), BOTAN_ARG_CHECK, Botan::GENERALIZED_TIME, to_string(), Botan::UNIVERSAL, and Botan::UTC_TIME.
std::string Botan::ASN1_Time::readable_string | ( | ) | const |
Returns a human friendly string replesentation of no particular formatting.
Definition at line 93 of file asn1_time.cpp.
References time_is_set().
Referenced by to_string(), and Botan::X509_Certificate::to_string().
bool Botan::ASN1_Time::time_is_set | ( | ) | const |
Return if the time has been set somehow.
Definition at line 113 of file asn1_time.cpp.
Referenced by cmp(), readable_string(), Botan::Certificate_Store_In_SQL::revoke_cert(), and to_string().
uint64_t Botan::ASN1_Time::time_since_epoch | ( | ) | const |
Return time since epoch.
Definition at line 266 of file asn1_time.cpp.
References to_std_timepoint().
std::chrono::system_clock::time_point Botan::ASN1_Time::to_std_timepoint | ( | ) | const |
Returns a STL timepoint object.
Definition at line 261 of file asn1_time.cpp.
References Botan::calendar_point::to_std_timepoint().
Referenced by time_since_epoch().
std::string Botan::ASN1_Time::to_string | ( | ) | const |
Return an internal string representation of the time.
Definition at line 53 of file asn1_time.cpp.
References readable_string(), time_is_set(), and Botan::UTC_TIME.
Referenced by encode_into(), and Botan::X509_Certificate::subject_info().