diff options
| author | Jean-Paul Calderone <exarkun@divmod.com> | 2008-03-03 15:12:42 -0500 |
|---|---|---|
| committer | Jean-Paul Calderone <exarkun@divmod.com> | 2008-03-03 15:12:42 -0500 |
| commit | 7df40db7d8acac74f29fc34f501570faa0492e28 (patch) | |
| tree | 942f9ac684a1aa20780b4a4e0643476baa32c126 /src | |
| parent | 12ea9a095654e52a4d6d6de3f3caf21162f469d3 (diff) | |
| download | pyopenssl-7df40db7d8acac74f29fc34f501570faa0492e28.tar.gz | |
Apply patch from Victor Stinner
Diffstat (limited to 'src')
| -rw-r--r-- | src/crypto/crypto.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/crypto/crypto.c b/src/crypto/crypto.c index 4fed5ba..257b478 100644 --- a/src/crypto/crypto.c +++ b/src/crypto/crypto.c @@ -647,6 +647,26 @@ crypto_NetscapeSPKI(PyObject *spam, PyObject *args) return (PyObject *)crypto_NetscapeSPKI_New(spki, 1); } +static char crypto_X509_verify_cert_error_string_doc[] = "\n\ +Get X509 verify certificate error string.\n\ +\n\ +Arguments: errnum - Error number\n\ +Returns: Error string as a Python string\n\ +"; + +static PyObject * +crypto_X509_verify_cert_error_string(PyObject *spam, PyObject *args) +{ + int errnum; + const char *str; + + if (!PyArg_ParseTuple(args, "i", &errnum)) + return NULL; + + str = X509_verify_cert_error_string(errnum); + return PyString_FromString(str); +} + /* Methods in the OpenSSL.crypto module (i.e. none) */ static PyMethodDef crypto_methods[] = { /* Module functions */ @@ -665,6 +685,7 @@ static PyMethodDef crypto_methods[] = { { "PKey", (PyCFunction)crypto_PKey, METH_VARARGS, crypto_PKey_doc }, { "X509Extension", (PyCFunction)crypto_X509Extension, METH_VARARGS, crypto_X509Extension_doc }, { "NetscapeSPKI", (PyCFunction)crypto_NetscapeSPKI, METH_VARARGS, crypto_NetscapeSPKI_doc }, + { "X509_verify_cert_error_string", (PyCFunction)crypto_X509_verify_cert_error_string, METH_VARARGS, crypto_X509_verify_cert_error_string_doc }, { NULL, NULL } }; |
