- fixed inconsistency in parameter naming, causing error_string to be mixed up with gpg id (Not a bug).

- removed unimplemented entry loadCertificateFromFile()


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6075 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-01-19 13:43:35 +00:00
parent 13f2863569
commit e7536960c3
6 changed files with 18 additions and 27 deletions

View file

@ -242,7 +242,9 @@ void AuthGPG::processServices()
std::cerr << "AuthGPGimpl::processServices() Process load operation" << std::endl; std::cerr << "AuthGPGimpl::processServices() Process load operation" << std::endl;
#endif #endif
std::string error_string ; std::string error_string ;
LoadCertificateFromString(loadOrSave->m_certGpg, loadOrSave->m_certGpgId,error_string); PGPIdType pgp_id ;
LoadCertificateFromString(loadOrSave->m_certGpg, pgp_id,error_string);
loadOrSave->m_certGpgId = pgp_id.toStdString() ;
} }
@ -551,16 +553,11 @@ std::string AuthGPG::SaveCertificateToString(const std::string &id,bool include_
} }
/* import to GnuPG and other Certificates */ /* import to GnuPG and other Certificates */
bool AuthGPG::LoadCertificateFromString(const std::string &str, std::string &gpg_id,std::string& error_string) bool AuthGPG::LoadCertificateFromString(const std::string &str, PGPIdType& gpg_id,std::string& error_string)
{ {
RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/ RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
PGPIdType id ; return PGPHandler::LoadCertificateFromString(str,gpg_id,error_string) ;
bool res = PGPHandler::LoadCertificateFromString(str,id,error_string) ;
gpg_id = id.toStdString();
return res ;
} }
/***************************************************************** /*****************************************************************

View file

@ -180,7 +180,7 @@ class AuthGPG: public p3Config, public RsThread, public PGPHandler
* STAGE 4: Loading and Saving Certificates. (Strings and Files) * STAGE 4: Loading and Saving Certificates. (Strings and Files)
* *
****/ ****/
virtual bool LoadCertificateFromString(const std::string &pem, std::string &gpg_id,std::string& error_string); virtual bool LoadCertificateFromString(const std::string &pem, PGPIdType& gpg_id,std::string& error_string);
virtual std::string SaveCertificateToString(const std::string &id,bool include_signatures) ; virtual std::string SaveCertificateToString(const std::string &id,bool include_signatures) ;
// Cached certificates. // Cached certificates.

View file

@ -296,14 +296,14 @@ class RsPeers
virtual bool hasExportMinimal() = 0 ; virtual bool hasExportMinimal() = 0 ;
// Add keys to the keyring // Add keys to the keyring
virtual bool loadCertificateFromFile(const std::string &fname, std::string &ssl_id, std::string &gpg_id) = 0; virtual bool loadCertificateFromString(const std::string& cert, std::string& ssl_id,std::string& pgp_id, std::string& error_string) = 0;
virtual bool loadCertificateFromString(const std::string &cert, std::string &ssl_id, std::string &gpg_id) = 0;
// Gets the GPG details, but does not add the key to the keyring. // Gets the GPG details, but does not add the key to the keyring.
virtual bool loadDetailsFromStringCert(const std::string& certGPG, RsPeerDetails &pd,uint32_t& error_code) = 0; virtual bool loadDetailsFromStringCert(const std::string& certGPG, RsPeerDetails &pd,uint32_t& error_code) = 0;
// Certificate utils
virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert,int& error_code) = 0; virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert,int& error_code) = 0;
virtual bool saveCertificateToFile(const std::string &id, const std::string &fname) = 0; virtual bool saveCertificateToFile(const std::string& id, const std::string &fname) = 0;
virtual std::string saveCertificateToString(const std::string &id) = 0; virtual std::string saveCertificateToString(const std::string &id) = 0;
virtual bool signGPGCertificate(const std::string &gpg_id) = 0; virtual bool signGPGCertificate(const std::string &gpg_id) = 0;

View file

@ -888,21 +888,17 @@ std::string p3Peers::GetRetroshareInvite(const std::string& ssl_id,bool include_
//=========================================================================== //===========================================================================
bool p3Peers::loadCertificateFromString(const std::string& cert, std::string& id, std::string& gpg_id) bool p3Peers::loadCertificateFromString(const std::string& cert, std::string& ssl_id, std::string& gpg_id, std::string& error_string)
{ {
RsCertificate crt(cert) ; RsCertificate crt(cert) ;
PGPIdType gpgid ;
return AuthGPG::getAuthGPG()->LoadCertificateFromString(crt.armouredPGPKey(),id,gpg_id) ; bool res = AuthGPG::getAuthGPG()->LoadCertificateFromString(crt.armouredPGPKey(),gpgid,error_string) ;
}
bool p3Peers::loadCertificateFromFile(const std::string &/*fname*/, std::string &/*id*/, std::string &/*gpg_id*/) gpg_id = gpgid.toStdString() ;
{ ssl_id = crt.sslid_string() ;
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::LoadCertificateFromFile() not implemented yet";
std::cerr << std::endl;
#endif
return false; return res ;
} }
bool p3Peers::loadDetailsFromStringCert(const std::string &certstr, RsPeerDetails &pd,uint32_t& error_code) bool p3Peers::loadDetailsFromStringCert(const std::string &certstr, RsPeerDetails &pd,uint32_t& error_code)

View file

@ -100,9 +100,7 @@ virtual bool GetPGPBase64StringAndCheckSum(const std::string& gpg_id,std::string
virtual bool hasExportMinimal() ; virtual bool hasExportMinimal() ;
virtual bool loadCertificateFromFile(const std::string &fname, std::string &id, std::string &gpg_id); virtual bool loadCertificateFromString(const std::string& cert, std::string& ssl_id,std::string& pgp_id, std::string& error_string);
virtual bool loadCertificateFromString(const std::string& cert, std::string &id, std::string &gpg_id);
virtual bool loadDetailsFromStringCert(const std::string &cert, RsPeerDetails &pd, uint32_t& error_code); virtual bool loadDetailsFromStringCert(const std::string &cert, RsPeerDetails &pd, uint32_t& error_code);
virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert,int& error_code); virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert,int& error_code);

View file

@ -544,9 +544,9 @@ void ConnectFriendWizard::accept()
if (!mCertificate.empty() && (accept_connection || sign)) if (!mCertificate.empty() && (accept_connection || sign))
{ {
std::string ssl_id, pgp_id ; std::string pgp_id,ssl_id,error_string ;
if(!rsPeers->loadCertificateFromString(mCertificate,ssl_id,pgp_id)) if(!rsPeers->loadCertificateFromString(mCertificate,ssl_id,pgp_id,error_string))
{ {
std::cerr << "ConnectFriendWizard::accept(): cannot load that certificate." << std::endl; std::cerr << "ConnectFriendWizard::accept(): cannot load that certificate." << std::endl;
return ; return ;