diff options
Diffstat (limited to 'src/lib/asn1/asn1_time.h')
-rw-r--r-- | src/lib/asn1/asn1_time.h | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/lib/asn1/asn1_time.h b/src/lib/asn1/asn1_time.h index 6200d7b62..f2b1c7975 100644 --- a/src/lib/asn1/asn1_time.h +++ b/src/lib/asn1/asn1_time.h @@ -22,24 +22,38 @@ class BOTAN_DLL X509_Time : public ASN1_Object void encode_into(class DER_Encoder&) const override; void decode_from(class BER_Decoder&) override; - std::string as_string() const; + /// Return an internal string representation of the time + std::string to_string() const; + + /// Returns a human friendly string replesentation of no particular formatting std::string readable_string() const; - bool time_is_set() const; - std::string to_string() const { return readable_string(); } + /// Return if the time has been set somehow + bool time_is_set() const; - s32bit cmp(const X509_Time&) const; + /// Compare this time against another + s32bit cmp(const X509_Time& other) const; - void set_to(const std::string&); - void set_to(const std::string&, ASN1_Tag); + /// Create an invalid X509_Time + X509_Time() {} + /// Create a X509_Time from a time point X509_Time(const std::chrono::system_clock::time_point& time); - X509_Time(const std::string& = ""); - X509_Time(const std::string&, ASN1_Tag); + + /// Create an X509_Time from string + X509_Time(const std::string& t_spec, ASN1_Tag tag); + private: + void set_to(const std::string& t_spec, ASN1_Tag); bool passes_sanity_check() const; - u32bit year, month, day, hour, minute, second; - ASN1_Tag tag; + + u32bit m_year = 0; + u32bit m_month = 0; + u32bit m_day = 0; + u32bit m_hour = 0; + u32bit m_minute = 0; + u32bit m_second = 0; + ASN1_Tag m_tag = NO_OBJECT; }; /* |