mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
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:
parent
868e60af06
commit
c0acb71136
3 changed files with 22 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue