def search_keys(text, keyserver=None, user=None):
 if GPG_1_3_1:
  raise SaltInvocationError('The search_keys function is not support with this version of python-gnupg.')
 else:
  if (not keyserver):
   keyserver = 'pgp.mit.edu'
  _keys = []
  for _key in _search_keys(text, keyserver, user):
   tmp = {'keyid': _key['keyid'], 'uids': _key['uids']}
   expires = _key.get('expires', None)
   date = _key.get('date', None)
   length = _key.get('length', None)
   if expires:
    tmp['expires'] = time.strftime('%Y-%m-%d', time.localtime(float(_key['expires'])))
   if date:
    tmp['created'] = time.strftime('%Y-%m-%d', time.localtime(float(_key['date'])))
   if length:
    tmp['keyLength'] = _key['length']
   _keys.append(tmp)
  return _keys

def search_keys ( text , keyserver = None , user = None ) : if GPG_1_3_1 : raise SaltInvocationError ( 'The search_keys function is not support with this version of python-gnupg.' ) else : if ( not keyserver ) : keyserver = 'pgp.mit.edu' _keys = [ ] for _key in _search_keys ( text , keyserver , user ) : tmp = { 'keyid' : _key [ 'keyid' ] , 'uids' : _key [ 'uids' ] } expires = _key . get ( 'expires' , None ) date = _key . get ( 'date' , None ) length = _key . get ( 'length' , None ) if expires : tmp [ 'expires' ] = time . strftime ( '%Y-%m-%d' , time . localtime ( float ( _key [ 'expires' ] ) ) ) if date : tmp [ 'created' ] = time . strftime ( '%Y-%m-%d' , time . localtime ( float ( _key [ 'date' ] ) ) ) if length : tmp [ 'keyLength' ] = _key [ 'length' ] _keys . append ( tmp ) return _keys
search keys from keyserver text text to search the keyserver for .