mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
added a signature add/remove button in connect wizard, only when gpgme-1.3.1 or greater is used, based on the availability of the GPGME_EXPORT_MODE_MINIMAL option.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4372 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
28e5f1b8f3
commit
e9853b655c
7 changed files with 80 additions and 23 deletions
|
@ -428,7 +428,7 @@ void AuthGPGimpl::processServices()
|
|||
#endif
|
||||
|
||||
/* save the certificate to string */
|
||||
loadOrSave->m_certGpg = SaveCertificateToString(loadOrSave->m_certGpgId);
|
||||
loadOrSave->m_certGpg = SaveCertificateToString(loadOrSave->m_certGpgId,true);
|
||||
}
|
||||
|
||||
service->setGPGOperation(loadOrSave);
|
||||
|
@ -1353,7 +1353,7 @@ bool AuthGPGimpl::isGPGAccepted(const std::string &id)
|
|||
|
||||
|
||||
/* SKTAN : do not know how to use std::string id */
|
||||
std::string AuthGPGimpl::SaveCertificateToString(const std::string &id)
|
||||
std::string AuthGPGimpl::SaveCertificateToString(const std::string &id,bool include_signatures)
|
||||
{
|
||||
|
||||
if (!isGPGId(id)) {
|
||||
|
@ -1368,13 +1368,19 @@ std::string AuthGPGimpl::SaveCertificateToString(const std::string &id)
|
|||
pattern[0] = id.c_str();
|
||||
gpgme_data_t gpgmeData;
|
||||
|
||||
#ifdef GPGME_EXPORT_MODE_MINIMAL
|
||||
gpgme_export_mode_t export_mode = include_signatures?0:GPGME_EXPORT_MODE_MINIMAL ;
|
||||
#else
|
||||
gpgme_export_mode_t export_mode = 0 ;
|
||||
#endif
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_data_new (&gpgmeData))
|
||||
{
|
||||
std::cerr << "Error create Data" << std::endl;
|
||||
}
|
||||
gpgme_set_armor (CTX, 1);
|
||||
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_export_ext (CTX, pattern, 0, gpgmeData))
|
||||
if (GPG_ERR_NO_ERROR != gpgme_op_export_ext (CTX, pattern, export_mode, gpgmeData))
|
||||
{
|
||||
std::cerr << "Error export Data" << std::endl;
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ virtual bool isGPGId(const std::string &id) = 0;
|
|||
*
|
||||
****/
|
||||
virtual bool LoadCertificateFromString(const std::string &pem, std::string &gpg_id,std::string& error_string) = 0;
|
||||
virtual std::string SaveCertificateToString(const std::string &id) = 0;
|
||||
virtual std::string SaveCertificateToString(const std::string &id,bool include_signatures) = 0;
|
||||
|
||||
/*********************************************************************************/
|
||||
/************************* STAGE 6 ***********************************************/
|
||||
|
@ -333,7 +333,7 @@ virtual bool isGPGId(const std::string &id);
|
|||
*
|
||||
****/
|
||||
virtual bool LoadCertificateFromString(const std::string &pem, std::string &gpg_id,std::string& error_string);
|
||||
virtual std::string SaveCertificateToString(const std::string &id);
|
||||
virtual std::string SaveCertificateToString(const std::string &id,bool include_signatures) ;
|
||||
|
||||
/*********************************************************************************/
|
||||
/************************* STAGE 6 ***********************************************/
|
||||
|
|
|
@ -211,8 +211,9 @@ virtual bool getAllowServerIPDetermination() = 0 ;
|
|||
virtual bool getAllowTunnelConnection() = 0 ;
|
||||
|
||||
/* Auth Stuff */
|
||||
virtual std::string GetRetroshareInvite(const std::string& ssl_id) = 0;
|
||||
virtual std::string GetRetroshareInvite() = 0;
|
||||
virtual std::string GetRetroshareInvite(const std::string& ssl_id,bool include_signatures) = 0;
|
||||
virtual std::string GetRetroshareInvite(bool include_signatures) = 0;
|
||||
virtual bool hasExportMinimal() = 0 ;
|
||||
|
||||
virtual bool loadCertificateFromFile(const std::string &fname, std::string &ssl_id, std::string &gpg_id) = 0;
|
||||
virtual bool loadDetailsFromStringCert(const std::string &certGPG, RsPeerDetails &pd,std::string& error_string) = 0;
|
||||
|
|
|
@ -129,6 +129,15 @@ p3Peers::p3Peers(p3ConnectMgr *cm)
|
|||
return;
|
||||
}
|
||||
|
||||
bool p3Peers::hasExportMinimal()
|
||||
{
|
||||
#ifdef GPGME_EXPORT_MODE_MINIMAL
|
||||
return true ;
|
||||
#else
|
||||
return false ;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Updates ... */
|
||||
bool p3Peers::FriendsChanged()
|
||||
{
|
||||
|
@ -858,13 +867,13 @@ p3Peers::setVisState(const std::string &id, uint32_t extVisState)
|
|||
//===========================================================================
|
||||
/* Auth Stuff */
|
||||
std::string
|
||||
p3Peers::GetRetroshareInvite()
|
||||
p3Peers::GetRetroshareInvite(bool include_signatures)
|
||||
{
|
||||
return GetRetroshareInvite(getOwnId());
|
||||
return GetRetroshareInvite(getOwnId(),include_signatures);
|
||||
}
|
||||
|
||||
std::string
|
||||
p3Peers::GetRetroshareInvite(const std::string& ssl_id)
|
||||
p3Peers::GetRetroshareInvite(const std::string& ssl_id,bool include_signatures)
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
std::cerr << "p3Peers::GetRetroshareInvite()" << std::endl;
|
||||
|
@ -876,7 +885,7 @@ p3Peers::GetRetroshareInvite(const std::string& ssl_id)
|
|||
|
||||
if (getPeerDetails(ssl_id, Detail))
|
||||
{
|
||||
invite = AuthGPG::getAuthGPG()->SaveCertificateToString(Detail.gpg_id);
|
||||
invite = AuthGPG::getAuthGPG()->SaveCertificateToString(Detail.gpg_id,include_signatures);
|
||||
|
||||
if(!Detail.isOnlyGPGdetail)
|
||||
{
|
||||
|
|
|
@ -89,9 +89,10 @@ virtual bool getAllowTunnelConnection() ;
|
|||
|
||||
/* Auth Stuff */
|
||||
// Get the invitation (GPG cert + local/ext address + SSL id for the given peer)
|
||||
virtual std::string GetRetroshareInvite(const std::string& ssl_id);
|
||||
virtual std::string GetRetroshareInvite(const std::string& ssl_id,bool include_signatures);
|
||||
// same but for own id
|
||||
virtual std::string GetRetroshareInvite();
|
||||
virtual std::string GetRetroshareInvite(bool include_signatures);
|
||||
virtual bool hasExportMinimal() ;
|
||||
|
||||
virtual bool loadCertificateFromFile(const std::string &fname, std::string &id, std::string &gpg_id);
|
||||
virtual bool loadDetailsFromStringCert(const std::string &cert, RsPeerDetails &pd, std::string& error_string);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue