mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
JSON API import/export PGP key to file
This commit is contained in:
parent
7a1375ff6f
commit
6543d713e4
@ -449,7 +449,7 @@ void RsControlModule::handleImportPgp(Request &req, Response &resp)
|
||||
|
||||
RsPgpId pgp_id;
|
||||
std::string error_string;
|
||||
if(RsAccounts::ImportIdentityFromString(key_string, pgp_id, error_string))
|
||||
if(RsAccounts::importIdentityFromString(key_string, pgp_id, error_string))
|
||||
{
|
||||
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id);
|
||||
resp.setOk();
|
||||
|
@ -176,9 +176,26 @@ public:
|
||||
static int GetPGPLoginDetails(const RsPgpId& id, std::string &name, std::string &email);
|
||||
static bool GeneratePGPCertificate(const std::string&, const std::string& email, const std::string& passwd, RsPgpId &pgpId, const int keynumbits, std::string &errString);
|
||||
|
||||
// PGP Support Functions.
|
||||
static bool ExportIdentity(const std::string& fname,const RsPgpId& pgp_id) ;
|
||||
static bool ImportIdentity(const std::string& fname,RsPgpId& imported_pgp_id,std::string& import_error) ;
|
||||
/**
|
||||
* @brief Export full encrypted PGP identity to file
|
||||
* @jsonapi{development}
|
||||
* @param[in] filePath path of certificate file
|
||||
* @param[in] pgpId PGP id to export
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
static bool ExportIdentity( const std::string& filePath,
|
||||
const RsPgpId& pgpId );
|
||||
|
||||
/**
|
||||
* @brief Import full encrypted PGP identity from file
|
||||
* @jsonapi{development,unauthenticated}
|
||||
* @param[in] filePath path of certificate file
|
||||
* @param[out] pgpId storage for the PGP fingerprint of the imported key
|
||||
* @param[out] errorMsg storage for eventual human readable error message
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
static bool ImportIdentity(
|
||||
const std::string& filePath, RsPgpId& pgpId, std::string& errorMsg );
|
||||
|
||||
/**
|
||||
* @brief Import full encrypted PGP identity from string
|
||||
@ -188,7 +205,7 @@ public:
|
||||
* @param[out] errorMsg storage for eventual human readable error message
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
static bool ImportIdentityFromString(
|
||||
static bool importIdentityFromString(
|
||||
const std::string& data, RsPgpId& pgpId,
|
||||
std::string& errorMsg );
|
||||
|
||||
|
@ -1347,9 +1347,12 @@ bool RsAccounts::ImportIdentity(const std::string& fname,RsPgpId& imported_pg
|
||||
return rsAccountsDetails->importIdentity(fname,imported_pgp_id,import_error);
|
||||
}
|
||||
|
||||
bool RsAccounts::ImportIdentityFromString(const std::string& data,RsPgpId& imported_pgp_id,std::string& import_error)
|
||||
bool RsAccounts::importIdentityFromString(
|
||||
const std::string& data, RsPgpId& imported_pgp_id,
|
||||
std::string& import_error )
|
||||
{
|
||||
return rsAccountsDetails->importIdentityFromString(data,imported_pgp_id,import_error);
|
||||
return rsAccountsDetails->
|
||||
importIdentityFromString(data, imported_pgp_id, import_error);
|
||||
}
|
||||
|
||||
/*static*/ bool RsAccounts::exportIdentityToString(
|
||||
|
Loading…
Reference in New Issue
Block a user