mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-28 16:17:28 -04:00
webui:
- added profile import/creation - fixed leaking file descriptors - added upload handler for small files - fixed terminal thread - removed some unused parameter warnings git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8485 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3ed1be74a6
commit
8fc3917c4b
21 changed files with 1343 additions and 121 deletions
|
@ -783,8 +783,39 @@ bool PGPHandler::importGPGKeyPair(const std::string& filename,RsPgpId& imported_
|
|||
if(ops_false == ops_keyring_read_from_file(tmp_keyring, ops_true, filename.c_str()))
|
||||
{
|
||||
import_error = "PGPHandler::readKeyRing(): cannot read key file. File corrupted?" ;
|
||||
free(tmp_keyring);
|
||||
return false ;
|
||||
}
|
||||
|
||||
return checkAndImportKeyPair(tmp_keyring, imported_key_id, import_error);
|
||||
}
|
||||
|
||||
bool PGPHandler::importGPGKeyPairFromString(const std::string &data, RsPgpId &imported_key_id, std::string &import_error)
|
||||
{
|
||||
import_error = "" ;
|
||||
|
||||
ops_memory_t* mem = ops_memory_new();
|
||||
ops_memory_add(mem, (unsigned char*)data.data(), data.length());
|
||||
|
||||
ops_keyring_t *tmp_keyring = allocateOPSKeyring();
|
||||
|
||||
if(ops_false == ops_keyring_read_from_mem(tmp_keyring, ops_true, mem))
|
||||
{
|
||||
import_error = "PGPHandler::importGPGKeyPairFromString(): cannot parse key data" ;
|
||||
free(tmp_keyring);
|
||||
return false ;
|
||||
}
|
||||
return checkAndImportKeyPair(tmp_keyring, imported_key_id, import_error);
|
||||
}
|
||||
|
||||
bool PGPHandler::checkAndImportKeyPair(ops_keyring_t *tmp_keyring, RsPgpId &imported_key_id, std::string &import_error)
|
||||
{
|
||||
if(tmp_keyring == 0)
|
||||
{
|
||||
import_error = "PGPHandler::checkAndImportKey(): keyring is null" ;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(tmp_keyring->nkeys != 2)
|
||||
{
|
||||
import_error = "PGPHandler::importKeyPair(): file does not contain a valid keypair." ;
|
||||
|
@ -923,6 +954,7 @@ bool PGPHandler::importGPGKeyPair(const std::string& filename,RsPgpId& imported_
|
|||
// 6 - clean
|
||||
//
|
||||
ops_keyring_free(tmp_keyring) ;
|
||||
free(tmp_keyring);
|
||||
|
||||
// write public key to disk
|
||||
syncDatabase();
|
||||
|
|
|
@ -74,6 +74,7 @@ class PGPHandler
|
|||
bool haveSecretKey(const RsPgpId& id) const ;
|
||||
|
||||
bool importGPGKeyPair(const std::string& filename,RsPgpId& imported_id,std::string& import_error) ;
|
||||
bool importGPGKeyPairFromString(const std::string& data,RsPgpId& imported_id,std::string& import_error) ;
|
||||
bool exportGPGKeyPair(const std::string& filename,const RsPgpId& exported_id) const ;
|
||||
|
||||
bool availableGPGCertificatesWithPrivateKeys(std::list<RsPgpId>& ids);
|
||||
|
@ -152,6 +153,14 @@ class PGPHandler
|
|||
//
|
||||
bool validateAndUpdateSignatures(PGPCertificateInfo& cert,const ops_keydata_t *keydata) ;
|
||||
|
||||
/** Check public/private key and import them into the keyring
|
||||
* @param keyring keyring with the new public/private key pair. Will be freed by the function.
|
||||
* @param imported_key_id PGP id of the imported key
|
||||
* @param import_error human readbale error message
|
||||
* @returns true on success
|
||||
* */
|
||||
bool checkAndImportKeyPair(ops_keyring_t *keyring, RsPgpId& imported_key_id,std::string& import_error);
|
||||
|
||||
const ops_keydata_t *locked_getPublicKey(const RsPgpId&,bool stamp_the_key) const;
|
||||
const ops_keydata_t *locked_getSecretKey(const RsPgpId&) const ;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue