Botan 3.9.0
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. | |
BOTAN_FUTURE_EXPLICIT | 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 &from) override |
void | encode_into (DER_Encoder &to) 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. |
Static Public Member Functions | |
static ASN1_Time | from_seconds_since_epoch (uint64_t seconds) |
Create an ASN1_Time from seconds since epoch. |
Time (GeneralizedTime/UniversalTime)
Definition at line 360 of file asn1_obj.h.
|
default |
Create an invalid ASN1_Time.
References ASN1_Time(), BOTAN_FUTURE_EXPLICIT, from_seconds_since_epoch(), Botan::NoObject, time_since_epoch(), and to_std_timepoint().
Referenced by ASN1_Time(), cmp(), and from_seconds_since_epoch().
|
explicit |
Create a ASN1_Time from a time point.
Definition at line 25 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 43 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 39 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 encode_into().
Referenced by 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(), Botan::PSS_Params::PSS_Params(), 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 116 of file asn1_time.cpp.
References ASN1_Time(), and 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 59 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 53 of file asn1_time.cpp.
References Botan::DER_Encoder::add_object(), BOTAN_ARG_CHECK, Botan::GeneralizedTime, to_string(), Botan::Universal, and Botan::UtcTime.
|
static |
Create an ASN1_Time from seconds since epoch.
Definition at line 21 of file asn1_time.cpp.
References ASN1_Time(), and time_since_epoch().
Referenced by ASN1_Time().
std::string Botan::ASN1_Time::readable_string | ( | ) | const |
Returns a human friendly string replesentation of no particular formatting.
Definition at line 98 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 112 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 260 of file asn1_time.cpp.
References Botan::calendar_point::seconds_since_epoch().
Referenced by ASN1_Time(), and from_seconds_since_epoch().
std::chrono::system_clock::time_point Botan::ASN1_Time::to_std_timepoint | ( | ) | const |
Returns a STL timepoint object.
Definition at line 256 of file asn1_time.cpp.
References Botan::calendar_point::to_std_timepoint().
Referenced by ASN1_Time().
std::string Botan::ASN1_Time::to_string | ( | ) | const |
Return an internal string representation of the time.
Definition at line 65 of file asn1_time.cpp.
References Botan::fmt(), readable_string(), time_is_set(), and Botan::UtcTime.
Referenced by encode_into().