mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-08 00:55:13 -04:00
fixed code for certificate link generation.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5420 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a940537331
commit
b714d68523
5 changed files with 48 additions and 20 deletions
|
@ -61,7 +61,7 @@ class PGPKeyManagement
|
|||
|
||||
static void findLengthOfMinimalKey(const unsigned char *keydata,size_t key_len,size_t& minimal_key_len) ;
|
||||
static std::string makeArmouredKey(const unsigned char *keydata,size_t key_size,const std::string& version_string) ;
|
||||
private:
|
||||
|
||||
// Computes the 24 bits CRC checksum necessary to all PGP data.
|
||||
//
|
||||
static uint32_t compute24bitsCRC(unsigned char *data,size_t len) ;
|
||||
|
|
|
@ -265,6 +265,7 @@ virtual bool getAllowTunnelConnection() = 0 ;
|
|||
|
||||
/* Auth Stuff */
|
||||
virtual std::string GetRetroshareInvite(const std::string& ssl_id,bool include_signatures,bool old_format = false) = 0;
|
||||
virtual bool GetPGPBase64StringAndCheckSum(const std::string& gpg_id,std::string& gpg_base64_string,std::string& gpg_base64_checksum) = 0 ;
|
||||
virtual std::string GetRetroshareInvite(bool include_signatures,bool old_format = false) = 0;
|
||||
virtual bool hasExportMinimal() = 0 ;
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "util/radix64.h"
|
||||
#include "pgp/pgpkeyutil.h"
|
||||
|
||||
#include "rsserver/p3peers.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
|
@ -819,6 +822,31 @@ p3Peers::GetRetroshareInvite(bool include_signatures,bool old_format)
|
|||
return GetRetroshareInvite(getOwnId(),include_signatures,old_format);
|
||||
}
|
||||
|
||||
bool p3Peers::GetPGPBase64StringAndCheckSum( const std::string& gpg_id,
|
||||
std::string& gpg_base64_string,
|
||||
std::string& gpg_base64_checksum)
|
||||
{
|
||||
gpg_base64_string = "" ;
|
||||
gpg_base64_checksum = "" ;
|
||||
|
||||
unsigned char *mem_block ;
|
||||
size_t mem_block_size ;
|
||||
|
||||
if(!AuthGPG::getAuthGPG()->exportPublicKey(PGPIdType(gpg_id),mem_block,mem_block_size,false,false))
|
||||
return false ;
|
||||
|
||||
Radix64::encode((const char *)mem_block,mem_block_size,gpg_base64_string) ;
|
||||
|
||||
uint32_t crc = PGPKeyManagement::compute24bitsCRC((unsigned char *)mem_block,mem_block_size) ;
|
||||
|
||||
unsigned char tmp[3] = { (crc >> 16) & 0xff, (crc >> 8) & 0xff, crc & 0xff } ;
|
||||
Radix64::encode((const char *)tmp,3,gpg_base64_checksum) ;
|
||||
|
||||
delete[] mem_block ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
std::string p3Peers::GetRetroshareInvite(const std::string& ssl_id,bool include_signatures,bool old_format)
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
|
@ -874,7 +902,7 @@ bool p3Peers::loadCertificateFromFile(const std::string &/*fname*/, std::string
|
|||
return false;
|
||||
}
|
||||
|
||||
bool p3Peers::loadDetailsFromStringCert(const std::string &certstr, RsPeerDetails &pd,std::string& error_string)
|
||||
bool p3Peers::loadDetailsFromStringCert(const std::string &certstr, RsPeerDetails &pd,std::string& /*error_string*/)
|
||||
{
|
||||
#ifdef P3PEERS_DEBUG
|
||||
std::cerr << "p3Peers::LoadCertificateFromString() ";
|
||||
|
|
|
@ -96,6 +96,8 @@ virtual bool getAllowTunnelConnection() ;
|
|||
virtual std::string GetRetroshareInvite(const std::string& ssl_id,bool include_signatures,bool old_format = false);
|
||||
// same but for own id
|
||||
virtual std::string GetRetroshareInvite(bool include_signatures,bool old_format = false);
|
||||
virtual bool GetPGPBase64StringAndCheckSum(const std::string& gpg_id,std::string& gpg_base64_string,std::string& gpg_base64_checksum) ;
|
||||
|
||||
virtual bool hasExportMinimal() ;
|
||||
|
||||
virtual bool loadCertificateFromFile(const std::string &fname, std::string &id, std::string &gpg_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue