mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
Extra locators in cert invite made optional
This commit is contained in:
parent
1dd707710b
commit
418c42bd11
@ -386,11 +386,30 @@ public:
|
||||
virtual bool resetOwnExternalAddressList() = 0;
|
||||
virtual bool getAllowServerIPDetermination() = 0 ;
|
||||
|
||||
/**
|
||||
* @brief Get RetroShare invite of the given peer
|
||||
* @param[in] sslId Id of the peer of which we want to generate an invite
|
||||
* @param[in] includeSignatures true to add key signatures to the invite
|
||||
* @param[in] includeExtraLocators false to avoid to add extra locators
|
||||
* @return invite string
|
||||
*/
|
||||
virtual std::string GetRetroshareInvite(
|
||||
const RsPeerId& sslId, bool includeSignatures = false,
|
||||
bool includeExtraLocators = true ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get RetroShare invite of our own peer
|
||||
* @param[in] includeSignatures true to add key signatures to the invite
|
||||
* @param[in] includeExtraLocators false to avoid to add extra locators
|
||||
* @return invite string
|
||||
*/
|
||||
virtual std::string GetRetroshareInvite(
|
||||
bool includeSignatures = false,
|
||||
bool includeExtraLocators = true ) = 0;
|
||||
|
||||
/* Auth Stuff */
|
||||
virtual std::string GetRetroshareInvite(const RsPeerId& ssl_id,bool include_signatures) = 0;
|
||||
virtual std::string getPGPKey(const RsPgpId& pgp_id,bool include_signatures) = 0;
|
||||
virtual bool GetPGPBase64StringAndCheckSum(const RsPgpId& gpg_id,std::string& gpg_base64_string,std::string& gpg_base64_checksum) = 0;
|
||||
virtual std::string GetRetroshareInvite(bool include_signatures) = 0;
|
||||
virtual bool hasExportMinimal() = 0;
|
||||
|
||||
// Add keys to the keyring
|
||||
|
@ -1048,9 +1048,11 @@ bool p3Peers::setProxyServer(const uint32_t type, const std::string &addr_str, c
|
||||
|
||||
//===========================================================================
|
||||
/* Auth Stuff */
|
||||
std::string p3Peers::GetRetroshareInvite(bool include_signatures)
|
||||
std::string p3Peers::GetRetroshareInvite(
|
||||
bool include_signatures, bool includeExtraLocators )
|
||||
{
|
||||
return GetRetroshareInvite(getOwnId(),include_signatures);
|
||||
return GetRetroshareInvite(
|
||||
getOwnId(), include_signatures, includeExtraLocators );
|
||||
}
|
||||
std::string p3Peers::getPGPKey(const RsPgpId& pgp_id,bool include_signatures)
|
||||
{
|
||||
@ -1101,37 +1103,42 @@ bool p3Peers::GetPGPBase64StringAndCheckSum( const RsPgpId& gpg_id,
|
||||
return true ;
|
||||
}
|
||||
|
||||
std::string p3Peers::GetRetroshareInvite(const RsPeerId& ssl_id,bool include_signatures)
|
||||
std::string p3Peers::GetRetroshareInvite(
|
||||
const RsPeerId& ssl_id, bool include_signatures,
|
||||
bool includeExtraLocators )
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
std::cerr << "p3Peers::GetRetroshareInvite()" << std::endl;
|
||||
std::cerr << __PRETTY_FUNCTION__ << std::endl;
|
||||
#endif
|
||||
|
||||
//add the sslid, location, ip local and external address after the signature
|
||||
RsPeerDetails Detail;
|
||||
std::string invite ;
|
||||
RsPeerDetails detail;
|
||||
std::string invite;
|
||||
|
||||
if (getPeerDetails(ssl_id, Detail))
|
||||
if (getPeerDetails(ssl_id, detail))
|
||||
{
|
||||
unsigned char *mem_block = NULL;
|
||||
if(!includeExtraLocators) detail.ipAddressList.clear();
|
||||
|
||||
unsigned char *mem_block = nullptr;
|
||||
size_t mem_block_size = 0;
|
||||
|
||||
if(!AuthGPG::getAuthGPG()->exportPublicKey(RsPgpId(Detail.gpg_id),mem_block,mem_block_size,false,include_signatures))
|
||||
if(!AuthGPG::getAuthGPG()->exportPublicKey(
|
||||
RsPgpId(detail.gpg_id), mem_block, mem_block_size, false,
|
||||
include_signatures ))
|
||||
{
|
||||
std::cerr << "Cannot output certificate for id \"" << Detail.gpg_id << "\". Sorry." << std::endl;
|
||||
return "" ;
|
||||
std::cerr << "Cannot output certificate for id \"" << detail.gpg_id
|
||||
<< "\". Sorry." << std::endl;
|
||||
return "";
|
||||
}
|
||||
|
||||
RsCertificate cert( Detail,mem_block,mem_block_size ) ;
|
||||
|
||||
delete[] mem_block ;
|
||||
|
||||
return cert.toStdString() ;
|
||||
RsCertificate cert(detail, mem_block, mem_block_size);
|
||||
delete[] mem_block;
|
||||
|
||||
return cert.toStdString();
|
||||
}
|
||||
|
||||
#ifdef P3PEERS_DEBUG
|
||||
std::cerr << "p3Peers::GetRetroshareInvite() returns : \n" << invite << std::endl;
|
||||
std::cerr << __PRETTY_FUNCTION__ << " returns : \n" << invite << std::endl;
|
||||
#endif
|
||||
return invite;
|
||||
}
|
||||
|
@ -115,11 +115,15 @@ public:
|
||||
|
||||
/* Auth Stuff */
|
||||
// Get the invitation (GPG cert + local/ext address + SSL id for the given peer)
|
||||
virtual std::string GetRetroshareInvite(const RsPeerId& ssl_id,bool include_signatures);
|
||||
virtual std::string getPGPKey(const RsPgpId& pgp_id,bool include_signatures) ;
|
||||
virtual std::string GetRetroshareInvite(
|
||||
const RsPeerId& ssl_id, bool include_signatures = false,
|
||||
bool includeExtraLocators = true );
|
||||
virtual std::string getPGPKey(const RsPgpId& pgp_id,bool include_signatures);
|
||||
|
||||
// same but for own id
|
||||
virtual std::string GetRetroshareInvite(bool include_signatures);
|
||||
virtual std::string GetRetroshareInvite(
|
||||
bool include_signatures = false,
|
||||
bool includeExtraLocators = true );
|
||||
virtual bool GetPGPBase64StringAndCheckSum(const RsPgpId& gpg_id,std::string& gpg_base64_string,std::string& gpg_base64_checksum);
|
||||
|
||||
virtual bool hasExportMinimal();
|
||||
|
Loading…
Reference in New Issue
Block a user