aboutsummaryrefslogtreecommitdiffstats
path: root/src/x509_ext.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-22 09:33:37 +0000
committerlloyd <[email protected]>2006-06-22 09:33:37 +0000
commit4fa62dc075426f8503f485cc1eeffc59ad95b2a3 (patch)
tree963b87db8b96c0db925ebdcef58dae1a5f12c9e5 /src/x509_ext.cpp
parentcd8504016b4f7ae75e8382743a695be1ed988b58 (diff)
Add operator= and a copy constructor to Extensions
Add a copy() function to Certificate_Policies Turn make_extension from an anonymous namespace function to a static private function of Extensions
Diffstat (limited to 'src/x509_ext.cpp')
-rw-r--r--src/x509_ext.cpp71
1 files changed, 40 insertions, 31 deletions
diff --git a/src/x509_ext.cpp b/src/x509_ext.cpp
index 09b636cb3..55c8405c0 100644
--- a/src/x509_ext.cpp
+++ b/src/x509_ext.cpp
@@ -15,37 +15,6 @@
namespace Botan {
-namespace {
-
-/*************************************************
-* Create a new certificate extension object *
-*************************************************/
-Certificate_Extension* make_extension(const OID& oid)
- {
- const std::string oid_name = OIDS::lookup(oid);
-
- if(oid_name == "X509v3.KeyUsage")
- return new Cert_Extension::Key_Usage();
- else if(oid_name == "X509v3.BasicConstraints")
- return new Cert_Extension::Basic_Constraints();
- else if(oid_name == "X509v3.SubjectKeyIdentifier")
- return new Cert_Extension::Subject_Key_ID();
- else if(oid_name == "X509v3.AuthorityKeyIdentifier")
- return new Cert_Extension::Authority_Key_ID();
- else if(oid_name == "X509v3.ExtendedKeyUsage")
- return new Cert_Extension::Extended_Key_Usage();
- else if(oid_name == "X509v3.CRLNumber")
- return new Cert_Extension::CRL_Number();
- else if(oid_name == "X509v3.CertificatePolicies")
- return 0;//return new Cert_Extension::Certificate_Policies();
-
- //printf("No result for %s\n", oid_name.c_str());
-
- return 0;
- }
-
-}
-
/*************************************************
* Return the OID of this extension *
*************************************************/
@@ -116,6 +85,21 @@ void Extensions::decode_from(BER_Decoder& from_source)
}
/*************************************************
+* Copy another extensions list *
+*************************************************/
+Extensions& Extensions::copy_this(const Extensions& other)
+ {
+ for(u32bit j = 0; j != extensions.size(); ++j)
+ delete extensions[j];
+ extensions.clear();
+
+ for(u32bit j = 0; j != other.extensions.size(); ++j)
+ extensions.push_back(other.extensions[j]->copy());
+
+ return (*this);
+ }
+
+/*************************************************
* Delete an Extensions list *
*************************************************/
Extensions::~Extensions()
@@ -124,6 +108,31 @@ Extensions::~Extensions()
delete extensions[j];
}
+/*************************************************
+* Create a new certificate extension object *
+*************************************************/
+Certificate_Extension* Extensions::make_extension(const OID& oid)
+ {
+ const std::string oid_name = OIDS::lookup(oid);
+
+ if(oid_name == "X509v3.KeyUsage")
+ return new Cert_Extension::Key_Usage();
+ else if(oid_name == "X509v3.BasicConstraints")
+ return new Cert_Extension::Basic_Constraints();
+ else if(oid_name == "X509v3.SubjectKeyIdentifier")
+ return new Cert_Extension::Subject_Key_ID();
+ else if(oid_name == "X509v3.AuthorityKeyIdentifier")
+ return new Cert_Extension::Authority_Key_ID();
+ else if(oid_name == "X509v3.ExtendedKeyUsage")
+ return new Cert_Extension::Extended_Key_Usage();
+ else if(oid_name == "X509v3.CRLNumber")
+ return new Cert_Extension::CRL_Number();
+ else if(oid_name == "X509v3.CertificatePolicies")
+ return new Cert_Extension::Certificate_Policies();
+
+ return 0;
+ }
+
namespace Cert_Extension {
/*************************************************