aboutsummaryrefslogtreecommitdiffstats
path: root/src/x509_ext.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-04-10 05:52:37 +0000
committerlloyd <[email protected]>2008-04-10 05:52:37 +0000
commitf15ca39257de8983babb95f7f5d589a4e555a864 (patch)
tree3f41f5e38cc5d07e3241db716d582fa146a4ac3d /src/x509_ext.cpp
parent59e71322cad61ff2f09664fc3e59b5446af4566a (diff)
parent9ec64ce60cad6c825b7cf40306a359d019e2c13c (diff)
propagate from branch 'net.randombit.botan' (head 6afe2db1f710f75bc27e189bb8bdb23613ce1ca3)
to branch 'net.randombit.botan.remove-libstate' (head e40f0dbdfd847024c30fa0092c2acefc19a550b8)
Diffstat (limited to 'src/x509_ext.cpp')
-rw-r--r--src/x509_ext.cpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/x509_ext.cpp b/src/x509_ext.cpp
index f692c5ac2..42a5bad01 100644
--- a/src/x509_ext.cpp
+++ b/src/x509_ext.cpp
@@ -4,8 +4,6 @@
*************************************************/
#include <botan/x509_ext.h>
-#include <botan/x509stat.h>
-#include <botan/libstate.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
#include <botan/lookup.h>
@@ -18,6 +16,28 @@
namespace Botan {
/*************************************************
+* List of X.509 Certificate Extensions *
+*************************************************/
+Certificate_Extension* Extensions::get_extension(const OID& oid)
+ {
+#define X509_EXTENSION(NAME, TYPE) \
+ if(OIDS::name_of(oid, NAME)) \
+ return new Cert_Extension::TYPE();
+
+ X509_EXTENSION("X509v3.KeyUsage", Key_Usage);
+ X509_EXTENSION("X509v3.BasicConstraints", Basic_Constraints);
+ X509_EXTENSION("X509v3.SubjectKeyIdentifier", Subject_Key_ID);
+ X509_EXTENSION("X509v3.AuthorityKeyIdentifier", Authority_Key_ID);
+ X509_EXTENSION("X509v3.ExtendedKeyUsage", Extended_Key_Usage);
+ X509_EXTENSION("X509v3.IssuerAlternativeName", Issuer_Alternative_Name);
+ X509_EXTENSION("X509v3.SubjectAlternativeName", Subject_Alternative_Name);
+ X509_EXTENSION("X509v3.CRLNumber", CRL_Number);
+ X509_EXTENSION("X509v3.CertificatePolicies", Certificate_Policies);
+
+ return 0;
+ }
+
+/*************************************************
* Extensions Copy Constructor *
*************************************************/
Extensions::Extensions(const Extensions& extensions) : ASN1_Object()
@@ -107,8 +127,7 @@ void Extensions::decode_from(BER_Decoder& from_source)
.verify_end()
.end_cons();
- Certificate_Extension* ext =
- global_state().x509_state().get_extension(oid);
+ Certificate_Extension* ext = get_extension(oid);
if(!ext)
{