GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
|
Basic operation collection. More...
#include <GpgBasicOperator.h>
Public Member Functions | |
GpgBasicOperator (int channel=SingletonFunctionObject::GetDefaultChannel()) | |
Construct a new Basic Operator object. More... | |
void | Encrypt (const KeyArgsList &, const GFBuffer &, bool, const GpgOperationCallback &) |
auto | EncryptSync (const KeyArgsList &, const GFBuffer &, bool) -> std::tuple< GpgError, DataObjectPtr > |
void | EncryptSymmetric (const GFBuffer &in_buffer, bool ascii, const GpgOperationCallback &cb) |
Call the interface provided by GPGME to symmetrical encryption. More... | |
auto | EncryptSymmetricSync (const GFBuffer &in_buffer, bool ascii) -> std::tuple< GpgError, DataObjectPtr > |
void | EncryptSign (const KeyArgsList &keys, const KeyArgsList &signers, const GFBuffer &in_buffer, bool ascii, const GpgOperationCallback &cb) |
Call the interface provided by gpgme to perform encryption and signature operations at the same time. More... | |
auto | EncryptSignSync (const KeyArgsList &keys, const KeyArgsList &signers, const GFBuffer &in_buffer, bool ascii) -> std::tuple< GpgError, DataObjectPtr > |
void | Decrypt (const GFBuffer &in_buffer, const GpgOperationCallback &cb) |
Call the interface provided by gpgme for decryption operation. More... | |
auto | DecryptSync (const GFBuffer &in_buffer) -> std::tuple< GpgError, DataObjectPtr > |
void | DecryptVerify (const GFBuffer &in_buffer, const GpgOperationCallback &cb) |
Call the interface provided by gpgme to perform decryption and verification operations at the same time. More... | |
auto | DecryptVerifySync (const GFBuffer &in_buffer) -> std::tuple< GpgError, DataObjectPtr > |
void | Verify (const GFBuffer &in_buffer, const GFBuffer &sig_buffer, const GpgOperationCallback &cb) |
Call the interface provided by gpgme for verification operation. More... | |
auto | VerifySync (const GFBuffer &in_buffer, const GFBuffer &sig_buffer) -> std::tuple< GpgError, DataObjectPtr > |
void | Sign (const KeyArgsList &signers, const GFBuffer &in_buffer, GpgSignMode mode, bool ascii, const GpgOperationCallback &cb) |
Call the interface provided by gpgme for signing operation. More... | |
auto | SignSync (const KeyArgsList &signers, const GFBuffer &in_buffer, GpgSignMode mode, bool ascii) -> std::tuple< GpgError, DataObjectPtr > |
void | SetSigners (const KeyArgsList &signers, bool ascii) |
Set the private key for signatures, this operation is a global operation. More... | |
auto | GetSigners (bool ascii) -> std::unique_ptr< KeyArgsList > |
Get a global signature private keys that has been set. More... | |
Public Member Functions inherited from GpgFrontend::SingletonFunctionObject< GpgBasicOperator > | |
SingletonFunctionObject (const SingletonFunctionObject< GpgBasicOperator > &)=delete | |
prohibit copy | |
SingletonFunctionObject (GpgBasicOperator &&)=delete | |
Construct a new Singleton Function Object object. | |
SingletonFunctionObject (const GpgBasicOperator &)=delete | |
Construct a new Singleton Function Object object. | |
auto | operator= (const SingletonFunctionObject< GpgBasicOperator > &) -> SingletonFunctionObject &=delete |
prohibit copy More... | |
void | operator= (const GpgBasicOperator &)=delete |
auto | GetChannel () const -> int |
Get the Channel object. More... | |
Public Member Functions inherited from GpgFrontend::ChannelObject | |
ChannelObject () noexcept | |
Construct a new Default Channel Object object. | |
virtual | ~ChannelObject () noexcept |
Destroy the Channel Object object. | |
ChannelObject (int channel, QString type) | |
Construct a new Channel Object object. More... | |
auto | GetChannel () const -> int |
Get the Channel object. More... | |
void | SetChannel (int channel) |
Set the Channel object. More... | |
Private Attributes | |
GpgContext & | ctx_ |
Corresponding context. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from GpgFrontend::SingletonFunctionObject< GpgBasicOperator > | |
static auto | GetInstance (int channel=GpgFrontend::kGpgFrontendDefaultChannel) -> GpgBasicOperator & |
Get the Instance object. More... | |
static auto | CreateInstance (int channel, const std::function< ChannelObjectPtr(void)> &factory) -> GpgBasicOperator & |
Create a Instance object. More... | |
static void | ReleaseChannel (int channel) |
static auto | GetDefaultChannel () -> int |
Get the Default Channel object. More... | |
static auto | GetAllChannelId () -> std::vector< int > |
Get all the channel ids. More... | |
Static Public Member Functions inherited from GpgFrontend::ChannelObject | |
static auto | GetDefaultChannel () -> int |
Get the Default Channel object. More... | |
Protected Member Functions inherited from GpgFrontend::SingletonFunctionObject< GpgBasicOperator > | |
SingletonFunctionObject ()=default | |
Construct a new Singleton Function Object object. | |
SingletonFunctionObject (int channel) | |
Construct a new Singleton Function Object object. More... | |
virtual | ~SingletonFunctionObject ()=default |
Destroy the Singleton Function Object object. | |
Basic operation collection.
|
explicit |
Construct a new Basic Operator object.
channel | Channel corresponding to the context |
void GpgFrontend::GpgBasicOperator::Decrypt | ( | const GFBuffer & | in_buffer, |
const GpgOperationCallback & | cb | ||
) |
Call the interface provided by gpgme for decryption operation.
in_buffer | data that needs to be decrypted |
out_buffer | decrypted data |
result | the result of the operation |
References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaAsync().
auto GpgFrontend::GpgBasicOperator::DecryptSync | ( | const GFBuffer & | in_buffer | ) | -> std::tuple<GpgError, DataObjectPtr> |
in_buffer |
References GpgFrontend::CheckGpgError(), GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaSync().
void GpgFrontend::GpgBasicOperator::DecryptVerify | ( | const GFBuffer & | in_buffer, |
const GpgOperationCallback & | cb | ||
) |
Call the interface provided by gpgme to perform decryption and verification operations at the same time.
in_buffer | data to be manipulated |
out_buffer | data resulting from decryption operation |
decrypt_result | the result of the decrypting operation |
verify_result | the result of the verifying operation |
References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaAsync().
auto GpgFrontend::GpgBasicOperator::DecryptVerifySync | ( | const GFBuffer & | in_buffer | ) | -> std::tuple<GpgError, DataObjectPtr> |
in_buffer |
References GpgFrontend::CheckGpgError(), GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaSync().
void GpgFrontend::GpgBasicOperator::EncryptSign | ( | const KeyArgsList & | keys, |
const KeyArgsList & | signers, | ||
const GFBuffer & | in_buffer, | ||
bool | ascii, | ||
const GpgOperationCallback & | cb | ||
) |
Call the interface provided by gpgme to perform encryption and signature operations at the same time.
keys | List of public keys |
signers | Private key for signatures |
in_buffer | Data for operation |
ascii | ascii mode |
References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), GpgFrontend::RunGpgOperaAsync(), and SetSigners().
auto GpgFrontend::GpgBasicOperator::EncryptSignSync | ( | const KeyArgsList & | keys, |
const KeyArgsList & | signers, | ||
const GFBuffer & | in_buffer, | ||
bool | ascii | ||
) | -> std::tuple<GpgError, DataObjectPtr> |
keys | |
signers | |
in_buffer | |
ascii | |
cb |
References GpgFrontend::CheckGpgError(), GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaSync().
void GpgFrontend::GpgBasicOperator::EncryptSymmetric | ( | const GFBuffer & | in_buffer, |
bool | ascii, | ||
const GpgOperationCallback & | cb | ||
) |
Call the interface provided by GPGME to symmetrical encryption.
in_buffer | Data for encryption |
out_buffer | Encrypted data |
result | Encrypted results |
References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaAsync().
auto GpgFrontend::GpgBasicOperator::EncryptSymmetricSync | ( | const GFBuffer & | in_buffer, |
bool | ascii | ||
) | -> std::tuple<GpgError, DataObjectPtr> |
in_buffer | |
ascii | |
cb |
References GpgFrontend::CheckGpgError(), GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaSync().
auto GpgFrontend::GpgBasicOperator::GetSigners | ( | bool | ascii | ) | -> std::unique_ptr<KeyArgsList> |
Get a global signature private keys that has been set.
void GpgFrontend::GpgBasicOperator::SetSigners | ( | const KeyArgsList & | signers, |
bool | ascii | ||
) |
Set the private key for signatures, this operation is a global operation.
keys |
References GpgFrontend::CheckGpgError(), and ctx_.
Referenced by EncryptSign(), and Sign().
void GpgFrontend::GpgBasicOperator::Sign | ( | const KeyArgsList & | signers, |
const GFBuffer & | in_buffer, | ||
GpgSignMode | mode, | ||
bool | ascii, | ||
const GpgOperationCallback & | cb | ||
) |
Call the interface provided by gpgme for signing operation.
The signing modes are as follows: ‘GPGME_SIG_MODE_NORMAL’ A normal signature is made, the output includes the plaintext and the signature. ‘GPGME_SIG_MODE_DETACH’ A detached signature is made. ‘GPGME_SIG_MODE_CLEAR’ A clear text signature is made. The ASCII armor and text mode settings of the context are ignored.
signers | private keys for signing operations |
in_buffer | data that needs to be signed |
out_buffer | verified data |
mode | signing mode |
result | the result of the operation |
References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), GpgFrontend::RunGpgOperaAsync(), and SetSigners().
auto GpgFrontend::GpgBasicOperator::SignSync | ( | const KeyArgsList & | signers, |
const GFBuffer & | in_buffer, | ||
GpgSignMode | mode, | ||
bool | ascii | ||
) | -> std::tuple<GpgError, DataObjectPtr> |
signers | |
in_buffer | |
mode | |
ascii | |
cb |
References GpgFrontend::CheckGpgError(), GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaSync().
void GpgFrontend::GpgBasicOperator::Verify | ( | const GFBuffer & | in_buffer, |
const GFBuffer & | sig_buffer, | ||
const GpgOperationCallback & | cb | ||
) |
Call the interface provided by gpgme for verification operation.
in_buffer | data that needs to be verified |
out_buffer | verified data |
result | the result of the operation |
References GpgFrontend::CheckGpgError(), ctx_, and GpgFrontend::RunGpgOperaAsync().
auto GpgFrontend::GpgBasicOperator::VerifySync | ( | const GFBuffer & | in_buffer, |
const GFBuffer & | sig_buffer | ||
) | -> std::tuple<GpgError, DataObjectPtr> |
in_buffer | |
sig_buffer | |
cb |
References GpgFrontend::CheckGpgError(), and GpgFrontend::RunGpgOperaSync().
|
private |
Corresponding context.
Referenced by Decrypt(), DecryptVerify(), EncryptSign(), EncryptSymmetric(), SetSigners(), Sign(), and Verify().