def __init__(self, x509=None, _pyfree=0): if x509 is not None: assert m2.x509_type_check(x509), "'x509' type error" self.x509 = x509 self._pyfree = _pyfree else: self.x509 = m2.x509_new() self._pyfree = 1
def m2_x509_from_ct_ptr(ct_x509): # generate and immeidately free an X509 object so that we can get a # reference to the underlying SwigPyObject m2_x509 = m2.x509_new() m2.x509_free(m2_x509) # even though we've free'd we still have the ref # replace the pointer change_swig_ptr(m2_x509, ct_x509) # return a new M2 X509 object (that references our ctypes X509 obj) return X509.X509(m2_x509)
def __init__(self, x509=None, _pyfree=0): # type: (Optional[bytes], int) -> None """ :param x509: binary representation of the underlying OpenSSL X509 object. :param _pyfree: """ if x509 is not None: assert m2.x509_type_check(x509), "'x509' type error" self.x509 = x509 self._pyfree = _pyfree else: self.x509 = m2.x509_new() self._pyfree = 1