Skip to content

Commit

Permalink
Added changing criticality of x509 extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
acasajus committed Jan 16, 2015
1 parent c82f441 commit e84a92f
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/crypto/x509ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,45 @@ crypto_X509Extension_get_critical( crypto_X509ExtensionObj * self,
PyInt_FromLong( X509_EXTENSION_get_critical( self->x509_extension ) );
}

static char crypto_X509Extension_set_critical_doc[] = "\n\
Sets critical field of the X509Extension\n\
\n\
Arguments: self - The X509Extension object\n\
args - The argument tuple, should be empty\n\
Returns: None.\n\
";

static PyObject *
crypto_X509Extension_set_critical( crypto_X509ExtensionObj * self,
PyObject * args )
{
if ( !PyArg_ParseTuple( args, ":set_critical" ) )
return NULL;

X509_EXTENSION_set_critical( self->x509_extension, 1 ) ;
Py_RETURN_NONE;
}

static char crypto_X509Extension_set_no_critical_doc[] = "\n\
Sets critical field to false of the X509Extension\n\
\n\
Arguments: self - The X509Extension object\n\
args - The argument tuple, should be empty\n\
Returns: None.\n\
";

static PyObject *
crypto_X509Extension_set_no_critical( crypto_X509ExtensionObj * self,
PyObject * args )
{
if ( !PyArg_ParseTuple( args, ":set_no_critical" ) )
return NULL;

X509_EXTENSION_set_critical( self->x509_extension, 0 ) ;
Py_RETURN_NONE;
}


static char crypto_X509Extension_get_value_doc[] = "\n\
Returns the value of the X509Extension\n\
\n\
Expand Down Expand Up @@ -200,6 +239,8 @@ crypto_X509Extension_get_ln( crypto_X509ExtensionObj * self, PyObject * args )
{ #name, (PyCFunction)crypto_X509Extension_##name, METH_VARARGS, crypto_X509Extension_##name##_doc }
static PyMethodDef crypto_X509Extension_methods[] = {
ADD_METHOD( get_critical ),
ADD_METHOD( set_critical ),
ADD_METHOD( set_no_critical ),
ADD_METHOD( get_value ),
ADD_METHOD( get_asn1_value ),
ADD_METHOD( get_raw_value ),
Expand Down

0 comments on commit e84a92f

Please sign in to comment.