From 96277a37c3b7125f2c79cb9c2df19d4811379a36 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 23 Jun 2006 04:20:30 +0000 Subject: Make Alternative_Name an abstract base, from which the subject and issuer forms are derived. Add Extensions::contents_to, which iterates over the set and adds each extension's contents. Add a new explicit info field for is_ca Implement Authority_Key_Id::decode_inner (incomplete, only handles the keyid form). --- include/x509_ext.h | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/x509_ext.h b/include/x509_ext.h index 720437265..147f17aa5 100644 --- a/include/x509_ext.h +++ b/include/x509_ext.h @@ -52,8 +52,8 @@ class Extensions : public ASN1_Object void encode_into(class DER_Encoder&) const; void decode_from(class BER_Decoder&); - std::vector get() const - { return extensions; } + void contents_to(Data_Store&, Data_Store&) const; + void add(Certificate_Extension* extn) { extensions.push_back(extn); } @@ -171,17 +171,18 @@ class Authority_Key_ID : public Certificate_Extension }; /************************************************* -* Alternative Name Extension * +* Alternative Name Extension Base Class * *************************************************/ class Alternative_Name : public Certificate_Extension { public: - Alternative_Name* copy() const; + AlternativeName get_alt_name() const { return alt_name; } + protected: Alternative_Name(const AlternativeName&, const std::string&, const std::string&); - AlternativeName get_alt_name() const { return alt_name; } + Alternative_Name(const std::string&, const std::string&); private: std::string config_id() const { return config_name_str; } std::string oid_name() const { return oid_name_str; } @@ -195,6 +196,30 @@ class Alternative_Name : public Certificate_Extension AlternativeName alt_name; }; +/************************************************* +* Subject Alternative Name Extension * +*************************************************/ +class Subject_Alternative_Name : public Alternative_Name + { + public: + Subject_Alternative_Name* copy() const + { return new Subject_Alternative_Name(get_alt_name()); } + + Subject_Alternative_Name(const AlternativeName& = AlternativeName()); + }; + +/************************************************* +* Issuer Alternative Name Extension * +*************************************************/ +class Issuer_Alternative_Name : public Alternative_Name + { + public: + Issuer_Alternative_Name* copy() const + { return new Issuer_Alternative_Name(get_alt_name()); } + + Issuer_Alternative_Name(const AlternativeName& = AlternativeName()); + }; + /************************************************* * Extended Key Usage Extension * *************************************************/ -- cgit v1.2.3