def list_secret_keys(user=None, gnupghome=None):
 _keys = []
 for _key in _list_keys(user, gnupghome, secret=True):
  tmp = {'keyid': _key['keyid'], 'fingerprint': _key['fingerprint'], 'uids': _key['uids']}
  expires = _key.get('expires', None)
  date = _key.get('date', None)
  length = _key.get('length', None)
  owner_trust = _key.get('ownertrust', None)
  trust = _key.get('trust', 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']
  if owner_trust:
   tmp['ownerTrust'] = LETTER_TRUST_DICT[_key['ownertrust']]
  if trust:
   tmp['trust'] = LETTER_TRUST_DICT[_key['trust']]
  _keys.append(tmp)
 return _keys

def list_secret_keys ( user = None , gnupghome = None ) : _keys = [ ] for _key in _list_keys ( user , gnupghome , secret = True ) : tmp = { 'keyid' : _key [ 'keyid' ] , 'fingerprint' : _key [ 'fingerprint' ] , 'uids' : _key [ 'uids' ] } expires = _key . get ( 'expires' , None ) date = _key . get ( 'date' , None ) length = _key . get ( 'length' , None ) owner_trust = _key . get ( 'ownertrust' , None ) trust = _key . get ( 'trust' , 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' ] if owner_trust : tmp [ 'ownerTrust' ] = LETTER_TRUST_DICT [ _key [ 'ownertrust' ] ] if trust : tmp [ 'trust' ] = LETTER_TRUST_DICT [ _key [ 'trust' ] ] _keys . append ( tmp ) return _keys
list secret keys in gpg keychain user which users keychain to access .