mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
implemented deferred signature method in notify system to alow signing from a non GUI thread
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6175 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e397560654
commit
9b01e3658d
8 changed files with 119 additions and 1 deletions
|
@ -205,6 +205,8 @@ class NotifyBase
|
|||
|
||||
virtual bool askForPassword(const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */ ) { return false ;}
|
||||
virtual bool askForPluginConfirmation(const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) { return false ;}
|
||||
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result) { signature_result = false ;return true; }
|
||||
|
||||
};
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
|
|
|
@ -268,6 +268,7 @@ class RsPeers
|
|||
virtual bool getGPGAllList(std::list<std::string> &gpg_ids) = 0;
|
||||
virtual bool getGPGDetails(const std::string &gpg_id, RsPeerDetails &d) = 0;
|
||||
virtual bool getAssociatedSSLIds(const std::string &gpg_id, std::list<std::string> &ids) = 0;
|
||||
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) = 0;
|
||||
|
||||
/* Add/Remove Friends */
|
||||
virtual bool addFriend(const std::string &ssl_id, const std::string &gpg_id,ServicePermissionFlags flags = RS_SERVICE_PERM_ALL) = 0;
|
||||
|
|
|
@ -503,6 +503,10 @@ bool p3Peers::getAssociatedSSLIds(const std::string &gpg_id, std::list<std::stri
|
|||
return mPeerMgr->getAssociatedPeers(gpg_id, ids);
|
||||
}
|
||||
|
||||
bool p3Peers::gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen)
|
||||
{
|
||||
return AuthGPG::getAuthGPG()->SignDataBin(data,len,sign,signlen);
|
||||
}
|
||||
|
||||
bool p3Peers::getGPGDetails(const std::string &id, RsPeerDetails &d)
|
||||
{
|
||||
|
|
|
@ -70,6 +70,7 @@ virtual bool getGPGValidList(std::list<std::string> &ids);
|
|||
virtual bool getGPGAllList(std::list<std::string> &ids);
|
||||
virtual bool getGPGDetails(const std::string &id, RsPeerDetails &d);
|
||||
virtual bool getAssociatedSSLIds(const std::string &gpg_id, std::list<std::string> &ids);
|
||||
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) ;
|
||||
|
||||
/* Add/Remove Friends */
|
||||
virtual bool addFriend(const std::string &ssl_id, const std::string &gpg_id,ServicePermissionFlags flags = RS_SERVICE_PERM_ALL);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "services/p3idservice.h"
|
||||
#include "serialiser/rsgxsiditems.h"
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "util/rsrandom.h"
|
||||
#include "util/rsstring.h"
|
||||
|
||||
|
@ -48,6 +49,8 @@
|
|||
#define ID_REQUEST_REPUTATION 0x0003
|
||||
#define ID_REQUEST_OPINION 0x0004
|
||||
|
||||
#define ENABLE_PGP_SIGNATURES 1
|
||||
|
||||
RsIdentity *rsIdentity = NULL;
|
||||
|
||||
|
||||
|
@ -1340,7 +1343,9 @@ void p3IdService::service_CreateGroup(RsGxsGrpItem* grpItem, RsTlvSecurityKeySet
|
|||
#define MAX_SIGN_SIZE 2048
|
||||
uint8_t signarray[MAX_SIGN_SIZE];
|
||||
unsigned int sign_size = MAX_SIGN_SIZE;
|
||||
if (!AuthGPG::getAuthGPG()->SignDataBin((void *) hash.toByteArray(), hash.SIZE_IN_BYTES, signarray, &sign_size))
|
||||
int result ;
|
||||
|
||||
if (!rsicontrol->getNotify().askForDeferredSelfSignature((void *) hash.toByteArray(), hash.SIZE_IN_BYTES, signarray, &sign_size,result))
|
||||
{
|
||||
/* error */
|
||||
std::cerr << "p3IdService::service_CreateGroup() ERROR Signing stuff";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue