added check to only import version 4 keys in the keyring

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6945 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-12-13 20:58:06 +00:00
parent 3add068cdd
commit d26d6fa355

View File

@ -963,10 +963,19 @@ bool PGPHandler::LoadCertificateFromString(const std::string& pgp_cert,PGPIdType
return false ; return false ;
} }
// Check that the key is correctly self-signed.
//
const ops_keydata_t *keydata = ops_keyring_get_key_by_index(tmp_keyring,0); const ops_keydata_t *keydata = ops_keyring_get_key_by_index(tmp_keyring,0);
// Check that the key is a version 4 key
//
if(keydata->key.pkey.version != 4)
{
error_string = "Public key is not version 4. Rejected!" ;
std::cerr << "Received a key with unhandled version number (" << keydata->key.pkey.version << ")" << std::endl;
return false ;
}
// Check that the key is correctly self-signed.
//
ops_validate_result_t* result=(ops_validate_result_t*)ops_mallocz(sizeof *result); ops_validate_result_t* result=(ops_validate_result_t*)ops_mallocz(sizeof *result);
if(!ops_validate_key_signatures(result,keydata,tmp_keyring,cb_get_passphrase)) if(!ops_validate_key_signatures(result,keydata,tmp_keyring,cb_get_passphrase))