From d26d6fa3559e61a0c1516f7edd2a717865e0d965 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 13 Dec 2013 20:58:06 +0000 Subject: [PATCH] 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 --- libretroshare/src/pgp/pgphandler.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/pgp/pgphandler.cc b/libretroshare/src/pgp/pgphandler.cc index 9e8f5af84..bfa5e4d77 100644 --- a/libretroshare/src/pgp/pgphandler.cc +++ b/libretroshare/src/pgp/pgphandler.cc @@ -963,10 +963,19 @@ bool PGPHandler::LoadCertificateFromString(const std::string& pgp_cert,PGPIdType return false ; } - // Check that the key is correctly self-signed. - // 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); if(!ops_validate_key_signatures(result,keydata,tmp_keyring,cb_get_passphrase))