solve a bug with gpg private key validity unknown

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2202 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-02-05 21:00:36 +00:00
parent faa1e15db2
commit 6f9b8bb013

View File

@ -257,21 +257,30 @@ bool AuthGPG::availableGPGCertificatesWithPrivateKeys(std::list<std::string> &id
*/
int AuthGPG::GPGInit(std::string ownId)
{
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
std::cerr << "AuthGPG::GPGInit() called with own gpg id : " << ownId << std::endl;
{
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
std::cerr << "AuthGPG::GPGInit() called with own gpg id : " << ownId << std::endl;
if (!gpgmeInit) {
if (!gpgmeInit) {
return 0;
}
mOwnGpgId = ownId;
storeAllKeys_locked();
if (mOwnGpgCert.id != mOwnGpgId) {
std::cerr << "AuthGPG::GPGInit() failed to find your id." << std::endl;
return 0;
}
}
mOwnGpgId = ownId;
storeAllKeys_locked();
if (mOwnGpgCert.id != mOwnGpgId) {
std::cerr << "AuthGPG::GPGInit() failed to find your id." << std::endl;
return 0;
//check the validity of the private key. When set to unknown, it caused signature and text encryptions bugs
if (mOwnGpgCert.validLvl < 2) {
std::cerr << "AuthGPG::GPGInit() abnormal validity set to private key. Switch it to none by default." << std::endl;
privateTrustCertificate(mOwnGpgId, 2);
}
gpgmeKeySelected = true;
//printAllKeys_locked();