fixed import of retroshare identities that have multiple signatures from the same key ID. Fixed bug reported by claude37

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6927 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-12-07 13:46:00 +00:00
parent 214375ede1
commit 68138fc1c8
2 changed files with 14 additions and 1 deletions

View File

@ -835,7 +835,18 @@ bool PGPHandler::importGPGKeyPair(const std::string& filename,PGPIdType& importe
ops_validate_key_signatures(result, const_cast<ops_keydata_t*>(pubkey), &dummy_keyring, cb_get_passphrase) ;
if(result->valid_count != 1 || memcmp((unsigned char*)result->valid_sigs[0].signer_id,pubkey->key_id,KEY_ID_SIZE))
// Check that signatures contain at least one certification from the user id.
//
bool found = false ;
for(uint32_t i=0;i<result->valid_count;++i)
if(!memcmp((unsigned char*)result->valid_sigs[i].signer_id,pubkey->key_id,KEY_ID_SIZE))
{
found = true ;
break ;
}
if(!found)
{
import_error = "Cannot validate self signature for the imported key. Sorry." ;
return false ;

View File

@ -42,6 +42,8 @@ int main(int argc,char *argv[])
bool res = handler.importGPGKeyPair(idfile,imported_key_id,import_error_string) ;
handler.syncDatabase() ;
if(!res)
std::cerr << "Identity Import error: " << import_error_string << std::endl;