/* * Common ASN.1 Objects * (C) 1999-2007 Jack Lloyd * 2007 Yves Jerschow * * Distributed under the terms of the Botan license */ #ifndef BOTAN_ASN1_OBJ_H__ #define BOTAN_ASN1_OBJ_H__ #include #include #include #include #include #include #include namespace Botan { /** * Attribute */ class BOTAN_DLL Attribute : public ASN1_Object { public: void encode_into(class DER_Encoder& to) const; void decode_from(class BER_Decoder& from); OID oid; MemoryVector parameters; Attribute() {} Attribute(const OID&, const MemoryRegion&); Attribute(const std::string&, const MemoryRegion&); }; /** * X.509 Time */ class BOTAN_DLL X509_Time : public ASN1_Object { public: void encode_into(class DER_Encoder&) const; void decode_from(class BER_Decoder&); std::string as_string() const; std::string readable_string() const; bool time_is_set() const; s32bit cmp(const X509_Time&) const; void set_to(const std::string&); void set_to(const std::string&, ASN1_Tag); X509_Time(const std::chrono::system_clock::time_point& time); X509_Time(const std::string& = ""); X509_Time(const std::string&, ASN1_Tag); private: bool passes_sanity_check() const; u32bit year, month, day, hour, minute, second; ASN1_Tag tag; }; /** * Alternative Name */ class BOTAN_DLL AlternativeName : public ASN1_Object { public: void encode_into(class DER_Encoder&) const; void decode_from(class BER_Decoder&); std::multimap contents() const; void add_attribute(const std::string&, const std::string&); std::multimap get_attributes() const; void add_othername(const OID&, const std::string&, ASN1_Tag); std::multimap get_othernames() const; bool has_items() const; AlternativeName(const std::string& = "", const std::string& = "", const std::string& = "", const std::string& = ""); private: std::multimap alt_info; std::multimap othernames; }; /* * Comparison Operations */ bool BOTAN_DLL operator==(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator!=(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator<=(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator>=(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator<(const X509_Time&, const X509_Time&); bool BOTAN_DLL operator>(const X509_Time&, const X509_Time&); } #endif