GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgFrontend::GpgBasicOperator Class Reference

Basic operation collection. More...

#include <GpgBasicOperator.h>

Inheritance diagram for GpgFrontend::GpgBasicOperator:
Inheritance graph
Collaboration diagram for GpgFrontend::GpgBasicOperator:
Collaboration graph

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

GpgContextctx_
 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.
 

Detailed Description

Basic operation collection.

Constructor & Destructor Documentation

◆ GpgBasicOperator()

GpgFrontend::GpgBasicOperator::GpgBasicOperator ( int  channel = SingletonFunctionObject::GetDefaultChannel())
explicit

Construct a new Basic Operator object.

Parameters
channelChannel corresponding to the context

Member Function Documentation

◆ Decrypt()

void GpgFrontend::GpgBasicOperator::Decrypt ( const GFBuffer in_buffer,
const GpgOperationCallback &  cb 
)

Call the interface provided by gpgme for decryption operation.

Parameters
in_bufferdata that needs to be decrypted
out_bufferdecrypted data
resultthe result of the operation
Returns
error code

References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaAsync().

◆ DecryptSync()

auto GpgFrontend::GpgBasicOperator::DecryptSync ( const GFBuffer in_buffer) -> std::tuple<GpgError, DataObjectPtr>

◆ DecryptVerify()

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.

Parameters
in_bufferdata to be manipulated
out_bufferdata resulting from decryption operation
decrypt_resultthe result of the decrypting operation
verify_resultthe result of the verifying operation
Returns
error code

References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaAsync().

◆ DecryptVerifySync()

auto GpgFrontend::GpgBasicOperator::DecryptVerifySync ( const GFBuffer in_buffer) -> std::tuple<GpgError, DataObjectPtr>

◆ EncryptSign()

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.

Parameters
keysList of public keys
signersPrivate key for signatures
in_bufferData for operation
asciiascii mode
Returns

References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), GpgFrontend::RunGpgOperaAsync(), and SetSigners().

◆ EncryptSignSync()

auto GpgFrontend::GpgBasicOperator::EncryptSignSync ( const KeyArgsList &  keys,
const KeyArgsList &  signers,
const GFBuffer in_buffer,
bool  ascii 
) -> std::tuple<GpgError, DataObjectPtr>
Parameters
keys
signers
in_buffer
ascii
cb

References GpgFrontend::CheckGpgError(), GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaSync().

◆ EncryptSymmetric()

void GpgFrontend::GpgBasicOperator::EncryptSymmetric ( const GFBuffer in_buffer,
bool  ascii,
const GpgOperationCallback &  cb 
)

Call the interface provided by GPGME to symmetrical encryption.

Parameters
in_bufferData for encryption
out_bufferEncrypted data
resultEncrypted results
Returns
GpgError

References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaAsync().

◆ EncryptSymmetricSync()

auto GpgFrontend::GpgBasicOperator::EncryptSymmetricSync ( const GFBuffer in_buffer,
bool  ascii 
) -> std::tuple<GpgError, DataObjectPtr>
Parameters
in_buffer
ascii
cb
Returns
std::tuple<GpgError, DataObjectPtr>

References GpgFrontend::CheckGpgError(), GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaSync().

◆ GetSigners()

auto GpgFrontend::GpgBasicOperator::GetSigners ( bool  ascii) -> std::unique_ptr<KeyArgsList>

Get a global signature private keys that has been set.

Returns
Intelligent pointer pointing to the private key list

◆ SetSigners()

void GpgFrontend::GpgBasicOperator::SetSigners ( const KeyArgsList &  signers,
bool  ascii 
)

Set the private key for signatures, this operation is a global operation.

Parameters
keys

References GpgFrontend::CheckGpgError(), and ctx_.

Referenced by EncryptSign(), and Sign().

◆ 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.

Parameters
signersprivate keys for signing operations
in_bufferdata that needs to be signed
out_bufferverified data
modesigning mode
resultthe result of the operation
Returns
error code

References GpgFrontend::CheckGpgError(), ctx_, GpgFrontend::GpgData::Read2GFBuffer(), GpgFrontend::RunGpgOperaAsync(), and SetSigners().

◆ SignSync()

auto GpgFrontend::GpgBasicOperator::SignSync ( const KeyArgsList &  signers,
const GFBuffer in_buffer,
GpgSignMode  mode,
bool  ascii 
) -> std::tuple<GpgError, DataObjectPtr>
Parameters
signers
in_buffer
mode
ascii
cb
Returns
std::tuple<GpgError, DataObjectPtr>

References GpgFrontend::CheckGpgError(), GpgFrontend::GpgData::Read2GFBuffer(), and GpgFrontend::RunGpgOperaSync().

◆ Verify()

void GpgFrontend::GpgBasicOperator::Verify ( const GFBuffer in_buffer,
const GFBuffer sig_buffer,
const GpgOperationCallback &  cb 
)

Call the interface provided by gpgme for verification operation.

Parameters
in_bufferdata that needs to be verified
out_bufferverified data
resultthe result of the operation
Returns
error code

References GpgFrontend::CheckGpgError(), ctx_, and GpgFrontend::RunGpgOperaAsync().

◆ VerifySync()

auto GpgFrontend::GpgBasicOperator::VerifySync ( const GFBuffer in_buffer,
const GFBuffer sig_buffer 
) -> std::tuple<GpgError, DataObjectPtr>
Parameters
in_buffer
sig_buffer
cb
Returns
std::tuple<GpgError, DataObjectPtr>

References GpgFrontend::CheckGpgError(), and GpgFrontend::RunGpgOperaSync().

Member Data Documentation

◆ ctx_

GpgContext& GpgFrontend::GpgBasicOperator::ctx_
private
Initial value:
auto GetChannel() const -> int
Get the Channel object.
Definition: GpgFunctionObject.h:139
static auto GetInstance(int channel=GpgFrontend::kGpgFrontendDefaultChannel) -> GpgContext &
Get the Instance object.
Definition: GpgFunctionObject.h:79

Corresponding context.

Referenced by Decrypt(), DecryptVerify(), EncryptSign(), EncryptSymmetric(), SetSigners(), Sign(), and Verify().


The documentation for this class was generated from the following files: