def load_publickey(type, buffer):
 if isinstance(buffer, _text_type):
  buffer = buffer.encode('ascii')
 bio = _new_mem_buf(buffer)
 if (type == FILETYPE_PEM):
  evp_pkey = _lib.PEM_read_bio_PUBKEY(bio, _ffi.NULL, _ffi.NULL, _ffi.NULL)
 elif (type == FILETYPE_ASN1):
  evp_pkey = _lib.d2i_PUBKEY_bio(bio, _ffi.NULL)
 else:
  raise ValueError('type argument must be FILETYPE_PEM or FILETYPE_ASN1')
 if (evp_pkey == _ffi.NULL):
  _raise_current_error()
 pkey = PKey.__new__(PKey)
 pkey._pkey = _ffi.gc(evp_pkey, _lib.EVP_PKEY_free)
 pkey._only_public = True
 return pkey

def load_publickey ( type , buffer ) : if isinstance ( buffer , _text_type ) : buffer = buffer . encode ( 'ascii' ) bio = _new_mem_buf ( buffer ) if ( type == FILETYPE_PEM ) : evp_pkey = _lib . PEM_read_bio_PUBKEY ( bio , _ffi . NULL , _ffi . NULL , _ffi . NULL ) elif ( type == FILETYPE_ASN1 ) : evp_pkey = _lib . d2i_PUBKEY_bio ( bio , _ffi . NULL ) else : raise ValueError ( 'type argument must be FILETYPE_PEM or FILETYPE_ASN1' ) if ( evp_pkey == _ffi . NULL ) : _raise_current_error ( ) pkey = PKey . __new__ ( PKey ) pkey . _pkey = _ffi . gc ( evp_pkey , _lib . EVP_PKEY_free ) pkey . _only_public = True return pkey
load a public key from a buffer .