mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-10 06:15:50 -05:00
- Added a drop-down item to allow removing unused keys, in the Network dialog.
- added key removal method in OpenPGP-SDK - improved FriendSelectionDialog/Widget to enable select all/none keys, and show non friend keys - added safe key removal method in PGPHandler. Removed keys from other locations will not cause errors. - added backup system to public keyring, impossibility to remove public parts of owned secret keys, etc. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6382 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
02890c737a
commit
0266329dc8
17 changed files with 314 additions and 81 deletions
|
|
@ -156,6 +156,7 @@ void ops_keydata_copy(ops_keydata_t *dst,const ops_keydata_t *src)
|
|||
{
|
||||
unsigned n;
|
||||
|
||||
keydata_internal_free(dst) ;
|
||||
memset(dst,0,sizeof(ops_keydata_t)) ;
|
||||
|
||||
dst->uids = (ops_user_id_t*)ops_mallocz(src->nuids * sizeof(ops_user_id_t)) ;
|
||||
|
|
@ -863,6 +864,29 @@ void ops_keyring_free(ops_keyring_t *keyring)
|
|||
keyring->nkeys_allocated=0;
|
||||
}
|
||||
|
||||
void ops_keyring_remove_key(ops_keyring_t *keyring,int index)
|
||||
{
|
||||
if(index > keyring->nkeys-1)
|
||||
{
|
||||
fprintf(stderr,"ops_keyring_remove_key: ERROR: cannot remove key with index %d > %d.",index,keyring->nkeys-1) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if(index < keyring->nkeys-1)
|
||||
ops_keydata_copy(&keyring->keys[index],&keyring->keys[keyring->nkeys-1]) ;
|
||||
|
||||
keydata_internal_free(&keyring->keys[keyring->nkeys-1]) ;
|
||||
|
||||
if(NULL == realloc(keyring->keys,(keyring->nkeys-1)*sizeof(ops_keydata_t)) )
|
||||
{
|
||||
fprintf(stderr,"ops_keyring_remove_key: ERROR: cannot re-alloc keyring memory.") ;
|
||||
return ;
|
||||
}
|
||||
|
||||
keyring->nkeys-- ;
|
||||
keyring->nkeys_allocated-- ;
|
||||
}
|
||||
|
||||
/**
|
||||
\ingroup HighLevel_KeyringFind
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ unsigned ops_get_user_id_count(const ops_keydata_t *key);
|
|||
const unsigned char* ops_get_user_id(const ops_keydata_t *key, unsigned index);
|
||||
ops_boolean_t ops_is_key_supported(const ops_keydata_t *key);
|
||||
const ops_keydata_t* ops_keyring_get_key_by_index(const ops_keyring_t *keyring, int index);
|
||||
void ops_keyring_remove_key(ops_keyring_t *keyring,int index) ;
|
||||
|
||||
ops_user_id_t* ops_add_userid_to_keydata(ops_keydata_t* keydata, const ops_user_id_t* userid);
|
||||
ops_packet_t* ops_add_packet_to_keydata(ops_keydata_t* keydata, const ops_packet_t* packet);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue