mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-15 17:40:35 -04:00
- added new certificate format in ConfCertDialog and ConnectFriendWizard, with a button to switch to old format if necessary
- added automatic cleaning of certificates in both formats - grouped all certificate cleaning/parsing code in rscertificate.cc - removed unused files cleanupxpgp.h/cc - added upper/lower case to rsid template. The new format is to be tested. It is supposed to be much more robust than the previous format, in particular, allowing any string for location names. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5410 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
64e171948c
commit
60f51c358c
21 changed files with 1037 additions and 1099 deletions
|
@ -3,6 +3,8 @@
|
|||
#include <string>
|
||||
#include <util/rsid.h>
|
||||
|
||||
class RsPeerDetails ;
|
||||
|
||||
static const int SSL_ID_SIZE = 16 ;
|
||||
|
||||
typedef t_RsGenericIdType<SSL_ID_SIZE> SSLIdType ;
|
||||
|
@ -10,16 +12,45 @@ typedef t_RsGenericIdType<SSL_ID_SIZE> SSLIdType ;
|
|||
class RsCertificate
|
||||
{
|
||||
public:
|
||||
// Constructs from text
|
||||
typedef enum { RS_CERTIFICATE_OLD_FORMAT, RS_CERTIFICATE_RADIX } Format ;
|
||||
|
||||
// Constructs from text.
|
||||
// - old format: The input string must comply with the GPG format (See RFC4880)
|
||||
// - new format: The input string should only contain radix chars and spaces/LF/tabs.
|
||||
//
|
||||
RsCertificate(const std::string& input_string) ;
|
||||
|
||||
// Constructs from binary gpg key, and RsPeerDetails.
|
||||
//
|
||||
RsCertificate(const RsPeerDetails& details,const unsigned char *gpg_mem_block,size_t gpg_mem_block_size) ;
|
||||
|
||||
// Constructs
|
||||
|
||||
virtual ~RsCertificate();
|
||||
|
||||
// Outut to text
|
||||
std::string toStdString_oldFormat() const ;
|
||||
std::string toStdString() const ;
|
||||
|
||||
std::string ext_ip_string() const ;
|
||||
std::string loc_ip_string() const ;
|
||||
std::string dns_string() const { return dns_name ; }
|
||||
std::string sslid_string() const { return location_id.toStdString(false) ; }
|
||||
std::string armouredPGPKey() const ;
|
||||
|
||||
unsigned short ext_port_us() const ;
|
||||
unsigned short loc_port_us() const ;
|
||||
|
||||
const unsigned char *pgp_key() const { return binary_pgp_key ; }
|
||||
const size_t pgp_key_size() const { return binary_pgp_key_size ; }
|
||||
|
||||
static bool cleanCertificate(const std::string& input,std::string& output,RsCertificate::Format& format,int& error_code) ;
|
||||
|
||||
private:
|
||||
static bool cleanCertificate(const std::string& input,std::string& output,int&) ; // new radix format
|
||||
static bool cleanCertificate_oldFormat(const std::string& input,std::string& output,int&) ; // old text format
|
||||
static void scan_ip(const std::string& ip_string, unsigned short port,unsigned char *destination_memory) ;
|
||||
|
||||
bool initFromString(const std::string& str,std::string& err_string) ;
|
||||
bool initFromString_oldFormat(const std::string& str,std::string& err_string) ;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue