aboutsummaryrefslogtreecommitdiff
path: root/pow
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-05-30 02:33:42 +0000
committerRob Austein <sra@hactrn.net>2009-05-30 02:33:42 +0000
commitb43bce9291e2461dc74fed15068d78551c787e77 (patch)
tree582b83a851ac0aa010032a4e1e4786d207cee6b1 /pow
parent084b35e4c0a27331095b223fb89d8bed626ac0c1 (diff)
Ssl.trustCertificate()
svn path=/pow/POW-0.7/POW.c; revision=2474
Diffstat (limited to 'pow')
-rw-r--r--pow/POW-0.7/POW.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/pow/POW-0.7/POW.c b/pow/POW-0.7/POW.c
index 8e0ee39c..02043183 100644
--- a/pow/POW-0.7/POW.c
+++ b/pow/POW-0.7/POW.c
@@ -3953,6 +3953,26 @@ ssl_object_add_certificate(ssl_object *self, PyObject *args)
return NULL;
}
+static PyObject *
+ssl_object_trust_certificate(ssl_object *self, PyObject *args)
+{
+ x509_object *x509 = NULL;
+
+ if (!PyArg_ParseTuple(args, "O!", &x509type, &x509))
+ goto error;
+
+ if (self->ctxset)
+ lose("cannot be called after setFd()");
+
+ X509_STORE_add_cert(SSL_CTX_get_cert_store(self->ctx), x509->x509);
+
+ return Py_BuildValue("");
+
+ error:
+
+ return NULL;
+}
+
static char ssl_object_use_key__doc__[] =
"<method>\n"
" <header>\n"
@@ -4716,6 +4736,7 @@ ssl_object_set_verify_mode(ssl_object *self, PyObject *args)
static struct PyMethodDef ssl_object_methods[] = {
{"useCertificate", (PyCFunction)ssl_object_use_certificate, METH_VARARGS, NULL},
{"addCertificate", (PyCFunction)ssl_object_add_certificate, METH_VARARGS, NULL},
+ {"trustCertificate", (PyCFunction)ssl_object_trust_certificate,METH_VARARGS, NULL},
{"useKey", (PyCFunction)ssl_object_use_key, METH_VARARGS, NULL},
{"checkKey", (PyCFunction)ssl_object_check_key, METH_VARARGS, NULL},
{"setFd", (PyCFunction)ssl_object_set_fd, METH_VARARGS, NULL},