Merge pull request #459 from PhenomRetroShare/Add_CreateNewGXSIDInGenCertDialog

Add possibility to create GXSId directly on GenCertDialog.
This commit is contained in:
Cyril Soler 2016-08-09 10:35:01 +02:00 committed by GitHub
commit 32db2800c7
32 changed files with 521 additions and 487 deletions

View File

@ -55,7 +55,7 @@ bool RsControlModule::processShouldExit()
return mProcessShouldExit; return mProcessShouldExit;
} }
bool RsControlModule::askForPassword(const std::string &key_details, bool /* prev_is_bad */, std::string &password, bool& cancelled) bool RsControlModule::askForPassword(const std::string &title, const std::string &key_details, bool /* prev_is_bad */, std::string &password, bool& cancelled)
{ {
cancelled = false ; cancelled = false ;
{ {
@ -67,6 +67,7 @@ bool RsControlModule::askForPassword(const std::string &key_details, bool /* pre
} }
mWantPassword = true; mWantPassword = true;
mTitle = title;
mKeyName = key_details; mKeyName = key_details;
mPassword = ""; mPassword = "";
mStateTokenServer->replaceToken(mStateToken); mStateTokenServer->replaceToken(mStateToken);

View File

@ -32,7 +32,7 @@ public:
bool processShouldExit(); bool processShouldExit();
// from NotifyClient // from NotifyClient
virtual bool askForPassword(const std::string& key_details, bool prev_is_bad , std::string& password,bool& canceled); virtual bool askForPassword(const std::string &title, const std::string& key_details, bool prev_is_bad , std::string& password,bool& canceled);
protected: protected:
// from RsThread // from RsThread
@ -76,6 +76,7 @@ private:
// to notify that a password callback is waiting // to notify that a password callback is waiting
// to answer the request, clear the flag and set the password // to answer the request, clear the flag and set the password
bool mWantPassword; bool mWantPassword;
std::string mTitle;
std::string mKeyName; std::string mKeyName;
std::string mPassword; std::string mPassword;
// for ssl cert generation: // for ssl cert generation:

View File

@ -75,9 +75,9 @@ bool PgpAuxUtilsImpl::askForDeferredSelfSignature(const void *data,
const uint32_t len, const uint32_t len,
unsigned char *sign, unsigned char *sign,
unsigned int *signlen, unsigned int *signlen,
int& signature_result ) int& signature_result , std::string reason)
{ {
return RsServer::notify()->askForDeferredSelfSignature(data, len, sign, signlen, signature_result); return RsServer::notify()->askForDeferredSelfSignature(data, len, sign, signlen, signature_result, reason);
} }

View File

@ -43,7 +43,7 @@ class PgpAuxUtils
virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const =0; virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const =0;
virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint) = 0; virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint) = 0;
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result ) = 0; virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason) = 0;
}; };
class PgpAuxUtilsImpl: public PgpAuxUtils class PgpAuxUtilsImpl: public PgpAuxUtils
@ -58,7 +58,7 @@ public:
virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const; virtual bool getKeyFingerprint(const RsPgpId& id,PGPFingerprintType& fp) const;
virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint); virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint);
virtual bool getGPGAllList(std::list<RsPgpId> &ids); virtual bool getGPGAllList(std::list<RsPgpId> &ids);
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result ); virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason);
}; };

View File

@ -61,25 +61,25 @@ ops_parse_cb_return_t cb_get_passphrase(const ops_parser_content_t *content_,ops
{ {
case OPS_PARSER_CMD_GET_SK_PASSPHRASE_PREV_WAS_BAD: prev_was_bad = true ; case OPS_PARSER_CMD_GET_SK_PASSPHRASE_PREV_WAS_BAD: prev_was_bad = true ;
case OPS_PARSER_CMD_GET_SK_PASSPHRASE: case OPS_PARSER_CMD_GET_SK_PASSPHRASE:
{ {
std::string passwd; std::string passwd;
std::string uid_hint ; std::string uid_hint ;
if(cbinfo->cryptinfo.keydata->nuids > 0) if(cbinfo->cryptinfo.keydata->nuids > 0)
uid_hint = std::string((const char *)cbinfo->cryptinfo.keydata->uids[0].user_id) ; uid_hint = std::string((const char *)cbinfo->cryptinfo.keydata->uids[0].user_id) ;
uid_hint += "(" + RsPgpId(cbinfo->cryptinfo.keydata->key_id).toStdString()+")" ; uid_hint += "(" + RsPgpId(cbinfo->cryptinfo.keydata->key_id).toStdString()+")" ;
bool cancelled = false ; bool cancelled = false ;
passwd = PGPHandler::passphraseCallback()(NULL,uid_hint.c_str(),NULL,prev_was_bad,&cancelled) ; passwd = PGPHandler::passphraseCallback()(NULL,"",uid_hint.c_str(),NULL,prev_was_bad,&cancelled) ;
if(cancelled) if(cancelled)
*(unsigned char *)cbinfo->arg = 1; *(unsigned char *)cbinfo->arg = 1;
*(content->secret_key_passphrase.passphrase)= (char *)ops_mallocz(passwd.length()+1) ; *(content->secret_key_passphrase.passphrase)= (char *)ops_mallocz(passwd.length()+1) ;
memcpy(*(content->secret_key_passphrase.passphrase),passwd.c_str(),passwd.length()) ; memcpy(*(content->secret_key_passphrase.passphrase),passwd.c_str(),passwd.length()) ;
return OPS_KEEP_MEMORY; return OPS_KEEP_MEMORY;
} }
break; break;
default: default:
break; break;
@ -1326,7 +1326,7 @@ bool PGPHandler::decryptTextFromFile(const RsPgpId&,std::string& text,const std:
return (bool)res ; return (bool)res ;
} }
bool PGPHandler::SignDataBin(const RsPgpId& id,const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,bool use_raw_signature) bool PGPHandler::SignDataBin(const RsPgpId& id,const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,bool use_raw_signature, std::string reason /* = "" */)
{ {
RsStackMutex mtx(pgphandlerMtx) ; // lock access to PGP memory structures. RsStackMutex mtx(pgphandlerMtx) ; // lock access to PGP memory structures.
// need to find the key and to decrypt it. // need to find the key and to decrypt it.
@ -1357,7 +1357,7 @@ ops_secret_key_t *secret_key = NULL ;
for(int i=0;i<3;++i) for(int i=0;i<3;++i)
{ {
bool cancelled =false; bool cancelled =false;
std::string passphrase = _passphrase_callback(NULL,uid_hint.c_str(),"Please enter passwd for encrypting your key : ",last_passwd_was_wrong,&cancelled) ; std::string passphrase = _passphrase_callback(NULL,reason.c_str(),uid_hint.c_str(),"Please enter passwd for encrypting your key : ",last_passwd_was_wrong,&cancelled) ;//TODO reason
secret_key = ops_decrypt_secret_key_from_data(key,passphrase.c_str()) ; secret_key = ops_decrypt_secret_key_from_data(key,passphrase.c_str()) ;
@ -1448,8 +1448,8 @@ bool PGPHandler::privateSignCertificate(const RsPgpId& ownId,const RsPgpId& id_o
return false ; return false ;
} }
bool cancelled = false; bool cancelled = false;
std::string passphrase = _passphrase_callback(NULL,RsPgpId(skey->key_id).toStdString().c_str(),"Please enter passwd for encrypting your key : ",false,&cancelled) ; std::string passphrase = _passphrase_callback(NULL,"",RsPgpId(skey->key_id).toStdString().c_str(),"Please enter passwd for encrypting your key : ",false,&cancelled) ;
ops_secret_key_t *secret_key = ops_decrypt_secret_key_from_data(skey,passphrase.c_str()) ; ops_secret_key_t *secret_key = ops_decrypt_secret_key_from_data(skey,passphrase.c_str()) ;

View File

@ -16,7 +16,7 @@ extern "C" {
#include <openpgpsdk/keyring_local.h> #include <openpgpsdk/keyring_local.h>
} }
typedef std::string (*PassphraseCallback)(void *data, const char *uid_hint, const char *passphrase_info, int prev_was_bad,bool *cancelled) ; typedef std::string (*PassphraseCallback)(void *data, const char *uid_title, const char *uid_hint, const char *passphrase_info, int prev_was_bad,bool *cancelled) ;
class PGPCertificateInfo class PGPCertificateInfo
{ {
@ -85,8 +85,8 @@ class PGPHandler
std::string SaveCertificateToString(const RsPgpId& id,bool include_signatures) const ; std::string SaveCertificateToString(const RsPgpId& id,bool include_signatures) const ;
bool exportPublicKey(const RsPgpId& id,unsigned char *& mem,size_t& mem_size,bool armoured,bool include_signatures) const ; bool exportPublicKey(const RsPgpId& id,unsigned char *& mem,size_t& mem_size,bool armoured,bool include_signatures) const ;
bool parseSignature(unsigned char *sign, unsigned int signlen,RsPgpId& issuer_id) ; bool parseSignature(unsigned char *sign, unsigned int signlen,RsPgpId& issuer_id) ;
bool SignDataBin(const RsPgpId& id,const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,bool make_raw_signature=false) ; bool SignDataBin(const RsPgpId& id, const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, bool make_raw_signature=false, std::string reason = "") ;
bool VerifySignBin(const void *data, uint32_t data_len, unsigned char *sign, unsigned int sign_len, const PGPFingerprintType& withfingerprint) ; bool VerifySignBin(const void *data, uint32_t data_len, unsigned char *sign, unsigned int sign_len, const PGPFingerprintType& withfingerprint) ;
bool privateSignCertificate(const RsPgpId& own_id,const RsPgpId& id_of_key_to_sign) ; bool privateSignCertificate(const RsPgpId& own_id,const RsPgpId& id_of_key_to_sign) ;

View File

@ -86,14 +86,14 @@ bool AuthGPG::encryptTextToFile(const std::string& text,const std::string& outfi
// return PGPHandler::encryptTextToString(RsPgpId(pgp_id),text,outstr) ; // return PGPHandler::encryptTextToString(RsPgpId(pgp_id),text,outstr) ;
// } // }
std::string pgp_pwd_callback(void * /*hook*/, const char *uid_hint, const char * /*passphrase_info*/, int prev_was_bad,bool *cancelled) std::string pgp_pwd_callback(void * /*hook*/, const char *uid_title, const char *uid_hint, const char * /*passphrase_info*/, int prev_was_bad,bool *cancelled)
{ {
#define GPG_DEBUG2 #define GPG_DEBUG2
#ifdef GPG_DEBUG2 #ifdef GPG_DEBUG2
fprintf(stderr, "pgp_pwd_callback() called.\n"); fprintf(stderr, "pgp_pwd_callback() called.\n");
#endif #endif
std::string password; std::string password;
RsServer::notify()->askForPassword(uid_hint, prev_was_bad, password,cancelled) ; RsServer::notify()->askForPassword(uid_title, uid_hint, prev_was_bad, password,cancelled) ;
return password ; return password ;
} }
@ -296,9 +296,9 @@ void AuthGPG::processServices()
delete operation; delete operation;
} }
bool AuthGPG::DoOwnSignature(const void *data, unsigned int datalen, void *buf_sigout, unsigned int *outl) bool AuthGPG::DoOwnSignature(const void *data, unsigned int datalen, void *buf_sigout, unsigned int *outl, std::string reason /* = "" */)
{ {
return PGPHandler::SignDataBin(mOwnGpgId,data,datalen,(unsigned char *)buf_sigout,outl) ; return PGPHandler::SignDataBin(mOwnGpgId,data,datalen,(unsigned char *)buf_sigout,outl,false,reason) ;
} }
@ -605,9 +605,9 @@ bool AuthGPG::decryptDataBin(const void *data, unsigned int datalen, unsigned ch
{ {
return PGPHandler::decryptDataBin(mOwnGpgId,data,datalen,sign,signlen) ; return PGPHandler::decryptDataBin(mOwnGpgId,data,datalen,sign,signlen) ;
} }
bool AuthGPG::SignDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen) bool AuthGPG::SignDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen, std::string reason /*= ""*/)
{ {
return DoOwnSignature(data, datalen, sign, signlen); return DoOwnSignature(data, datalen, sign, signlen, reason);
} }
bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint) bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint)

View File

@ -208,7 +208,7 @@ class AuthGPG: public p3Config, public RsTickingThread, public PGPHandler
* There should also be Encryption Functions... (do later). * There should also be Encryption Functions... (do later).
* *
****/ ****/
virtual bool SignDataBin(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen); virtual bool SignDataBin(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason = "");
virtual bool VerifySignBin(const void*, uint32_t, unsigned char*, unsigned int, const PGPFingerprintType& withfingerprint); virtual bool VerifySignBin(const void*, uint32_t, unsigned char*, unsigned int, const PGPFingerprintType& withfingerprint);
virtual bool parseSignature(const void *sig, unsigned int siglen, RsPgpId& issuer_id); virtual bool parseSignature(const void *sig, unsigned int siglen, RsPgpId& issuer_id);
@ -254,7 +254,7 @@ class AuthGPG: public p3Config, public RsTickingThread, public PGPHandler
//void createDummyFriends(void); //NYI //void createDummyFriends(void); //NYI
/* Internal functions */ /* Internal functions */
bool DoOwnSignature(const void *, unsigned int, void *, unsigned int *); bool DoOwnSignature(const void *, unsigned int, void *, unsigned int *, std::string reason);
bool VerifySignature(const void *data, int datalen, const void *sig, unsigned int siglen, const PGPFingerprintType& withfingerprint); bool VerifySignature(const void *data, int datalen, const void *sig, unsigned int siglen, const PGPFingerprintType& withfingerprint);
/* Sign/Trust stuff */ /* Sign/Trust stuff */

View File

@ -850,7 +850,7 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
std::cerr << "Digest Applied: len: " << hashoutl << std::endl; std::cerr << "Digest Applied: len: " << hashoutl << std::endl;
/* NOW Sign via GPG Functions */ /* NOW Sign via GPG Functions */
if (!AuthGPG::getAuthGPG()->SignDataBin(buf_hashout, hashoutl, buf_sigout, (unsigned int *) &sigoutl)) if (!AuthGPG::getAuthGPG()->SignDataBin(buf_hashout, hashoutl, buf_sigout, (unsigned int *) &sigoutl,"AuthSSLimpl::SignX509ReqWithGPG()"))
{ {
sigoutl = 0; sigoutl = 0;
goto err; goto err;

View File

@ -245,10 +245,10 @@ void p3Notify::notifyDownloadComplete (const std::string& fileHash )
void p3Notify::notifyDownloadCompleteCount (uint32_t count ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadCompleteCount (count) ; } void p3Notify::notifyDownloadCompleteCount (uint32_t count ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadCompleteCount (count) ; }
void p3Notify::notifyHistoryChanged (uint32_t msgId , int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHistoryChanged (msgId,type) ; } void p3Notify::notifyHistoryChanged (uint32_t msgId , int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHistoryChanged (msgId,type) ; }
bool p3Notify::askForPassword (const std::string& key_details , bool prev_is_bad , std::string& password,bool *cancelled) bool p3Notify::askForPassword (const std::string& title , const std::string& key_details , bool prev_is_bad , std::string& password,bool *cancelled)
{ {
FOR_ALL_NOTIFY_CLIENTS FOR_ALL_NOTIFY_CLIENTS
if( (*it)->askForPassword(key_details,prev_is_bad,password,*cancelled)) if( (*it)->askForPassword(title,key_details,prev_is_bad,password,*cancelled))
return true ; return true ;
return false ; return false ;
@ -261,10 +261,10 @@ bool p3Notify::askForPluginConfirmation (const std::string& plugin_filen
return false ; return false ;
} }
bool p3Notify::askForDeferredSelfSignature (const void * data , const uint32_t len , unsigned char *sign, unsigned int *signlen,int& signature_result ) bool p3Notify::askForDeferredSelfSignature (const void * data , const uint32_t len , unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason /*=""*/)
{ {
FOR_ALL_NOTIFY_CLIENTS FOR_ALL_NOTIFY_CLIENTS
if( (*it)->askForDeferredSelfSignature(data,len,sign,signlen,signature_result)) if( (*it)->askForDeferredSelfSignature(data,len,sign,signlen,signature_result, reason))
return true ; return true ;
return false ; return false ;

View File

@ -116,12 +116,12 @@ class p3Notify: public RsNotify
void notifyPeerStatusChangedSummary () ; void notifyPeerStatusChangedSummary () ;
void notifyDiscInfoChanged () ; void notifyDiscInfoChanged () ;
bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) ; bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */, int& signature_result , std::string reason = "") ;
void notifyDownloadComplete (const std::string& /* fileHash */) ; void notifyDownloadComplete (const std::string& /* fileHash */) ;
void notifyDownloadCompleteCount (uint32_t /* count */) ; void notifyDownloadCompleteCount (uint32_t /* count */) ;
void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) ; void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) ;
bool askForPassword (const std::string& /* key_details */, bool /* prev_is_bad */, std::string&, bool *cancelled /* password */ ) ; bool askForPassword (const std::string& title, const std::string& /* key_details */, bool /* prev_is_bad */, std::string&, bool *cancelled /* password */ ) ;
bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) ; bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) ;
private: private:

View File

@ -62,6 +62,7 @@ extern RsIdentity *rsIdentity;
// Unicode symbols. NOT utf-8 bytes, because of multi byte characters // Unicode symbols. NOT utf-8 bytes, because of multi byte characters
#define RSID_MAXIMUM_NICKNAME_SIZE 30 #define RSID_MAXIMUM_NICKNAME_SIZE 30
#define RSID_MINIMUM_NICKNAME_SIZE 2
std::string rsIdTypeToString(uint32_t idtype); std::string rsIdTypeToString(uint32_t idtype);

View File

@ -229,12 +229,12 @@ class NotifyClient
virtual void notifyPeerStatusChangedSummary () {} virtual void notifyPeerStatusChangedSummary () {}
virtual void notifyDiscInfoChanged () {} virtual void notifyDiscInfoChanged () {}
virtual bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) { signature_result = false ;return true; } virtual bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result , std::string /*reason = ""*/) { signature_result = false ;return true; }
virtual void notifyDownloadComplete (const std::string& /* fileHash */) {} virtual void notifyDownloadComplete (const std::string& /* fileHash */) {}
virtual void notifyDownloadCompleteCount (uint32_t /* count */) {} virtual void notifyDownloadCompleteCount (uint32_t /* count */) {}
virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {} virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {}
virtual bool askForPassword (const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */,bool& /* cancelled */ ) { return false ;} virtual bool askForPassword (const std::string& /* title */, const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */,bool& /* cancelled */ ) { return false ;}
virtual bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) { return false ;} virtual bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) { return false ;}
}; };

View File

@ -352,7 +352,7 @@ public:
virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0; virtual bool getGPGValidList(std::list<RsPgpId> &gpg_ids) = 0;
virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0; virtual bool getGPGAllList(std::list<RsPgpId> &gpg_ids) = 0;
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0; virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId>& ids) = 0;
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) = 0; virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason = "") = 0;
/* Add/Remove Friends */ /* Add/Remove Friends */
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT) = 0; virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT) = 0;

View File

@ -635,9 +635,9 @@ bool p3Peers::getAssociatedSSLIds(const RsPgpId &gpg_id, std::list<RsPeerId> &id
return mPeerMgr->getAssociatedPeers(gpg_id, ids); return mPeerMgr->getAssociatedPeers(gpg_id, ids);
} }
bool p3Peers::gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) bool p3Peers::gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason /* = "" */)
{ {
return AuthGPG::getAuthGPG()->SignDataBin(data,len,sign,signlen); return AuthGPG::getAuthGPG()->SignDataBin(data,len,sign,signlen, reason);
} }
bool p3Peers::getGPGDetails(const RsPgpId &pgp_id, RsPeerDetails &d) bool p3Peers::getGPGDetails(const RsPgpId &pgp_id, RsPeerDetails &d)

View File

@ -70,7 +70,7 @@ public:
virtual bool getGPGAllList(std::list<RsPgpId> &ids); virtual bool getGPGAllList(std::list<RsPgpId> &ids);
virtual bool getGPGDetails(const RsPgpId &id, RsPeerDetails &d); virtual bool getGPGDetails(const RsPgpId &id, RsPeerDetails &d);
virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId> &ids); virtual bool getAssociatedSSLIds(const RsPgpId& gpg_id, std::list<RsPeerId> &ids);
virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) ; virtual bool gpgSignData(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, std::string reason = "") ;
/* Add/Remove Friends */ /* Add/Remove Friends */
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT); virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT);

View File

@ -2784,7 +2784,7 @@ RsGenExchange::ServiceCreate_Return p3IdService::service_CreateGroup(RsGxsGrpIte
memset(signarray,0,MAX_SIGN_SIZE) ; // just in case. memset(signarray,0,MAX_SIGN_SIZE) ; // just in case.
mPgpUtils->askForDeferredSelfSignature((void *) hash.toByteArray(), hash.SIZE_IN_BYTES, signarray, &sign_size,result) ; mPgpUtils->askForDeferredSelfSignature((void *) hash.toByteArray(), hash.SIZE_IN_BYTES, signarray, &sign_size,result, "p3IdService::service_CreateGroup()") ;
/* error */ /* error */
switch(result) switch(result)

View File

@ -19,21 +19,26 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include <rshare.h>
#include <util/rsrandom.h>
#include <retroshare/rsinit.h>
#include <rsserver/rsaccounts.h>
#include "gui/settings/rsharesettings.h"
#include "util/misc.h"
#include "GenCertDialog.h" #include "GenCertDialog.h"
#include <QAbstractEventDispatcher> #include <QAbstractEventDispatcher>
#include <QFileDialog> #include <QFileDialog>
#include <QGraphicsOpacityEffect> #include <QGraphicsOpacityEffect>
#include <QTimer>
#include <QMessageBox> #include <QMessageBox>
#include <QMouseEvent> #include <QMouseEvent>
#include <QTextBrowser> #include <QTextBrowser>
#include <QTimer>
#include <QProgressBar> #include <QProgressBar>
#include <rshare.h>
#include "gui/settings/rsharesettings.h"
#include "util/misc.h"
#include <retroshare/rsidentity.h>
#include <retroshare/rsinit.h>
#include <rsserver/rsaccounts.h>
#include <util/rsrandom.h>
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#include <iostream> #include <iostream>
@ -99,18 +104,18 @@ void GenCertDialog::grabMouse()
ui.entropy_bar->setValue(count*100/2048) ; ui.entropy_bar->setValue(count*100/2048) ;
if(ui.entropy_bar->value() < 20) if(ui.entropy_bar->value() < 20)
{ {
ui.genButton2->setEnabled(false) ; ui.genButton->setEnabled(false) ;
ui.genButton2->setIcon(QIcon(":/images/delete.png")) ; ui.genButton->setIcon(QIcon(":/images/delete.png")) ;
ui.genButton2->setToolTip(tr("Currently disabled. Please move your mouse around until you reach at least 20%")) ; ui.genButton->setToolTip(tr("Currently disabled. Please move your mouse around until you reach at least 20%")) ;
} }
else else
{ {
ui.genButton2->setEnabled(true) ; ui.genButton->setEnabled(true) ;
ui.genButton2->setIcon(QIcon(":/images/resume.png")) ; ui.genButton->setIcon(QIcon(":/images/resume.png")) ;
ui.genButton2->setToolTip(tr("Click to create your node and/or profile")) ; ui.genButton->setToolTip(tr("Click to create your node and/or profile")) ;
} }
RsInit::collectEntropy(E+(F << 16)) ; RsInit::collectEntropy(E+(F << 16)) ;
} }
@ -121,7 +126,9 @@ void GenCertDialog::grabMouse()
//} //}
/** Default constructor */ /** Default constructor */
GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent) GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mOnlyGenerateIdentity(onlyGenerateIdentity) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint)
, mOnlyGenerateIdentity(onlyGenerateIdentity)
, mGXSNickname("")
{ {
/* Invoke Qt Designer generated QObject setup routine */ /* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this); ui.setupUi(this);
@ -130,10 +137,10 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
ui.headerFrame->setHeaderText(tr("Create a new profile")); ui.headerFrame->setHeaderText(tr("Create a new profile"));
connect(ui.new_gpg_key_checkbox, SIGNAL(clicked()), this, SLOT(newGPGKeyGenUiSetup())); connect(ui.new_gpg_key_checkbox, SIGNAL(clicked()), this, SLOT(newGPGKeyGenUiSetup()));
connect(ui.adv_checkbox, SIGNAL(clicked()), this, SLOT(updateUiSetup())); connect(ui.adv_checkbox, SIGNAL(clicked()), this, SLOT(updateUiSetup()));
connect(ui.hidden_checkbox, SIGNAL(clicked()), this, SLOT(updateUiSetup())); connect(ui.hidden_checkbox, SIGNAL(clicked()), this, SLOT(updateUiSetup()));
connect(ui.genButton2, SIGNAL(clicked()), this, SLOT(genPerson())); connect(ui.genButton, SIGNAL(clicked()), this, SLOT(genPerson()));
connect(ui.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity())); connect(ui.importIdentity_PB, SIGNAL(clicked()), this, SLOT(importIdentity()));
connect(ui.exportIdentity_PB, SIGNAL(clicked()), this, SLOT(exportIdentity())); connect(ui.exportIdentity_PB, SIGNAL(clicked()), this, SLOT(exportIdentity()));
@ -162,17 +169,20 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
// make sure that QVariant always takes an 'int' otherwise the program will crash! // make sure that QVariant always takes an 'int' otherwise the program will crash!
ui.keylength_comboBox->addItem("default (2048 bits, recommended)", QVariant(2048)); ui.keylength_comboBox->addItem("default (2048 bits, recommended)", QVariant(2048));
ui.keylength_comboBox->addItem("high (3072 bits)", QVariant(3072)); ui.keylength_comboBox->addItem("high (3072 bits)", QVariant(3072));
ui.keylength_comboBox->addItem("insane (4096 bits)", QVariant(4096)); ui.keylength_comboBox->addItem("insane (4096 bits)", QVariant(4096));
#if QT_VERSION >= 0x040700 #if QT_VERSION >= 0x040700
ui.email_input->setPlaceholderText(tr("[Optional] Visible to your friends, and friends of friends.")) ; ui.email_input->setPlaceholderText(tr("[Optional] Visible to your friends, and friends of friends.")) ;
ui.node_input->setPlaceholderText(tr("[Required] Examples: Home, Laptop,...")) ; ui.node_input->setPlaceholderText(tr("[Required] Examples: Home, Laptop,...")) ;
ui.hiddenaddr_input->setPlaceholderText(tr("[Required] Tor/I2P address - Examples: xa76giaf6ifda7ri63i263.onion (obtained by you from Tor)")) ; ui.hiddenaddr_input->setPlaceholderText(tr("[Required] Tor/I2P address - Examples: xa76giaf6ifda7ri63i263.onion (obtained by you from Tor)")) ;
ui.name_input->setPlaceholderText(tr("[Required] Visible to your friends, and friends of friends.")); ui.name_input->setPlaceholderText(tr("[Required] Visible to your friends, and friends of friends."));
ui.nickname_input->setPlaceholderText(tr("[Optional] Used when you write in chat lobbies, forums and channel comments. Can be setup later if you need one."));
ui.password_input->setPlaceholderText(tr("[Required] This password protects your private PGP key.")); ui.password_input->setPlaceholderText(tr("[Required] This password protects your private PGP key."));
ui.password_input_2->setPlaceholderText(tr("[Required] Type the same password again here.")); ui.password_input_2->setPlaceholderText(tr("[Required] Type the same password again here."));
#endif #endif
ui.nickname_input->setMaxLength(RSID_MAXIMUM_NICKNAME_SIZE);
ui.node_input->setToolTip(tr("Enter a meaningful node description. e.g. : home, laptop, etc. \nThis field will be used to differentiate different installations with\nthe same profile (PGP key pair).")) ; ui.node_input->setToolTip(tr("Enter a meaningful node description. e.g. : home, laptop, etc. \nThis field will be used to differentiate different installations with\nthe same profile (PGP key pair).")) ;
ui.email_input->hide() ; ui.email_input->hide() ;
@ -223,7 +233,7 @@ void GenCertDialog::init()
ui.header_label->show(); ui.header_label->show();
ui.new_gpg_key_checkbox->setChecked(false); ui.new_gpg_key_checkbox->setChecked(false);
setWindowTitle(tr("Create new node")); setWindowTitle(tr("Create new node"));
ui.genButton2->setText(tr("Generate new node")); ui.genButton->setText(tr("Generate new node"));
ui.headerFrame->setHeaderText(tr("Create a new node")); ui.headerFrame->setHeaderText(tr("Create a new node"));
genNewGPGKey = false; genNewGPGKey = false;
} else { } else {
@ -232,7 +242,7 @@ void GenCertDialog::init()
ui.new_gpg_key_checkbox->setChecked(true); ui.new_gpg_key_checkbox->setChecked(true);
ui.new_gpg_key_checkbox->setEnabled(true); ui.new_gpg_key_checkbox->setEnabled(true);
setWindowTitle(tr("Create new profile")); setWindowTitle(tr("Create new profile"));
ui.genButton2->setText(tr("Generate new profile and node")); ui.genButton->setText(tr("Generate new profile and node"));
ui.headerFrame->setHeaderText(tr("Create a new profile and node")); ui.headerFrame->setHeaderText(tr("Create a new profile and node"));
genNewGPGKey = true; genNewGPGKey = true;
} }
@ -271,35 +281,45 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
if (ui.new_gpg_key_checkbox->isChecked()) { if (ui.new_gpg_key_checkbox->isChecked()) {
genNewGPGKey = true; genNewGPGKey = true;
setWindowTitle(tr("Create new profile"));
ui.headerFrame->setHeaderText(tr("Create a new profile and node"));
if (!mOnlyGenerateIdentity) {
ui.header_label->setVisible(haveGPGKeys);
}
ui.genprofileinfo_label->setVisible(false);
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
ui.importIdentity_PB->hide() ;
ui.exportIdentity_PB->hide();
ui.adv_checkbox->setVisible(true);
ui.genPGPuserlabel->hide();
ui.genPGPuser->hide();
ui.name_label->show(); ui.name_label->show();
ui.name_input->show(); ui.name_input->show();
ui.nickname_label->setVisible(!mOnlyGenerateIdentity);
ui.nickname_input->setVisible(!mOnlyGenerateIdentity);
ui.node_label->setVisible(true);
ui.node_input->setVisible(true);
// ui.email_label->show(); // ui.email_label->show();
// ui.email_input->show(); // ui.email_input->show();
ui.password_label->show(); ui.password_label->show();
ui.password_label_2->show(); ui.password_label_2->show();
ui.password_input->show(); ui.password_input->show();
ui.password_input_2->show(); ui.password_input_2->show();
ui.genPGPuserlabel->hide();
ui.genPGPuser->hide();
ui.importIdentity_PB->hide() ;
ui.exportIdentity_PB->hide();
setWindowTitle(tr("Create new profile"));
ui.genButton2->setText(tr("Generate new profile and node"));
ui.headerFrame->setHeaderText(tr("Create a new profile and node"));
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to create a profile and associate a node with it. To do so please fill out this form.\nAlternatively you can import a (previously exported) profile. Just uncheck \"Create a new profile\""));
ui.genButton2->setVisible(true);
ui.adv_checkbox->setVisible(true);
ui.node_label->setVisible(true);
ui.node_input->setVisible(true);
ui.entropy_label->setVisible(true);
ui.entropy_bar->setVisible(true);
ui.genprofileinfo_label->setVisible(false);
if (!mOnlyGenerateIdentity) {
ui.header_label->setVisible(haveGPGKeys);
}
//ui.keylength_label->show(); //ui.keylength_label->show();
//ui.keylength_comboBox->show(); //ui.keylength_comboBox->show();
ui.entropy_label->setVisible(true);
ui.entropy_bar->setVisible(true);
ui.genButton->setVisible(true);
ui.genButton->setText(tr("Generate new profile and node"));
} else { } else {
genNewGPGKey = false;
setWindowTitle(tr("Create new node"));
ui.headerFrame->setHeaderText(tr("Create a new node"));
ui.header_label->setVisible(false);
//haveGPGKeys = (ui.genPGPuser->count() != 0)?true:false; //haveGPGKeys = (ui.genPGPuser->count() != 0)?true:false;
if (haveGPGKeys) { if (haveGPGKeys) {
QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex()); QVariant data = ui.genPGPuser->itemData(ui.genPGPuser->currentIndex());
@ -310,37 +330,39 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
ui.genprofileinfo_label->show(); ui.genprofileinfo_label->show();
} }
} }
genNewGPGKey = false; //ui.genprofileinfo_label->show();
ui.name_label->hide(); ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to import a profile and after that associate a node with it."));
ui.name_input->hide();
// ui.email_label->hide();
// ui.email_input->hide();
ui.password_label->hide();
ui.password_label_2->hide();
ui.password_input->hide();
ui.password_input_2->hide();
ui.genPGPuserlabel->show();
ui.genPGPuser->show();
ui.importIdentity_PB->setVisible(!mOnlyGenerateIdentity); ui.importIdentity_PB->setVisible(!mOnlyGenerateIdentity);
ui.exportIdentity_PB->setVisible(haveGPGKeys); ui.exportIdentity_PB->setVisible(haveGPGKeys);
ui.exportIdentity_PB->setEnabled(haveGPGKeys); ui.exportIdentity_PB->setEnabled(haveGPGKeys);
setWindowTitle(tr("Create new node"));
ui.genButton2->setText(tr("Generate new node"));
ui.headerFrame->setHeaderText(tr("Create a new node"));
ui.no_gpg_key_label->setText(tr("Welcome to Retroshare. Before you can proceed you need to import a profile and after that associate a node with it."));
ui.genButton2->setVisible(haveGPGKeys);
ui.adv_checkbox->setVisible(haveGPGKeys); ui.adv_checkbox->setVisible(haveGPGKeys);
ui.adv_checkbox->setChecked(haveGPGKeys && adv_state); ui.adv_checkbox->setChecked(haveGPGKeys && adv_state);
ui.genPGPuser->setVisible(haveGPGKeys);
//ui.genPGPuserlabel->show();
//ui.genPGPuser->show();
ui.genPGPuserlabel->setVisible(haveGPGKeys); ui.genPGPuserlabel->setVisible(haveGPGKeys);
ui.genPGPuser->setVisible(haveGPGKeys);
ui.name_label->hide();
ui.name_input->hide();
ui.nickname_label->setVisible(!mOnlyGenerateIdentity && haveGPGKeys);
ui.nickname_input->setVisible(!mOnlyGenerateIdentity && haveGPGKeys);
ui.node_label->setVisible(haveGPGKeys); ui.node_label->setVisible(haveGPGKeys);
ui.node_input->setVisible(haveGPGKeys); ui.node_input->setVisible(haveGPGKeys);
ui.entropy_label->setVisible(haveGPGKeys); // ui.email_label->hide();
ui.entropy_bar->setVisible(haveGPGKeys); // ui.email_input->hide();
//ui.genprofileinfo_label->show(); ui.password_label->hide();
ui.header_label->setVisible(false); ui.password_input->hide();
ui.password_label_2->hide();
ui.password_input_2->hide();
ui.keylength_label->hide(); ui.keylength_label->hide();
ui.keylength_comboBox->hide(); ui.keylength_comboBox->hide();
ui.entropy_label->setVisible(haveGPGKeys);
ui.entropy_bar->setVisible(haveGPGKeys);
ui.genButton->setText(tr("Generate new node"));
ui.genButton->setVisible(haveGPGKeys);
} }
updateUiSetup(); updateUiSetup();
ui.adv_checkbox->setChecked(adv_state); ui.adv_checkbox->setChecked(adv_state);
@ -349,9 +371,9 @@ void GenCertDialog::newGPGKeyGenUiSetup() {
void GenCertDialog::updateUiSetup() void GenCertDialog::updateUiSetup()
{ {
if (ui.adv_checkbox->isChecked()) if (ui.adv_checkbox->isChecked())
{ {
ui.hidden_checkbox->show(); ui.hidden_checkbox->show();
if (ui.new_gpg_key_checkbox->isChecked()) if (ui.new_gpg_key_checkbox->isChecked())
{ {
@ -365,38 +387,38 @@ void GenCertDialog::updateUiSetup()
ui.keylength_comboBox->hide(); ui.keylength_comboBox->hide();
} }
if(ui.hidden_checkbox->isChecked()) if(ui.hidden_checkbox->isChecked())
{ {
ui.hiddenaddr_input->show(); ui.hiddenaddr_input->show();
ui.hiddenaddr_label->show(); ui.hiddenaddr_label->show();
ui.label_hiddenaddr2->show(); ui.label_hiddenaddr->show();
ui.hiddenport_label->show(); ui.hiddenport_label->show();
ui.hiddenport_spinBox->show(); ui.hiddenport_spinBox->show();
} }
else else
{ {
ui.hiddenaddr_input->hide(); ui.hiddenaddr_input->hide();
ui.hiddenaddr_label->hide(); ui.hiddenaddr_label->hide();
ui.label_hiddenaddr2->hide(); ui.label_hiddenaddr->hide();
ui.hiddenport_label->hide(); ui.hiddenport_label->hide();
ui.hiddenport_spinBox->hide(); ui.hiddenport_spinBox->hide();
} }
} }
else else
{ {
ui.hiddenaddr_input->hide(); ui.hiddenaddr_input->hide();
ui.hiddenaddr_label->hide(); ui.hiddenaddr_label->hide();
ui.label_hiddenaddr2->hide(); ui.label_hiddenaddr->hide();
ui.hiddenport_label->hide(); ui.hiddenport_label->hide();
ui.hiddenport_spinBox->hide(); ui.hiddenport_spinBox->hide();
ui.hidden_checkbox->hide(); ui.hidden_checkbox->hide();
ui.keylength_label->hide(); ui.keylength_label->hide();
ui.keylength_comboBox->hide(); ui.keylength_comboBox->hide();
if(ui.hidden_checkbox->isChecked()) if(ui.hidden_checkbox->isChecked())
ui.hidden_checkbox->setChecked(false) ; ui.hidden_checkbox->setChecked(false) ;
} }
} }
@ -418,9 +440,9 @@ void GenCertDialog::exportIdentity()
void GenCertDialog::importIdentity() void GenCertDialog::importIdentity()
{ {
QString fname ; QString fname ;
if(!misc::getOpenFileName(this,RshareSettings::LASTDIR_CERT,tr("Import profile"), tr("RetroShare profile files (*.asc);;All files (*)"),fname)) if(!misc::getOpenFileName(this,RshareSettings::LASTDIR_CERT,tr("Import profile"), tr("RetroShare profile files (*.asc);;All files (*)"),fname))
return ; return ;
if(fname.isNull()) if(fname.isNull())
return ; return ;
@ -453,7 +475,30 @@ void GenCertDialog::genPerson()
RsPgpId PGPId; RsPgpId PGPId;
bool isHiddenLoc = false; bool isHiddenLoc = false;
if (ui.hidden_checkbox->isChecked()) mGXSNickname = ui.nickname_input->text();
if (!mGXSNickname.isEmpty())
{
if (mGXSNickname.size() < RSID_MINIMUM_NICKNAME_SIZE)
{
std::cerr << "GenCertDialog::genPerson() GXS Nickname too short (min " << RSID_MINIMUM_NICKNAME_SIZE<< " chars)";
std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The GXS nickname is too short. Please input at least %1 characters.").arg(RSID_MINIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);
mGXSNickname = "";
return;
}
if (mGXSNickname.size() > RSID_MAXIMUM_NICKNAME_SIZE)
{
std::cerr << "GenCertDialog::genPerson() GXS Nickname too long (max " << RSID_MAXIMUM_NICKNAME_SIZE<< " chars)";
std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The GXS nickname is too long. Please reduce the length to %1 characters.").arg(RSID_MAXIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);
mGXSNickname = "";
return;
}
}
if (ui.hidden_checkbox->isChecked())
{ {
std::string hl = ui.hiddenaddr_input->text().toStdString(); std::string hl = ui.hiddenaddr_input->text().toStdString();
uint16_t port = ui.hiddenport_spinBox->value(); uint16_t port = ui.hiddenport_spinBox->value();
@ -515,6 +560,8 @@ void GenCertDialog::genPerson()
ui.new_gpg_key_checkbox->hide(); ui.new_gpg_key_checkbox->hide();
ui.name_label->hide(); ui.name_label->hide();
ui.name_input->hide(); ui.name_input->hide();
ui.nickname_label->hide();
ui.nickname_input->hide();
// ui.email_label->hide(); // ui.email_label->hide();
// ui.email_input->hide(); // ui.email_input->hide();
ui.password_label_2->hide(); ui.password_label_2->hide();
@ -525,12 +572,12 @@ void GenCertDialog::genPerson()
ui.genPGPuser->hide(); ui.genPGPuser->hide();
ui.node_label->hide(); ui.node_label->hide();
ui.node_input->hide(); ui.node_input->hide();
ui.genButton2->hide(); ui.genButton->hide();
ui.importIdentity_PB->hide(); ui.importIdentity_PB->hide();
ui.genprofileinfo_label->hide(); ui.genprofileinfo_label->hide();
ui.hidden_checkbox->hide(); ui.hidden_checkbox->hide();
ui.adv_checkbox->hide(); ui.adv_checkbox->hide();
ui.keylength_label->hide(); ui.keylength_label->hide();
ui.keylength_comboBox->hide(); ui.keylength_comboBox->hide();
setCursor(Qt::WaitCursor) ; setCursor(Qt::WaitCursor) ;
@ -569,6 +616,7 @@ void GenCertDialog::genPerson()
/* complete the process */ /* complete the process */
RsInit::LoadPassword(sslPasswd); RsInit::LoadPassword(sslPasswd);
if (Rshare::loadCertificate(sslId, false)) { if (Rshare::loadCertificate(sslId, false)) {
accept(); accept();
} }
} }

View File

@ -36,6 +36,7 @@ public:
virtual ~GenCertDialog() ; virtual ~GenCertDialog() ;
virtual void mouseMoveEvent(QMouseEvent *e) ; virtual void mouseMoveEvent(QMouseEvent *e) ;
QString getGXSNickname() {return mGXSNickname;}
private slots: private slots:
void genPerson(); void genPerson();
void importIdentity(); void importIdentity();
@ -53,6 +54,7 @@ private:
bool genNewGPGKey; bool genNewGPGKey;
bool haveGPGKeys; bool haveGPGKeys;
bool mOnlyGenerateIdentity; bool mOnlyGenerateIdentity;
QString mGXSNickname;
QTimer *entropy_timer ; QTimer *entropy_timer ;
}; };

View File

@ -17,7 +17,7 @@
<iconset resource="images.qrc"> <iconset resource="images.qrc">
<normaloff>:/images/logo/logo_48.png</normaloff>:/images/logo/logo_48.png</iconset> <normaloff>:/images/logo/logo_48.png</normaloff>:/images/logo/logo_48.png</iconset>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="GenCertDialogVLayout">
<item> <item>
<widget class="HeaderFrame" name="headerFrame"> <widget class="HeaderFrame" name="headerFrame">
<property name="sizePolicy"> <property name="sizePolicy">
@ -219,7 +219,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="toolBarHLayout">
<item> <item>
<widget class="QCheckBox" name="new_gpg_key_checkbox"> <widget class="QCheckBox" name="new_gpg_key_checkbox">
<property name="maximumSize"> <property name="maximumSize">
@ -305,7 +305,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_2"> <spacer name="toolBarHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -320,7 +320,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0"> <layout class="QHBoxLayout" name="advOptionHLayout" stretch="0,0">
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
@ -338,7 +338,7 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="hiddenNodeHSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -353,107 +353,184 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QGridLayout" name="profilGLayout">
<item> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QLabel" name="genPGPuserlabel">
<item> <property name="text">
<widget class="QLabel" name="genPGPuserlabel"> <string>Use profile</string>
<property name="minimumSize"> </property>
<size> </widget>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>Use profile</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="name_label">
<property name="minimumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="email_label">
<property name="text">
<string>Email</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="password_label">
<property name="toolTip">
<string>This password is for PGP</string>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="password_label_2">
<property name="toolTip">
<string>This password is for PGP</string>
</property>
<property name="text">
<string>Password (check)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="node_label">
<property name="text">
<string>Node</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="hiddenaddr_label">
<property name="text">
<string>hidden address</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2"> <widget class="QComboBox" name="genPGPuser">
<property name="toolTip">
<string>Your profile is associated with a PGP key pair. RetroShare currently ignores DSA keys.</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="name_label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="name_input">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Enter your nickname here</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="nickname_label">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Chatrooms/Forums Nickname</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="nickname_input">
<property name="toolTip">
<string>You can have one or more identities. They are used when you write in chat lobbies, forums and channel comments. They act as the destination for distant chat and the Retroshare distant mail system.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="email_label">
<property name="text">
<string>Email</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="email_input">
<property name="toolTip">
<string>Be careful: this email will be visible to your friends and friends
of your friends. This information is required by PGP, but to stay
anonymous, you can use a fake email.</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="password_label">
<property name="toolTip">
<string>This password is for PGP</string>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="password_input">
<property name="toolTip">
<string>Put a strong password here. This password protects your private PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="password_label_2">
<property name="toolTip">
<string>This password is for PGP</string>
</property>
<property name="text">
<string>Password (check)</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="password_input_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Put a strong password here. This password protects your private PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="node_label">
<property name="text">
<string>Node name</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="node_input">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="hiddenaddr_label">
<property name="text">
<string>hidden address</string>
</property>
</widget>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="hiddenInfoHLayout">
<property name="spacing">
<number>6</number>
</property>
<item> <item>
<widget class="QComboBox" name="genPGPuser"> <widget class="QLineEdit" name="hiddenaddr_input">
<property name="toolTip">
<string>Your profile is associated with a PGP key pair. RetroShare currently ignores DSA keys.</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="name_input">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -466,171 +543,55 @@ Alternatively you can use an existing profile. Just uncheck &quot;Create a new p
<height>32</height> <height>32</height>
</size> </size>
</property> </property>
<property name="toolTip">
<string>Enter your nickname here</string>
</property>
<property name="maxLength"> <property name="maxLength">
<number>64</number> <number>64</number>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="email_input"> <widget class="QLabel" name="hiddenport_label">
<property name="toolTip">
<string>Be careful: this email will be visible to your friends and friends
of your friends. This information is required by PGP, but to stay
anonymous, you can use a fake email.</string>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="password_input">
<property name="toolTip">
<string>Put a strong password here. This password protects your private PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="password_input_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Put a strong password here. This password protects your private PGP key.</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>1024</number>
</property>
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="node_input">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLineEdit" name="hiddenaddr_input">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>32</height>
</size>
</property>
<property name="maxLength">
<number>64</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="hiddenport_label">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="hiddenport_spinBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is your connection port.&lt;/p&gt;&lt;p&gt;Any value between 1024 and 65535 &lt;/p&gt;&lt;p&gt;should be ok. You can change it later.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>7812</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_hiddenaddr2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This can be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion &lt;br/&gt;or an I2P address in the form: [52 characters].b32.i2p &lt;/p&gt;&lt;p&gt;In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. If you do not yet have one, you can still go on, and make it right later in RetroShare's Options-&amp;gt;Network-&amp;gt;Hidden Service configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_1">
<item>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<widget class="QLabel" name="keylength_label">
<property name="minimumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>32</height>
</size>
</property>
<property name="text"> <property name="text">
<string>PGP key length</string> <string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="hiddenport_spinBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is your connection port.&lt;/p&gt;&lt;p&gt;Any value between 1024 and 65535 &lt;/p&gt;&lt;p&gt;should be ok. You can change it later.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>65535</number>
</property>
<property name="value">
<number>7812</number>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item row="8" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout_4"> <widget class="QLabel" name="label_hiddenaddr">
<item> <property name="text">
<widget class="QComboBox" name="keylength_comboBox"/> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This can be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion &lt;br/&gt;or an I2P address in the form: [52 characters].b32.i2p &lt;/p&gt;&lt;p&gt;In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. If you do not yet have one, you can still go on, and make it right later in RetroShare's Options-&amp;gt;Network-&amp;gt;Hidden Service configuration panel.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</item> </property>
</layout> <property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="keylength_label">
<property name="text">
<string>PGP key length</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QComboBox" name="keylength_comboBox"/>
</item> </item>
</layout> </layout>
</item> </item>
@ -722,7 +683,7 @@ anonymous, you can use a fake email.</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="genButton2"> <widget class="QPushButton" name="genButton">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
@ -748,7 +709,7 @@ anonymous, you can use a fake email.</string>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="mainVSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
@ -761,30 +722,37 @@ anonymous, you can use a fake email.</string>
</spacer> </spacer>
</item> </item>
</layout> </layout>
<zorder>no_node_label</zorder>
<zorder>genButton2</zorder>
<zorder>header_label</zorder>
<zorder>genprofileinfo_label</zorder>
<zorder>entropy_bar</zorder>
<zorder>entropy_label</zorder>
<zorder>headerFrame</zorder>
<zorder>no_gpg_key_label</zorder>
<zorder>verticalSpacer</zorder>
<zorder>label_hiddenaddr2</zorder>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
<customwidget> <customwidget>
<class>HeaderFrame</class> <class>HeaderFrame</class>
<extends>QFrame</extends> <extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header> <header>gui/common/HeaderFrame.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>StyledLabel</class>
<extends>QLabel</extends>
<header>gui/common/StyledLabel.h</header>
</customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>new_gpg_key_checkbox</tabstop>
<tabstop>importIdentity_PB</tabstop>
<tabstop>exportIdentity_PB</tabstop>
<tabstop>adv_checkbox</tabstop>
<tabstop>hidden_checkbox</tabstop>
<tabstop>genPGPuser</tabstop>
<tabstop>name_input</tabstop>
<tabstop>nickname_input</tabstop>
<tabstop>email_input</tabstop>
<tabstop>password_input</tabstop>
<tabstop>password_input_2</tabstop>
<tabstop>node_input</tabstop>
<tabstop>hiddenaddr_input</tabstop>
<tabstop>hiddenport_spinBox</tabstop>
<tabstop>genButton</tabstop>
</tabstops>
<resources> <resources>
<include location="images.qrc"/> <include location="images.qrc"/>
</resources> </resources>

View File

@ -505,17 +505,17 @@ void IdEditDialog::createId()
{ {
QString groupname = ui->lineEdit_Nickname->text(); QString groupname = ui->lineEdit_Nickname->text();
if (groupname.size() < 2) if (groupname.size() < RSID_MINIMUM_NICKNAME_SIZE)
{ {
std::cerr << "IdEditDialog::createId() Nickname too short"; std::cerr << "IdEditDialog::createId() Nickname too short (min " << RSID_MINIMUM_NICKNAME_SIZE << " chars)";
std::cerr << std::endl; std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The nickname is too short. Please input at least %1 characters.").arg(2), QMessageBox::Ok, QMessageBox::Ok); QMessageBox::warning(this, "", tr("The nickname is too short. Please input at least %1 characters.").arg(RSID_MINIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);
return; return;
} }
if (groupname.size() > RSID_MAXIMUM_NICKNAME_SIZE) if (groupname.size() > RSID_MAXIMUM_NICKNAME_SIZE)
{ {
std::cerr << "IdEditDialog::createId() Nickname too long (max " << RSID_MAXIMUM_NICKNAME_SIZE<< " chars)"; std::cerr << "IdEditDialog::createId() Nickname too long (max " << RSID_MAXIMUM_NICKNAME_SIZE << " chars)";
std::cerr << std::endl; std::cerr << std::endl;
QMessageBox::warning(this, "", tr("The nickname is too long. Please reduce the length to %1 characters.").arg(RSID_MAXIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok); QMessageBox::warning(this, "", tr("The nickname is too long. Please reduce the length to %1 characters.").arg(RSID_MAXIMUM_NICKNAME_SIZE), QMessageBox::Ok, QMessageBox::Ok);

View File

@ -148,7 +148,7 @@ void NotifyQt::notifyOwnAvatarChanged()
class SignatureEventData class SignatureEventData
{ {
public: public:
SignatureEventData(const void *_data,int32_t _len,unsigned int _signlen) SignatureEventData(const void *_data,int32_t _len,unsigned int _signlen, std::string _reason)
{ {
// We need a new memory chnk because there's no guarranty _sign nor _signlen are not in the stack // We need a new memory chnk because there's no guarranty _sign nor _signlen are not in the stack
@ -173,6 +173,7 @@ class SignatureEventData
} }
len = _len ; len = _len ;
memcpy(data,_data,len) ; memcpy(data,_data,len) ;
reason = _reason ;
} }
~SignatureEventData() ~SignatureEventData()
@ -184,7 +185,7 @@ class SignatureEventData
void performSignature() void performSignature()
{ {
if(rsPeers->gpgSignData(data,len,sign,signlen)) if(rsPeers->gpgSignData(data,len,sign,signlen,reason))
signature_result = SELF_SIGNATURE_RESULT_SUCCESS ; signature_result = SELF_SIGNATURE_RESULT_SUCCESS ;
else else
signature_result = SELF_SIGNATURE_RESULT_FAILED ; signature_result = SELF_SIGNATURE_RESULT_FAILED ;
@ -194,10 +195,11 @@ class SignatureEventData
uint32_t len ; uint32_t len ;
unsigned char *sign ; unsigned char *sign ;
unsigned int *signlen ; unsigned int *signlen ;
int signature_result ; // 0=pending, 1=done, 2=failed/cancelled. int signature_result ; // 0=pending, 1=done, 2=failed/cancelled.
std::string reason ;
}; };
bool NotifyQt::askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result) bool NotifyQt::askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason /*=""*/)
{ {
{ {
QMutexLocker m(&_mutex) ; QMutexLocker m(&_mutex) ;
@ -234,7 +236,7 @@ bool NotifyQt::askForDeferredSelfSignature(const void *data, const uint32_t len,
// //
std::cerr << "NotifyQt:: deferred signature event requeted. Pushing into queue" << std::endl; std::cerr << "NotifyQt:: deferred signature event requeted. Pushing into queue" << std::endl;
SignatureEventData *edta = new SignatureEventData(data,len,*signlen) ; SignatureEventData *edta = new SignatureEventData(data,len,*signlen, reason) ;
_deferred_signature_queue[chksum.toStdString()] = edta ; _deferred_signature_queue[chksum.toStdString()] = edta ;
} }
@ -261,12 +263,21 @@ void NotifyQt::handleSignatureEvent()
bool NotifyQt::askForPassword(const std::string& key_details, bool prev_is_bad, std::string& password,bool& cancelled) bool NotifyQt::askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password,bool& cancelled)
{ {
RsAutoUpdatePage::lockAllEvents() ; RsAutoUpdatePage::lockAllEvents() ;
QInputDialog dialog; QInputDialog dialog;
dialog.setWindowTitle(tr("PGP key passphrase")); if (title == "") {
dialog.setWindowTitle(tr("PGP key passphrase"));
} else if (title == "AuthSSLimpl::SignX509ReqWithGPG()") {
dialog.setWindowTitle(tr("You need to sign your node's certificate."));
} else if (title == "p3IdService::service_CreateGroup()") {
dialog.setWindowTitle(tr("You need to sign your forum/chatrooms identity."));
} else {
dialog.setWindowTitle(QString::fromStdString(title));
}
dialog.setLabelText((prev_is_bad ? QString("%1\n\n").arg(tr("Wrong password !")) : QString()) + QString("%1:\n %2").arg(tr("Please enter your PGP password for key"), QString::fromUtf8(key_details.c_str()))); dialog.setLabelText((prev_is_bad ? QString("%1\n\n").arg(tr("Wrong password !")) : QString()) + QString("%1:\n %2").arg(tr("Please enter your PGP password for key"), QString::fromUtf8(key_details.c_str())));
dialog.setTextEchoMode(QLineEdit::Password); dialog.setTextEchoMode(QLineEdit::Password);
dialog.setModal(true); dialog.setModal(true);

View File

@ -67,7 +67,7 @@ class NotifyQt: public QObject, public NotifyClient
virtual void notifyDiscInfoChanged() ; virtual void notifyDiscInfoChanged() ;
virtual void notifyDownloadComplete(const std::string& fileHash); virtual void notifyDownloadComplete(const std::string& fileHash);
virtual void notifyDownloadCompleteCount(uint32_t count); virtual void notifyDownloadCompleteCount(uint32_t count);
virtual bool askForPassword(const std::string& key_details, bool prev_is_bad, std::string& password, bool &cancelled); virtual bool askForPassword(const std::string& title, const std::string& key_details, bool prev_is_bad, std::string& password, bool &cancelled);
virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash); virtual bool askForPluginConfirmation(const std::string& plugin_filename, const std::string& plugin_file_hash);
// Queues the signature event so that it canhappen in the main GUI thread (to ask for passwd). // Queues the signature event so that it canhappen in the main GUI thread (to ask for passwd).
@ -82,7 +82,7 @@ class NotifyQt: public QObject, public NotifyClient
// 1: signature success // 1: signature success
// 2: signature failed. Wrong passwd, user pressed cancel, etc. // 2: signature failed. Wrong passwd, user pressed cancel, etc.
// //
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result) ; virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, int& signature_result, std::string reason = "") ;
/* Notify from GUI */ /* Notify from GUI */
void notifyChatFontChanged(); void notifyChatFontChanged();

View File

@ -28,7 +28,7 @@ GenCertDialog QLabel#genprofileinfo_label, QLabel#header_label, QLabel#entropy_l
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2); background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFFFD7, stop:1 #FFFFB2);
} }
GenCertDialog QLabel#label_hiddenaddr2 { GenCertDialog QLabel#label_hiddenaddr {
border: 1px solid #50FF5B; border: 1px solid #50FF5B;
border-radius: 6px; border-radius: 6px;
background: #CCFFCC; background: #CCFFCC;
@ -52,19 +52,6 @@ GenCertDialog > QFrame#frame {
border: 1px solid #CCCCCC; border: 1px solid #CCCCCC;
} }
GenCertDialog QPushButton#genButton {
border-image: url(:/images/btn_blue.png) 4;
border-width: 4;
padding: 0px 6px;
font-size: 14px;
font: bold;
color: white;
}
GenCertDialog QPushButton#genButton:hover {
border-image: url(:/images/btn_blue_hover.png) 4;
}
/* ConnectFriendWizard */ /* ConnectFriendWizard */
ConnectFriendWizard { ConnectFriendWizard {

View File

@ -22,29 +22,32 @@
#include <QObject> #include <QObject>
#include <QMessageBox> #include <QMessageBox>
#include <QSplashScreen> #include <QSplashScreen>
#include <rshare.h> #include <rshare.h>
#include "gui/MainWindow.h"
#include "gui/FriendsDialog.h" #include "gui/FriendsDialog.h"
#include "gui/GenCertDialog.h"
#include "gui/MainWindow.h"
#include "gui/MessengerWindow.h"
#include "gui/NetworkDialog.h"
#include "gui/NetworkView.h"
#include "gui/QuickStartWizard.h"
#include "gui/RetroShareLink.h"
#include "gui/SharedFilesDialog.h"
#include "gui/SoundManager.h"
#include "gui/StartDialog.h"
#include "gui/chat/ChatDialog.h"
#include "gui/connect/ConfCertDialog.h"
#include "gui/common/Emoticons.h"
#include "gui/FileTransfer/SearchDialog.h" #include "gui/FileTransfer/SearchDialog.h"
#include "gui/FileTransfer/TransfersDialog.h" #include "gui/FileTransfer/TransfersDialog.h"
#include "gui/SharedFilesDialog.h"
#include "gui/NetworkDialog.h"
#include "gui/chat/ChatDialog.h"
#include "gui/QuickStartWizard.h"
#include "gui/MessengerWindow.h"
#include "gui/StartDialog.h"
#include "gui/GenCertDialog.h"
#include "gui/settings/rsharesettings.h"
#include "gui/settings/RsharePeerSettings.h" #include "gui/settings/RsharePeerSettings.h"
#include "gui/connect/ConfCertDialog.h" #include "gui/settings/rsharesettings.h"
#include "gui/settings/WebuiPage.h"
#include "idle/idle.h" #include "idle/idle.h"
#include "gui/common/Emoticons.h"
#include "gui/RetroShareLink.h"
#include "gui/SoundManager.h"
#include "gui/NetworkView.h"
#include "lang/languagesupport.h" #include "lang/languagesupport.h"
#include "util/RsGxsUpdateBroadcast.h" #include "util/RsGxsUpdateBroadcast.h"
#include "gui/settings/WebuiPage.h"
#include "retroshare/rsidentity.h"
#ifdef SIGFPE_DEBUG #ifdef SIGFPE_DEBUG
#include <fenv.h> #include <fenv.h>
@ -250,6 +253,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
/* Start RetroShare */ /* Start RetroShare */
QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/); QSplashScreen splashScreen(QPixmap(":/images/logo/logo_splash.png")/* , Qt::WindowStaysOnTopHint*/);
QString sDefaultGXSIdToCreate = "";
switch (initResult) { switch (initResult) {
case RS_INIT_OK: case RS_INIT_OK:
{ {
@ -278,6 +282,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
if (gd.exec () == QDialog::Rejected) { if (gd.exec () == QDialog::Rejected) {
return 1; return 1;
} }
sDefaultGXSIdToCreate = gd.getGXSNickname();
} }
splashScreen.show(); splashScreen.show();
@ -356,6 +361,15 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
w->processLastArgs(); w->processLastArgs();
if (!sDefaultGXSIdToCreate.isEmpty()) {
RsIdentityParameters params;
params.nickname = sDefaultGXSIdToCreate.toUtf8().constData();
params.isPgpLinked = true;
params.mImage.clear();
uint32_t token = 0;
rsIdentity->createIdentity(token, params);
}
// I'm using a signal to transfer the hashing info to the mainwindow, because Qt schedules signals properly to // I'm using a signal to transfer the hashing info to the mainwindow, because Qt schedules signals properly to
// avoid clashes between infos from threads. // avoid clashes between infos from threads.
// //

View File

@ -101,9 +101,9 @@ bool NotifyTxt::askForPluginConfirmation(const std::string& plugin_file_name, co
return a == 'y' ; return a == 'y' ;
} }
bool NotifyTxt::askForPassword(const std::string& question, bool /* prev_is_bad */, std::string& password,bool& cancel) bool NotifyTxt::askForPassword(const std::string& title, const std::string& question, bool /* prev_is_bad */, std::string& password,bool& cancel)
{ {
std::string question1="Please enter your PGP password for key:\n " + question + " :"; std::string question1=title + "\nPlease enter your PGP password for key:\n " + question + " :";
char *passwd = getpass(question1.c_str()) ; char *passwd = getpass(question1.c_str()) ;
password = passwd; password = passwd;
cancel = false ; cancel = false ;

View File

@ -41,7 +41,7 @@ class NotifyTxt: public NotifyClient
virtual void notifyListChange(int list, int type); virtual void notifyListChange(int list, int type);
virtual void notifyErrorMsg(int list, int sev, std::string msg); virtual void notifyErrorMsg(int list, int sev, std::string msg);
virtual void notifyChat(); virtual void notifyChat();
virtual bool askForPassword(const std::string& question, bool prev_is_bad, std::string& password,bool& cancel); virtual bool askForPassword(const std::string& title, const std::string& question, bool prev_is_bad, std::string& password,bool& cancel);
virtual bool askForPluginConfirmation(const std::string& plugin_file, const std::string& plugin_hash); virtual bool askForPluginConfirmation(const std::string& plugin_file, const std::string& plugin_hash);
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files); virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);

View File

@ -442,7 +442,7 @@ void generatePasswordHash()
std::string passwd1,passwd2 ; std::string passwd1,passwd2 ;
bool cancel ; bool cancel ;
if(!NotifyTxt().askForPassword("Type your password (at least 8 chars) : ",false,passwd1,cancel)) exit(1) ; if(!NotifyTxt().askForPassword("","Type your password (at least 8 chars) : ",false,passwd1,cancel)) exit(1) ;
if(passwd1.length() < 8) if(passwd1.length() < 8)
{ {
@ -450,7 +450,7 @@ void generatePasswordHash()
exit(1); exit(1);
} }
if(!NotifyTxt().askForPassword("Type your password (checking) : ",false,passwd2,cancel)) exit(1) ; if(!NotifyTxt().askForPassword("","Type your password (checking) : ",false,passwd2,cancel)) exit(1) ;
if(passwd1 != passwd2) if(passwd1 != passwd2)
{ {

View File

@ -155,7 +155,8 @@ bool rs_nxs_test::RsDummyPgpUtils::askForDeferredSelfSignature(const void* /*dat
const uint32_t /*len*/, const uint32_t /*len*/,
unsigned char* /*sign*/, unsigned char* /*sign*/,
unsigned int* /*signlen*/, unsigned int* /*signlen*/,
int& /*signature_result*/ int& /*signature_result*/,
std::string /*reason*/
) { ) {
return true; return true;
} }

View File

@ -155,7 +155,7 @@ namespace rs_nxs_test
bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const; bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const;
bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint); bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint);
bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result ); bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, int& signature_result , std::string reason = "");
private: private:

View File

@ -106,7 +106,7 @@ bool FakePgpAuxUtils::getGPGAllList(std::list<RsPgpId> &ids)
return true; return true;
} }
bool FakePgpAuxUtils::askForDeferredSelfSignature(const void* /*data*/, const uint32_t /*len*/, unsigned char *sign, unsigned int *signlen,int& signature_result ) bool FakePgpAuxUtils::askForDeferredSelfSignature(const void* /*data*/, const uint32_t /*len*/, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string /*reason = ""*/ )
{ {
for(int i = 0; i < *signlen; i++) for(int i = 0; i < *signlen; i++)
{ {

View File

@ -38,7 +38,7 @@ public:
virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const; virtual bool parseSignature(unsigned char *sign, unsigned int signlen, RsPgpId& issuer) const;
virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint); virtual bool VerifySignBin(const void *data, uint32_t len, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint);
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result ); virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen, int& signature_result , std::string reason);
virtual void addPeerListToPgpList(const std::list<RsPeerId> &ids); virtual void addPeerListToPgpList(const std::list<RsPeerId> &ids);
virtual void addPeerIdToPgpList(const RsPeerId &id); virtual void addPeerIdToPgpList(const RsPeerId &id);