From 8345451124649f3983a0d9a53e3efb82bd14e8f4 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 22 Apr 2008 06:13:32 +0000 Subject: CMS.eContentType() svn path=/pow/POW-0.7/POW.c; revision=1689 --- pow/POW-0.7/POW.c | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'pow/POW-0.7/POW.c') diff --git a/pow/POW-0.7/POW.c b/pow/POW-0.7/POW.c index 1b3af645..d612ce84 100644 --- a/pow/POW-0.7/POW.c +++ b/pow/POW-0.7/POW.c @@ -6903,12 +6903,46 @@ error: return NULL; } +static char CMS_object_eContentType__doc__[] = +"\n" +"
\n" +" CMS\n" +" get_eContentType\n" +"
\n" +" \n" +" \n" +" This method returns the eContentType of a CMS message.\n" +" \n" +" \n" +"
\n" +; + +static PyObject * +CMS_object_eContentType(cms_object *self, PyObject *args) +{ + const ASN1_OBJECT *oid = NULL; + char buf[512]; + + if (!PyArg_ParseTuple(args, "")) + return NULL; + + if ( !(oid = CMS_get0_eContentType(self->cms))) { + set_openssl_pyerror("Could not extract eContentType from CMS message"); + return NULL; + } + + OBJ_obj2txt(buf, sizeof(buf), oid, 1); + + return Py_BuildValue("s", buf); +} + static struct PyMethodDef CMS_object_methods[] = { - {"pemWrite", (PyCFunction)CMS_object_pem_write, METH_VARARGS, NULL}, - {"derWrite", (PyCFunction)CMS_object_der_write, METH_VARARGS, NULL}, - {"sign", (PyCFunction)CMS_object_sign, METH_VARARGS, NULL}, - {"verify", (PyCFunction)CMS_object_verify, METH_VARARGS, NULL}, + {"pemWrite", (PyCFunction)CMS_object_pem_write, METH_VARARGS, NULL}, + {"derWrite", (PyCFunction)CMS_object_der_write, METH_VARARGS, NULL}, + {"sign", (PyCFunction)CMS_object_sign, METH_VARARGS, NULL}, + {"verify", (PyCFunction)CMS_object_verify, METH_VARARGS, NULL}, + {"eContentType", (PyCFunction)CMS_object_eContentType, METH_VARARGS, NULL}, {NULL, NULL} /* sentinel */ }; @@ -7971,6 +8005,7 @@ pow_module_docset(PyObject *self, PyObject *args) docset_helper_add( docset, CMS_object_der_write__doc__ ); docset_helper_add( docset, CMS_object_sign__doc__ ); docset_helper_add( docset, CMS_object_verify__doc__ ); + docset_helper_add( docset, CMS_object_eContentType__doc__ ); // symmetric documentation docset_helper_add( docset, symmetrictype__doc__ ); -- cgit v1.2.3