mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-21 04:44:25 -04:00
Fixed default data rates to sensible options: 200 kB/s down, 50 kB/s up.
Added StoreAllKeys() call after adding new GPG Certificate. Added Check for successful Req creation (was crashing with NULL pointer). Switched std::vector.data => &(std::vector[0]) to remove linuxism in radix64. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4851 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e6816c9d6f
commit
00ff694e10
4 changed files with 44 additions and 30 deletions
|
@ -1117,33 +1117,37 @@ bool AuthGPGimpl::active()
|
|||
return ((gpgmeInit) && (gpgmeKeySelected));
|
||||
}
|
||||
|
||||
bool AuthGPGimpl::GeneratePGPCertificate(std::string name, std::string email, std::string passwd, std::string &pgpId, std::string &/*errString*/) {
|
||||
|
||||
RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
|
||||
|
||||
gpgme_key_t newKey;
|
||||
gpgme_genkey_result_t result;
|
||||
gpg_error_t ERR;
|
||||
|
||||
cleanupZombies(2); // cleanup zombies under OSX. (Called before gpgme operation)
|
||||
|
||||
if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_genkey(CTX, setKeyPairParams(true, 2048, name, "generated by Retroshare", email, \
|
||||
passwd).c_str(), NULL, NULL))) {
|
||||
std::cerr << "Error generating the key" << std::endl;
|
||||
std::cerr << ProcessPGPmeError(ERR) << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((result = gpgme_op_genkey_result(CTX)) == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
if(GPG_ERR_NO_ERROR != (ERR = gpgme_get_key(CTX, result->fpr, &newKey, 1))) {
|
||||
std::cerr << "Error reading own key" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
pgpId = newKey->subkeys->keyid;
|
||||
|
||||
bool AuthGPGimpl::GeneratePGPCertificate(std::string name, std::string email, std::string passwd, std::string &pgpId, std::string &/*errString*/)
|
||||
{
|
||||
{
|
||||
RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
|
||||
|
||||
gpgme_key_t newKey;
|
||||
gpgme_genkey_result_t result;
|
||||
gpg_error_t ERR;
|
||||
|
||||
cleanupZombies(2); // cleanup zombies under OSX. (Called before gpgme operation)
|
||||
|
||||
if(GPG_ERR_NO_ERROR != (ERR = gpgme_op_genkey(CTX, setKeyPairParams(true, 2048, name, "generated by Retroshare", email, \
|
||||
passwd).c_str(), NULL, NULL))) {
|
||||
std::cerr << "Error generating the key" << std::endl;
|
||||
std::cerr << ProcessPGPmeError(ERR) << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if((result = gpgme_op_genkey_result(CTX)) == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
if(GPG_ERR_NO_ERROR != (ERR = gpgme_get_key(CTX, result->fpr, &newKey, 1))) {
|
||||
std::cerr << "Error reading own key" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
pgpId = newKey->subkeys->keyid;
|
||||
}
|
||||
|
||||
// reload keys - so yours is now there.
|
||||
storeAllKeys();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue