Botan 3.6.1
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 (std::string_view t_spec) | |
Create an ASN1_Time from string. | |
ASN1_Time (std::string_view t_spec, ASN1_Type tag) | |
Create an ASN1_Time from string and a specified tagging (Utc or Generalized) | |
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 348 of file asn1_obj.h.
|
default |
Create an invalid ASN1_Time.
|
explicit |
Create a ASN1_Time from a time point.
Definition at line 20 of file asn1_time.cpp.
References Botan::calendar_point::day(), Botan::GeneralizedTime, Botan::calendar_point::hour(), Botan::calendar_point::minutes(), Botan::calendar_point::month(), Botan::calendar_point::seconds(), Botan::UtcTime, and Botan::calendar_point::year().
Botan::ASN1_Time::ASN1_Time | ( | std::string_view | t_spec | ) |
Create an ASN1_Time from string.
Definition at line 37 of file asn1_time.cpp.
References Botan::GeneralizedTime, and Botan::UtcTime.
Botan::ASN1_Time::ASN1_Time | ( | std::string_view | t_spec, |
ASN1_Type | tag ) |
Create an ASN1_Time from string and a specified tagging (Utc or Generalized)
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 19 of file asn1_obj.cpp.
References Botan::ASN1_Object::encode_into().
Referenced by Botan::PSS_Params::decode_from(), 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 110 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 53 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 47 of file asn1_time.cpp.
References Botan::DER_Encoder::add_object(), BOTAN_ARG_CHECK, Botan::GeneralizedTime, to_string(), Botan::Universal, and Botan::UtcTime.
std::string Botan::ASN1_Time::readable_string | ( | ) | const |
Returns a human friendly string replesentation of no particular formatting.
Definition at line 92 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 106 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 252 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 248 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 59 of file asn1_time.cpp.
References Botan::fmt(), readable_string(), time_is_set(), and Botan::UtcTime.
Referenced by encode_into().