diff options
author | lloyd <[email protected]> | 2006-08-22 23:38:04 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-08-22 23:38:04 +0000 |
commit | 8dfd76eb99fd1c8a29096fe594c20b288edc8ac2 (patch) | |
tree | 63bb06a48cce3b48bfee163180d15381d46c8f95 /misc/python/src/x509.cpp | |
parent | ad2419f0168b9fe041da5c82941ef55181098646 (diff) |
Remove oid_lookup, since that is handled by X509_Certificate itself now.
Use a namespace alias so everything from Boost.Python appears in the
python namespace, to keep things a little cleaner/more explicit.
Diffstat (limited to 'misc/python/src/x509.cpp')
-rw-r--r-- | misc/python/src/x509.cpp | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/misc/python/src/x509.cpp b/misc/python/src/x509.cpp index 0107c6bf9..d2fb3c5e1 100644 --- a/misc/python/src/x509.cpp +++ b/misc/python/src/x509.cpp @@ -3,64 +3,49 @@ * (C) 2005-2006 Jack Lloyd <[email protected]> * *************************************************/ -#include <boost/python.hpp> -using namespace boost::python; - #include <botan/oids.h> #include <botan/x509_key.h> #include <botan/x509cert.h> using namespace Botan; -template<typename C> -list vector_to_list(const C& in) - { - list out; - typename C::const_iterator i = in.begin(); - while(i != in.end()) { out.append(*i); ++i; } - return out; - } +#include <boost/python.hpp> +namespace python = boost::python; template<typename C> -std::vector<std::string> oid_lookup(const C& in) +python::list vector_to_list(const C& in) { - std::vector<std::string> out; + python::list out; typename C::const_iterator i = in.begin(); - while(i != in.end()) - { - OID oid(*i); - std::string string_rep = OIDS::lookup(oid); - - out.push_back(OIDS::lookup(oid)); - ++i; - } + while(i != in.end()) { out.append(*i); ++i; } return out; } -list get_subject_info(const X509_Certificate* cert, +python::list get_subject_info(const X509_Certificate* cert, const std::string& type) { return vector_to_list(cert->subject_info(type)); } -list get_issuer_info(const X509_Certificate* cert, +python::list get_issuer_info(const X509_Certificate* cert, const std::string& type) { return vector_to_list(cert->issuer_info(type)); } -list get_policies(const X509_Certificate* cert) +python::list get_policies(const X509_Certificate* cert) { return vector_to_list(cert->policies()); } -list get_ex_constraints(const X509_Certificate* cert) +python::list get_ex_constraints(const X509_Certificate* cert) { - return vector_to_list(oid_lookup(cert->ex_constraints())); + return vector_to_list(cert->ex_constraints()); } void export_x509() { - class_<X509_Certificate>("X509_Certificate", init<std::string>()) + python::class_<X509_Certificate> + ("X509_Certificate", python::init<std::string>()) .add_property("version", &X509_Certificate::x509_version) .add_property("is_CA", &X509_Certificate::is_CA_cert) .add_property("self_signed", &X509_Certificate::is_self_signed) |