mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 09:26:18 -05:00
- 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:
parent
13f2863569
commit
e7536960c3
@ -242,7 +242,9 @@ void AuthGPG::processServices()
|
||||
std::cerr << "AuthGPGimpl::processServices() Process load operation" << std::endl;
|
||||
#endif
|
||||
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 */
|
||||
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 ******/
|
||||
|
||||
PGPIdType id ;
|
||||
bool res = PGPHandler::LoadCertificateFromString(str,id,error_string) ;
|
||||
|
||||
gpg_id = id.toStdString();
|
||||
|
||||
return res ;
|
||||
return PGPHandler::LoadCertificateFromString(str,gpg_id,error_string) ;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
@ -180,7 +180,7 @@ class AuthGPG: public p3Config, public RsThread, public PGPHandler
|
||||
* 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) ;
|
||||
|
||||
// Cached certificates.
|
||||
|
@ -296,14 +296,14 @@ class RsPeers
|
||||
virtual bool hasExportMinimal() = 0 ;
|
||||
|
||||
// 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 &gpg_id) = 0;
|
||||
virtual bool loadCertificateFromString(const std::string& cert, std::string& ssl_id,std::string& pgp_id, std::string& error_string) = 0;
|
||||
|
||||
// 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;
|
||||
|
||||
// Certificate utils
|
||||
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 bool signGPGCertificate(const std::string &gpg_id) = 0;
|
||||
|
@ -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) ;
|
||||
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*/)
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
std::cerr << "p3Peers::LoadCertificateFromFile() not implemented yet";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
gpg_id = gpgid.toStdString() ;
|
||||
ssl_id = crt.sslid_string() ;
|
||||
|
||||
return false;
|
||||
return res ;
|
||||
}
|
||||
|
||||
bool p3Peers::loadDetailsFromStringCert(const std::string &certstr, RsPeerDetails &pd,uint32_t& error_code)
|
||||
|
@ -100,9 +100,7 @@ virtual bool GetPGPBase64StringAndCheckSum(const std::string& gpg_id,std::string
|
||||
|
||||
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 &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 loadDetailsFromStringCert(const std::string &cert, RsPeerDetails &pd, uint32_t& error_code);
|
||||
|
||||
virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert,int& error_code);
|
||||
|
@ -544,9 +544,9 @@ void ConnectFriendWizard::accept()
|
||||
|
||||
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;
|
||||
return ;
|
||||
|
Loading…
Reference in New Issue
Block a user