GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgFileOpera.h
1 
29 #ifndef GPGFRONTEND_GPGFILEOPERA_H
30 #define GPGFRONTEND_GPGFILEOPERA_H
31 
32 #include "core/GpgConstants.h"
33 #include "core/GpgContext.h"
34 #include "core/GpgModel.h"
35 
36 namespace GpgFrontend {
37 
43 class GPGFRONTEND_CORE_EXPORT GpgFileOpera
44  : public SingletonFunctionObject<GpgFileOpera> {
45  public:
46 
47  explicit GpgFileOpera(
49 
60  static unsigned int EncryptFile(KeyListPtr keys, const std::string& in_path,
61  const std::string& out_path,
62  GpgEncrResult& result,
63  int _channel = GPGFRONTEND_DEFAULT_CHANNEL);
64 
74  static unsigned int EncryptFileSymmetric(
75  const std::string& in_path, const std::string& out_path,
76  GpgEncrResult& result, int _channel = GPGFRONTEND_DEFAULT_CHANNEL);
77 
86  static GpgError DecryptFile(const std::string& in_path,
87  const std::string& out_path,
88  GpgDecrResult& result);
89 
100  static GpgError SignFile(KeyListPtr keys, const std::string& in_path,
101  const std::string& out_path, GpgSignResult& result,
102  int _channel = GPGFRONTEND_DEFAULT_CHANNEL);
103 
113  static GpgError VerifyFile(const std::string& data_path,
114  const std::string& sign_path,
115  GpgVerifyResult& result,
116  int _channel = GPGFRONTEND_DEFAULT_CHANNEL);
117 
130  static GpgError EncryptSignFile(KeyListPtr keys, KeyListPtr signer_keys,
131  const std::string& in_path,
132  const std::string& out_path,
133  GpgEncrResult& encr_res,
134  GpgSignResult& sign_res,
135  int _channel = GPGFRONTEND_DEFAULT_CHANNEL);
136 
146  static GpgError DecryptVerifyFile(const std::string& in_path,
147  const std::string& out_path,
148  GpgDecrResult& decr_res,
149  GpgVerifyResult& verify_res);
150 };
151 
152 } // namespace GpgFrontend
153 
154 #endif // GPGFRONTEND_GPGFILEOPERA_H
GpgFrontend::GpgFileOpera::SignFile
static GpgError SignFile(KeyListPtr keys, const std::string &in_path, const std::string &out_path, GpgSignResult &result, int _channel=GPGFRONTEND_DEFAULT_CHANNEL)
Definition: GpgFileOpera.cpp:103
GpgFrontend::SingletonFunctionObject
Definition: GpgFunctionObject.h:49
GpgFrontend::FileOperator::WriteFileStd
static bool WriteFileStd(const std::filesystem::path &file_name, const std::string &data)
write file content using std struct
Definition: FileOperator.cpp:67
GpgFrontend::GpgBasicOperator::Decrypt
gpgme_error_t Decrypt(BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, GpgDecrResult &result)
Call the interface provided by gpgme for decryption operation.
Definition: GpgBasicOperator.cpp:64
GpgFrontend
Definition: CoreCommonUtil.cpp:29
GpgFrontend::SingletonFunctionObject< GpgBasicOperator >::GetInstance
static GpgBasicOperator & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:57
GpgFrontend::GpgBasicOperator::DecryptVerify
gpgme_error_t DecryptVerify(BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, GpgDecrResult &decrypt_result, GpgVerifyResult &verify_result)
Call the interface provided by gpgme to perform decryption and verification operations at the same ti...
Definition: GpgBasicOperator.cpp:123
GpgFrontend::GpgFileOpera::EncryptFile
static unsigned int EncryptFile(KeyListPtr keys, const std::string &in_path, const std::string &out_path, GpgEncrResult &result, int _channel=GPGFRONTEND_DEFAULT_CHANNEL)
Encrypted file.
Definition: GpgFileOpera.cpp:40
GpgFrontend::GpgFileOpera
Definition: GpgFileOpera.h:43
GpgFrontend::GpgBasicOperator::Verify
gpgme_error_t Verify(BypeArrayRef in_buffer, ByteArrayPtr &sig_buffer, GpgVerifyResult &result) const
Call the interface provided by gpgme for verification operation.
Definition: GpgBasicOperator.cpp:81
GpgFrontend::GpgBasicOperator::Sign
gpg_error_t Sign(KeyListPtr signers, BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, gpgme_sig_mode_t mode, GpgSignResult &result)
Call the interface provided by gpgme for signing operation.
Definition: GpgBasicOperator.cpp:101
GpgFrontend::GpgBasicOperator::EncryptSymmetric
gpg_error_t EncryptSymmetric(BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, GpgEncrResult &result)
Call the interface provided by GPGME to symmetrical encryption.
Definition: GpgBasicOperator.cpp:203
GpgFrontend::GpgBasicOperator::EncryptSign
gpgme_error_t EncryptSign(KeyListPtr keys, KeyListPtr signers, BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, GpgEncrResult &encr_result, GpgSignResult &sign_result)
Call the interface provided by gpgme to perform encryption and signature operations at the same time.
Definition: GpgBasicOperator.cpp:144
GpgFrontend::GpgFileOpera::GpgFileOpera
GpgFileOpera(int channel=SingletonFunctionObject::GetDefaultChannel())
Definition: GpgFileOpera.cpp:37
GpgFrontend::SingletonFunctionObject::GetDefaultChannel
static int GetDefaultChannel()
Get the Default Channel object.
Definition: GpgFunctionObject.h:127
GpgFrontend::FileOperator::ReadFileStd
static bool ReadFileStd(const std::filesystem::path &file_name, std::string &data)
read file content using std struct
Definition: FileOperator.cpp:55
GpgFrontend::check_gpg_error_2_err_code
GPGFRONTEND_CORE_EXPORT gpg_err_code_t check_gpg_error_2_err_code(gpgme_error_t err, gpgme_error_t predict=GPG_ERR_NO_ERROR)
Definition: GpgConstants.cpp:64
GpgFrontend::GpgFileOpera::DecryptVerifyFile
static GpgError DecryptVerifyFile(const std::string &in_path, const std::string &out_path, GpgDecrResult &decr_res, GpgVerifyResult &verify_res)
Definition: GpgFileOpera.cpp:197
GpgFrontend::GpgFileOpera::VerifyFile
static GpgError VerifyFile(const std::string &data_path, const std::string &sign_path, GpgVerifyResult &result, int _channel=GPGFRONTEND_DEFAULT_CHANNEL)
Definition: GpgFileOpera.cpp:135
GpgFrontend::GpgFileOpera::EncryptSignFile
static GpgError EncryptSignFile(KeyListPtr keys, KeyListPtr signer_keys, const std::string &in_path, const std::string &out_path, GpgEncrResult &encr_res, GpgSignResult &sign_res, int _channel=GPGFRONTEND_DEFAULT_CHANNEL)
Definition: GpgFileOpera.cpp:165
GpgFrontend::GpgFileOpera::DecryptFile
static GpgError DecryptFile(const std::string &in_path, const std::string &out_path, GpgDecrResult &result)
Definition: GpgFileOpera.cpp:71
GpgFrontend::GpgFileOpera::EncryptFileSymmetric
static unsigned int EncryptFileSymmetric(const std::string &in_path, const std::string &out_path, GpgEncrResult &result, int _channel=GPGFRONTEND_DEFAULT_CHANNEL)
运用对称加密算法加密文件
Definition: GpgFileOpera.cpp:226
GpgFrontend::GpgBasicOperator::Encrypt
gpg_error_t Encrypt(KeyListPtr keys, BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, GpgEncrResult &result)
Call the interface provided by gpgme for encryption operation.
Definition: GpgBasicOperator.cpp:38