mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 23:19:29 -05:00
Add Title when ask for password.
This commit is contained in:
parent
6edd7bb8e3
commit
275c47eff9
@ -55,7 +55,7 @@ bool RsControlModule::processShouldExit()
|
||||
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 ;
|
||||
{
|
||||
@ -67,6 +67,7 @@ bool RsControlModule::askForPassword(const std::string &key_details, bool /* pre
|
||||
}
|
||||
|
||||
mWantPassword = true;
|
||||
mTitle = title;
|
||||
mKeyName = key_details;
|
||||
mPassword = "";
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
bool processShouldExit();
|
||||
|
||||
// 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:
|
||||
// from RsThread
|
||||
@ -76,6 +76,7 @@ private:
|
||||
// to notify that a password callback is waiting
|
||||
// to answer the request, clear the flag and set the password
|
||||
bool mWantPassword;
|
||||
std::string mTitle;
|
||||
std::string mKeyName;
|
||||
std::string mPassword;
|
||||
// for ssl cert generation:
|
||||
|
@ -71,13 +71,13 @@ bool PgpAuxUtilsImpl::parseSignature(unsigned char *sign, unsigned int signlen,
|
||||
return AuthGPG::getAuthGPG()->parseSignature(sign,signlen,issuer);
|
||||
}
|
||||
|
||||
bool PgpAuxUtilsImpl::askForDeferredSelfSignature(const void *data,
|
||||
const uint32_t len,
|
||||
unsigned char *sign,
|
||||
bool PgpAuxUtilsImpl::askForDeferredSelfSignature(const void *data,
|
||||
const uint32_t len,
|
||||
unsigned char *sign,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ class PgpAuxUtils
|
||||
|
||||
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 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
|
||||
@ -58,7 +58,7 @@ public:
|
||||
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 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);
|
||||
|
||||
};
|
||||
|
||||
|
@ -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:
|
||||
{
|
||||
std::string passwd;
|
||||
std::string uid_hint ;
|
||||
|
||||
if(cbinfo->cryptinfo.keydata->nuids > 0)
|
||||
uid_hint = std::string((const char *)cbinfo->cryptinfo.keydata->uids[0].user_id) ;
|
||||
uid_hint += "(" + RsPgpId(cbinfo->cryptinfo.keydata->key_id).toStdString()+")" ;
|
||||
{
|
||||
std::string passwd;
|
||||
std::string uid_hint ;
|
||||
|
||||
bool cancelled = false ;
|
||||
passwd = PGPHandler::passphraseCallback()(NULL,uid_hint.c_str(),NULL,prev_was_bad,&cancelled) ;
|
||||
if(cbinfo->cryptinfo.keydata->nuids > 0)
|
||||
uid_hint = std::string((const char *)cbinfo->cryptinfo.keydata->uids[0].user_id) ;
|
||||
uid_hint += "(" + RsPgpId(cbinfo->cryptinfo.keydata->key_id).toStdString()+")" ;
|
||||
|
||||
if(cancelled)
|
||||
*(unsigned char *)cbinfo->arg = 1;
|
||||
bool cancelled = false ;
|
||||
passwd = PGPHandler::passphraseCallback()(NULL,"",uid_hint.c_str(),NULL,prev_was_bad,&cancelled) ;
|
||||
|
||||
*(content->secret_key_passphrase.passphrase)= (char *)ops_mallocz(passwd.length()+1) ;
|
||||
memcpy(*(content->secret_key_passphrase.passphrase),passwd.c_str(),passwd.length()) ;
|
||||
return OPS_KEEP_MEMORY;
|
||||
}
|
||||
break;
|
||||
if(cancelled)
|
||||
*(unsigned char *)cbinfo->arg = 1;
|
||||
|
||||
*(content->secret_key_passphrase.passphrase)= (char *)ops_mallocz(passwd.length()+1) ;
|
||||
memcpy(*(content->secret_key_passphrase.passphrase),passwd.c_str(),passwd.length()) ;
|
||||
return OPS_KEEP_MEMORY;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -1326,7 +1326,7 @@ bool PGPHandler::decryptTextFromFile(const RsPgpId&,std::string& text,const std:
|
||||
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.
|
||||
// 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)
|
||||
{
|
||||
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()) ;
|
||||
|
||||
@ -1448,8 +1448,8 @@ bool PGPHandler::privateSignCertificate(const RsPgpId& ownId,const RsPgpId& id_o
|
||||
return 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) ;
|
||||
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) ;
|
||||
|
||||
ops_secret_key_t *secret_key = ops_decrypt_secret_key_from_data(skey,passphrase.c_str()) ;
|
||||
|
||||
|
@ -16,7 +16,7 @@ extern "C" {
|
||||
#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
|
||||
{
|
||||
@ -85,8 +85,8 @@ class PGPHandler
|
||||
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 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 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, std::string reason = "") ;
|
||||
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) ;
|
||||
|
||||
|
@ -86,14 +86,14 @@ bool AuthGPG::encryptTextToFile(const std::string& text,const std::string& outfi
|
||||
// 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
|
||||
#ifdef GPG_DEBUG2
|
||||
fprintf(stderr, "pgp_pwd_callback() called.\n");
|
||||
#endif
|
||||
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 ;
|
||||
}
|
||||
@ -296,9 +296,9 @@ void AuthGPG::processServices()
|
||||
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) ;
|
||||
}
|
||||
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)
|
||||
|
@ -208,7 +208,7 @@ class AuthGPG: public p3Config, public RsTickingThread, public PGPHandler
|
||||
* 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 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
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Sign/Trust stuff */
|
||||
|
@ -850,7 +850,7 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
|
||||
std::cerr << "Digest Applied: len: " << hashoutl << std::endl;
|
||||
|
||||
/* 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;
|
||||
goto err;
|
||||
|
@ -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::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
|
||||
if( (*it)->askForPassword(key_details,prev_is_bad,password,*cancelled))
|
||||
if( (*it)->askForPassword(title,key_details,prev_is_bad,password,*cancelled))
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
@ -261,10 +261,10 @@ bool p3Notify::askForPluginConfirmation (const std::string& plugin_filen
|
||||
|
||||
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
|
||||
if( (*it)->askForDeferredSelfSignature(data,len,sign,signlen,signature_result))
|
||||
if( (*it)->askForDeferredSelfSignature(data,len,sign,signlen,signature_result, reason))
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
|
@ -116,12 +116,12 @@ class p3Notify: public RsNotify
|
||||
void notifyPeerStatusChangedSummary () ;
|
||||
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 notifyDownloadCompleteCount (uint32_t /* count */) ;
|
||||
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 */) ;
|
||||
|
||||
private:
|
||||
|
@ -229,12 +229,12 @@ class NotifyClient
|
||||
virtual void notifyPeerStatusChangedSummary () {}
|
||||
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 notifyDownloadCompleteCount (uint32_t /* count */) {}
|
||||
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 ;}
|
||||
|
||||
};
|
||||
|
@ -352,7 +352,7 @@ public:
|
||||
virtual bool getGPGValidList(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 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 */
|
||||
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT) = 0;
|
||||
|
@ -635,9 +635,9 @@ bool p3Peers::getAssociatedSSLIds(const RsPgpId &gpg_id, std::list<RsPeerId> &id
|
||||
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)
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
virtual bool getGPGAllList(std::list<RsPgpId> &ids);
|
||||
virtual bool getGPGDetails(const RsPgpId &id, RsPeerDetails &d);
|
||||
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 */
|
||||
virtual bool addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePermissionFlags flags = RS_NODE_PERM_DEFAULT);
|
||||
|
@ -2784,7 +2784,7 @@ RsGenExchange::ServiceCreate_Return p3IdService::service_CreateGroup(RsGxsGrpIte
|
||||
|
||||
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 */
|
||||
switch(result)
|
||||
|
@ -176,7 +176,7 @@ GenCertDialog::GenCertDialog(bool onlyGenerateIdentity, QWidget *parent)
|
||||
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.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."));
|
||||
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_2->setPlaceholderText(tr("[Required] Type the same password again here."));
|
||||
#endif
|
||||
|
@ -406,10 +406,10 @@ Alternatively you can use an existing profile. Just uncheck "Create a new p
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="nickname_label">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>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.</p></body></html></string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>GXS Nickname</string>
|
||||
<string>Chatrooms/Forums Nickname</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -500,7 +500,7 @@ anonymous, you can use a fake email.</string>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="node_label">
|
||||
<property name="text">
|
||||
<string>Node</string>
|
||||
<string>Node name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -724,17 +724,17 @@ anonymous, you can use a fake email.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>HeaderFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>gui/common/HeaderFrame.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>new_gpg_key_checkbox</tabstop>
|
||||
|
@ -148,7 +148,7 @@ void NotifyQt::notifyOwnAvatarChanged()
|
||||
class SignatureEventData
|
||||
{
|
||||
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
|
||||
|
||||
@ -173,6 +173,7 @@ class SignatureEventData
|
||||
}
|
||||
len = _len ;
|
||||
memcpy(data,_data,len) ;
|
||||
reason = _reason ;
|
||||
}
|
||||
|
||||
~SignatureEventData()
|
||||
@ -184,7 +185,7 @@ class SignatureEventData
|
||||
|
||||
void performSignature()
|
||||
{
|
||||
if(rsPeers->gpgSignData(data,len,sign,signlen))
|
||||
if(rsPeers->gpgSignData(data,len,sign,signlen,reason))
|
||||
signature_result = SELF_SIGNATURE_RESULT_SUCCESS ;
|
||||
else
|
||||
signature_result = SELF_SIGNATURE_RESULT_FAILED ;
|
||||
@ -194,10 +195,11 @@ class SignatureEventData
|
||||
uint32_t len ;
|
||||
unsigned char *sign ;
|
||||
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) ;
|
||||
@ -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;
|
||||
|
||||
SignatureEventData *edta = new SignatureEventData(data,len,*signlen) ;
|
||||
SignatureEventData *edta = new SignatureEventData(data,len,*signlen, reason) ;
|
||||
|
||||
_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() ;
|
||||
|
||||
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.setTextEchoMode(QLineEdit::Password);
|
||||
dialog.setModal(true);
|
||||
|
@ -67,7 +67,7 @@ class NotifyQt: public QObject, public NotifyClient
|
||||
virtual void notifyDiscInfoChanged() ;
|
||||
virtual void notifyDownloadComplete(const std::string& fileHash);
|
||||
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);
|
||||
|
||||
// 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
|
||||
// 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 */
|
||||
void notifyChatFontChanged();
|
||||
|
@ -101,9 +101,9 @@ bool NotifyTxt::askForPluginConfirmation(const std::string& plugin_file_name, co
|
||||
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()) ;
|
||||
password = passwd;
|
||||
cancel = false ;
|
||||
|
@ -41,7 +41,7 @@ class NotifyTxt: public NotifyClient
|
||||
virtual void notifyListChange(int list, int type);
|
||||
virtual void notifyErrorMsg(int list, int sev, std::string msg);
|
||||
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 void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
|
||||
|
@ -442,7 +442,7 @@ void generatePasswordHash()
|
||||
std::string passwd1,passwd2 ;
|
||||
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)
|
||||
{
|
||||
@ -450,7 +450,7 @@ void generatePasswordHash()
|
||||
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)
|
||||
{
|
||||
|
@ -155,7 +155,8 @@ bool rs_nxs_test::RsDummyPgpUtils::askForDeferredSelfSignature(const void* /*dat
|
||||
const uint32_t /*len*/,
|
||||
unsigned char* /*sign*/,
|
||||
unsigned int* /*signlen*/,
|
||||
int& /*signature_result*/
|
||||
int& /*signature_result*/,
|
||||
std::string /*reason*/
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ namespace rs_nxs_test
|
||||
|
||||
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 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:
|
||||
|
@ -106,7 +106,7 @@ bool FakePgpAuxUtils::getGPGAllList(std::list<RsPgpId> &ids)
|
||||
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++)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
|
||||
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 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 addPeerIdToPgpList(const RsPeerId &id);
|
||||
|
Loading…
Reference in New Issue
Block a user