GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
|
29 #ifndef GPGFRONTEND_KEYPACKAGEOPERATOR_H
30 #define GPGFRONTEND_KEYPACKAGEOPERATOR_H
32 #include "core/GpgFrontendCore.h"
33 #include "core/function/gpg/GpgKeyImportExporter.h"
51 static bool GeneratePassphrase(
const std::filesystem::path &phrase_path,
59 static std::string GenerateKeyPackageName();
72 static bool GenerateKeyPackage(
const std::filesystem::path &key_package_path,
73 const std::string &key_package_name,
74 KeyIdArgsListPtr &key_ids, std::string &phrase,
86 static bool ImportKeyPackage(
const std::filesystem::path &key_package_path,
87 const std::filesystem::path &phrase_path,
97 std::random_device rd_;
98 auto mt_ = std::mt19937(rd_());
100 std::uniform_int_distribution<int> dist(999, 99999);
101 auto file_string = boost::format(
"KeyPackage_%1%") % dist(mt_);
102 return file_string.str();
107 #endif // GPGFRONTEND_KEYPACKAGEOPERATOR_H
static bool WriteFileStd(const std::filesystem::path &file_name, const std::string &data)
write file content using std struct
Definition: FileOperator.cpp:67
static std::string generate_key_package_name()
generate key package name
Definition: KeyPackageOperator.h:96
static bool ImportKeyPackage(const std::filesystem::path &key_package_path, const std::filesystem::path &phrase_path, GpgFrontend::GpgImportInformation &import_info)
import key package
Definition: KeyPackageOperator.cpp:71
Definition: CoreCommonUtil.cpp:29
static std::string GenerateKeyPackageName()
generate the name of the key package
Definition: KeyPackageOperator.cpp:116
static PassphraseGenerator & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:57
std::string Generate(int len)
generate passphrase
Definition: PassphraseGenerator.h:60
static bool GenerateKeyPackage(const std::filesystem::path &key_package_path, const std::string &key_package_name, KeyIdArgsListPtr &key_ids, std::string &phrase, bool secret)
generate key package
Definition: KeyPackageOperator.cpp:46
static bool GeneratePassphrase(const std::filesystem::path &phrase_path, std::string &phrase)
generate passphrase for key package and save it to file
Definition: KeyPackageOperator.cpp:39
static bool ReadFileStd(const std::filesystem::path &file_name, std::string &data)
read file content using std struct
Definition: FileOperator.cpp:55
GpgImportInformation ImportKey(StdBypeArrayPtr inBuffer)
Definition: GpgKeyImportExporter.cpp:42
give the possibility to import or export a key package
Definition: KeyPackageOperator.h:41