add the clean cert routine for gpg certs

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2090 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-19 21:44:59 +00:00
parent 868e60af06
commit c0acb71136
3 changed files with 22 additions and 3 deletions

View File

@ -30,6 +30,7 @@
#include <sstream>
#include <algorithm>
#include "serialiser/rsconfigitems.h"
#include "cleanupxpgp.h"
// initialisation du pointeur de singleton à zéro
@ -1201,8 +1202,12 @@ bool AuthGPG::LoadCertificateFromString(std::string str, std::string &gpg_id)
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
std::string cleancert = cleanUpCertificate(str);
std::cerr << "AuthGPG::LoadCertificateFromString() cleancert : " << cleancert;
gpgme_data_t gpgmeData;
if (GPG_ERR_NO_ERROR != gpgme_data_new_from_mem(&gpgmeData, str.c_str(), str.length(), 1))
if (GPG_ERR_NO_ERROR != gpgme_data_new_from_mem(&gpgmeData, cleancert.c_str(), cleancert.length(), 1))
{
std::cerr << "Error create Data";
std::cerr << std::endl;

View File

@ -224,7 +224,21 @@ std::string cleanUpCertificate(std::string badCertificate)
while(badCertificate[currBadCertIdx]=='\n'|| badCertificate[currBadCertIdx]==' ')
{
currBadCertIdx++;
}
}
//keep the first line : gnupg version
cleanCertificate[currCleanCertIdx]= badCertificate[currBadCertIdx];
currBadCertIdx++;
while(badCertificate[currBadCertIdx]!='\n')
{
cleanCertificate[currCleanCertIdx]= badCertificate[currBadCertIdx];
currCleanCertIdx++;
currBadCertIdx++;
}
cleanCertificate[currCleanCertIdx]= badCertificate[currBadCertIdx];
currCleanCertIdx++;
currBadCertIdx++;
//Start of the actual certificate. Remove spaces in the certificate
//and make sure there are 64 characters per line in the
//new cleaned certificate

View File

@ -813,7 +813,7 @@ void ConclusionPage::initializePage() {
//set the radio button to sign the GPG key
if (detail.accept_connection && !detail.ownsign) {
//gpg key connection is already accepted, don't propose to accept it again
signGPGRadioButton->setText(tr("Peer is already a GPG key is already a retroshare friend. Sign his GPG key."));
signGPGRadioButton->setText(tr("Peer is already a retroshare friend. Sign his GPG key."));
signGPGRadioButton->setChecked(true);
acceptNoSignGPGRadioButton->hide();
acceptNoSignGPGRadioButton->setChecked(false);