~myers-1/pyopenssl/npn

« back to all changes in this revision

Viewing changes to OpenSSL/crypto/x509ext.c

  • Committer: Jean-Paul Calderone
  • Date: 2011-04-07 02:19:52 UTC
  • mfrom: (142.1.13 subjectAltName)
  • Revision ID: exarkun@divmod.com-20110407021952-c464twfn6f3j0uvf
Add more access to certificate extension data

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
}
52
52
 
53
53
 
 
54
static char crypto_X509Extension_get_data_doc[] = "\n\
 
55
Returns the data of the X509Extension\n\
 
56
\n\
 
57
@return: A C{str} giving the X509Extension's ASN.1 encoded data.\n\
 
58
";
 
59
 
 
60
static PyObject *
 
61
crypto_X509Extension_get_data(crypto_X509ExtensionObj *self, PyObject *args) {
 
62
    ASN1_OCTET_STRING *data;
 
63
    PyObject *result;
 
64
 
 
65
    if (!PyArg_ParseTuple(args, ":get_data")) {
 
66
        return NULL;
 
67
    }
 
68
 
 
69
    data = X509_EXTENSION_get_data(self->x509_extension);
 
70
    result = PyBytes_FromStringAndSize((const char*)data->data, data->length);
 
71
    return result;
 
72
}
 
73
 
54
74
/*
55
75
 * ADD_METHOD(name) expands to a correct PyMethodDef declaration
56
76
 *   {  'name', (PyCFunction)crypto_X509Extension_name, METH_VARARGS }
62
82
{
63
83
    ADD_METHOD(get_critical),
64
84
    ADD_METHOD(get_short_name),
 
85
    ADD_METHOD(get_data),
65
86
    { NULL, NULL }
66
87
};
67
88
#undef ADD_METHOD