def load_certificate(type, buffer):
 if isinstance(buffer, _text_type):
  buffer = buffer.encode('ascii')
 bio = _new_mem_buf(buffer)
 if (type == FILETYPE_PEM):
  x509 = _lib.PEM_read_bio_X509(bio, _ffi.NULL, _ffi.NULL, _ffi.NULL)
 elif (type == FILETYPE_ASN1):
  x509 = _lib.d2i_X509_bio(bio, _ffi.NULL)
 else:
  raise ValueError('type argument must be FILETYPE_PEM or FILETYPE_ASN1')
 if (x509 == _ffi.NULL):
  _raise_current_error()
 cert = X509.__new__(X509)
 cert._x509 = _ffi.gc(x509, _lib.X509_free)
 return cert

def load_certificate ( type , buffer ) : if isinstance ( buffer , _text_type ) : buffer = buffer . encode ( 'ascii' ) bio = _new_mem_buf ( buffer ) if ( type == FILETYPE_PEM ) : x509 = _lib . PEM_read_bio_X509 ( bio , _ffi . NULL , _ffi . NULL , _ffi . NULL ) elif ( type == FILETYPE_ASN1 ) : x509 = _lib . d2i_X509_bio ( bio , _ffi . NULL ) else : raise ValueError ( 'type argument must be FILETYPE_PEM or FILETYPE_ASN1' ) if ( x509 == _ffi . NULL ) : _raise_current_error ( ) cert = X509 . __new__ ( X509 ) cert . _x509 = _ffi . gc ( x509 , _lib . X509_free ) return cert
load public and secret key from a zmq certificate .