Merged branch v0.5-OpenPGP into trunk:

User-level changes:
==================
- libgpgme is not used anymore; it is replaced by a built-in piece of code called OpenPGP-SDK 
  (http://openpgp.nominet.org.uk/cgi-bin/trac.cgi) that was improved to be used by RetroShare
  for handling PGP keys.

- the gnupg keyring is not used anymore. Now, RetroShare has it's own gpg keyring, shared by all instances.
  On linux it's located in ~/.retroshare/pgp/. A lock system prevents multiple locations to read/write keyrings
  simultaneously.

- the trust database from gnupg is not documented, so RetroShare cannot import it. This comes from the fact that
  the GPG standard (RFC4880) asks explicitly not to export trust information. So RetroShare has it's own 
  trust DB shared by locations. This means you need to re-trust people. Sorry for that!

- at start, if no keyring is found, RS will propose to copy the gnupg keyring to use your existing keys. Clicking on 
  "OK" will do the copy, and you should find back all existing locations, except for DSA keys.

- locations for which the suitable keypair is not in the keyring will not be displayed in the login window
- locations for which the suitable keypair is not a RSA/RSA key will not be displayed. RetroShare does not
  support DSA/Elgamal keypairs yet.

- a key import/export exchange function has been added in the certificate creation window (you go there from the login
  window by clicking on "manage keys/locations". This allows to easily create a new location with the same pgp key on
  another computer. To obtain a suitable keypair using gnupg, you need to concatenate the encrypted private key and the 
  public key into an ascii file. This can be done using:
  		gpg -a --export-secret-keys [your ID] > mykey.asc
		gpg -a --export [your ID] >> mykey.asc

- importing a key with subkeys in not yet possible. Please remove subkeys before importing.

- The code has been tested for a reasonnable amount of time, but it's not possible to prevent some new bugs 
  to appear. Please report them asap supplying: call-stacks if possible, and terminal output. In particular,
  openpgp has some assert()'s that should not be triggered unless RetroShare is calling it in an improper way.

Internal changes
================
- a specific component, PGPHandler, takes care of the interface between openpgp-sdk and RetroShare
  openpgp-sdk is c-code, with it's own memory management, which has been kept well separated from 
  RetroShare.

- GPG Ids are now a specific class (not a std::string anymore) for code consistency reasons. As strings are
  still used in many places, this requires a few conversions. In particular, AuthGPG takes strings as
  function params and calls GPGHandler with the proper PGPIdType class. In the future, RetroShare should
  only use PGPIdType. The same will be done for SSL ids.

- signature cleaning is still handled by the Retroshare built-in function, not by openpgp, but we will 
  do this later.

Still to do
===========
- DSA needs subkey handling, since the encryption is performed by a Elgamal subkey. Not sure this will be done.
- GPGIds/SSLIds cleaning (meaning replace strings by appropriate types). Lots of confusion throughout the code in retroshare-gui in particular.
- key removal from keyring. This is a challenge to keep locations synchronised.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5293 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-07-13 21:53:39 +00:00
commit fc8dfcf65b
109 changed files with 26549 additions and 2997 deletions

View file

@ -32,6 +32,7 @@
// Initialize failed, result < 0
#define RS_INIT_AUTH_FAILED -1 // AuthGPG::InitAuth failed
#define RS_INIT_BASE_DIR_ERROR -2 // AuthGPG::InitAuth failed
#define RS_INIT_NO_KEYRING -3 // Keyring is empty. Need to import it.
/****
@ -79,6 +80,8 @@ class RsInit
static bool ValidateCertificate(std::string &userName) ;
static bool exportIdentity(const std::string& fname,const std::string& pgp_id) ;
static bool importIdentity(const std::string& fname,std::string& imported_pgp_id,std::string& import_error) ;
/*!
* Generating GPGme Account
@ -87,6 +90,9 @@ class RsInit
static int GetPGPLoginDetails(const std::string& id, std::string &name, std::string &email);
static bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, std::string &pgpId, std::string &errString);
// copies existing gnupg keyrings to the new place of the OpenPGP-SDK version. Returns true on success.
static bool copyGnuPGKeyrings() ;
/*!
* Login GGP
*/

View file

@ -38,12 +38,14 @@
class RsPeers;
extern RsPeers *rsPeers;
/* Trust Levels */
const uint32_t RS_TRUST_LVL_NONE = 2;
const uint32_t RS_TRUST_LVL_MARGINAL = 3;
const uint32_t RS_TRUST_LVL_FULL = 4;
const uint32_t RS_TRUST_LVL_ULTIMATE = 5;
/* Trust Levels. Should be the same values than what is declared in PGPHandler.h */
const uint32_t RS_TRUST_LVL_UNDEFINED = 0;
const uint32_t RS_TRUST_LVL_UNKNOWN = 1;
const uint32_t RS_TRUST_LVL_NEVER = 2;
const uint32_t RS_TRUST_LVL_MARGINAL = 3;
const uint32_t RS_TRUST_LVL_FULL = 4;
const uint32_t RS_TRUST_LVL_ULTIMATE = 5;
/* Net Mode */
const uint32_t RS_NETMODE_UDP = 0x0001;
@ -76,6 +78,7 @@ const int RS_PEER_CERT_CLEANING_CODE_UNKOWN_ERROR = 0x01 ;
const int RS_PEER_CERT_CLEANING_CODE_NO_BEGIN_TAG = 0x02 ;
const int RS_PEER_CERT_CLEANING_CODE_NO_END_TAG = 0x03 ;
const int RS_PEER_CERT_CLEANING_CODE_NO_CHECKSUM = 0x04 ;
const int RS_PEER_CERT_CLEANING_CODE_WRONG_NUMBER = 0x05 ;
/* LinkType Flags */
@ -231,6 +234,7 @@ virtual bool getPeerDetails(const std::string &ssl_or_gpg_id, RsPeerDetails &d)
/* Using PGP Ids */
virtual std::string getGPGOwnId() = 0;
virtual std::string getGPGId(const std::string &sslid_or_gpgid) = 0; //return the gpg id of the given gpg or ssl id
virtual bool isKeySupported(const std::string& gpg_ids) = 0;
virtual bool getGPGAcceptedList(std::list<std::string> &gpg_ids) = 0;
virtual bool getGPGSignedList(std::list<std::string> &gpg_ids) = 0;//friends that we accpet to connect with but we don't want to sign their gpg key
virtual bool getGPGValidList(std::list<std::string> &gpg_ids) = 0;