#NEWLINE# def new_extension( name , value , critical = 0 , issuer = None , _pyfree = 1 ) : #NEWLINE# #INDENT# '\n    Create new X509_Extension instance.\n    ' #NEWLINE# if ( ( name == 'subjectKeyIdentifier' ) and ( value . strip ( '0123456789abcdefABCDEF:' ) is not '' ) ) : #NEWLINE# #INDENT# raise ValueError ( 'value must be precomputed hash' ) #NEWLINE# #UNINDENT# lhash = m2 . x509v3_lhash ( ) #NEWLINE# ctx = m2 . x509v3_set_conf_lhash ( lhash ) #NEWLINE# fix_ctx ( x509_ext , issuer ) #NEWLINE# x509_ext_ptr = m2 . x509v3_ext_conf ( lhash , ctx , name , value ) #NEWLINE# if ( x509_ext_ptr is None ) : #NEWLINE# #INDENT# raise Exception #NEWLINE# #UNINDENT# x509_ext = X509 . X509_Extension ( x509_ext_ptr , _pyfree ) #NEWLINE# x509_ext . set_critical ( critical ) #NEWLINE# return x509_ext