aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-24 02:15:03 +0000
committerlloyd <[email protected]>2006-06-24 02:15:03 +0000
commite6548784c63238d83e39d17fc59125b20d608dc2 (patch)
tree5fbcf90b3e2c5f81b5c236402927a9719bccf71a
parentd341940aec66d7401fa43d143be66cece851f1c9 (diff)
Add a complete set of extension object prototypes to the global
state.
-rw-r--r--src/x509stat.cpp49
1 files changed, 20 insertions, 29 deletions
diff --git a/src/x509stat.cpp b/src/x509stat.cpp
index 25ca197ca..621792504 100644
--- a/src/x509stat.cpp
+++ b/src/x509stat.cpp
@@ -30,11 +30,21 @@ Certificate_Extension* X509_GlobalState::get_extension(const OID& oid) const
}
/*************************************************
+* Destroy this global state object *
+*************************************************/
+X509_GlobalState::~X509_GlobalState()
+ {
+ for(u32bit j = 0; j != prototypes.size(); ++j)
+ delete prototypes[j];
+ prototypes.clear();
+ }
+
+/*************************************************
* Set up a new global state for X.509 *
*************************************************/
X509_GlobalState::X509_GlobalState()
{
-#define CREATE_PROTOTYPE(TYPE, NAME) \
+#define CREATE_PROTOTYPE(NAME, TYPE) \
struct TYPE ## _Prototype : public Extension_Prototype \
{ \
Certificate_Extension* make(const OID& oid) \
@@ -46,34 +56,15 @@ X509_GlobalState::X509_GlobalState()
}; \
add(new TYPE ## _Prototype);
-#if 0
- class Basic_Constraints_Prototype : public Extension_Prototype
- {
- public:
- Certificate_Extension* make(const OID& oid)
- {
- if(oid == OIDS::lookup("X509v3.BasicConstraints"))
- return new Cert_Extension::Basic_Constraints();
- return 0;
- }
- };
-
- add(new Basic_Constraints_Prototype);
-#else
-
- CREATE_PROTOTYPE(Basic_Constraints, "X509v3.BasicConstraints");
-
-#endif
- }
-
-/*************************************************
-* Destroy this global state object *
-*************************************************/
-X509_GlobalState::~X509_GlobalState()
- {
- for(u32bit j = 0; j != prototypes.size(); ++j)
- delete prototypes[j];
- prototypes.clear();
+ CREATE_PROTOTYPE("X509v3.KeyUsage", Key_Usage);
+ CREATE_PROTOTYPE("X509v3.BasicConstraints", Basic_Constraints);
+ CREATE_PROTOTYPE("X509v3.SubjectKeyIdentifier", Subject_Key_ID);
+ CREATE_PROTOTYPE("X509v3.AuthorityKeyIdentifier", Authority_Key_ID);
+ CREATE_PROTOTYPE("X509v3.ExtendedKeyUsage", Extended_Key_Usage);
+ CREATE_PROTOTYPE("X509v3.IssuerAlternativeName", Issuer_Alternative_Name);
+ CREATE_PROTOTYPE("X509v3.SubjectAlternativeName", Subject_Alternative_Name);
+ CREATE_PROTOTYPE("X509v3.CRLNumber", CRL_Number);
+ CREATE_PROTOTYPE("X509v3.CertificatePolicies", Certificate_Policies);
}
}