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... | |
gpg_error_t | Encrypt (KeyListPtr keys, BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, GpgEncrResult &result) |
Call the interface provided by gpgme for encryption operation. More... | |
gpg_error_t | EncryptSymmetric (BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, GpgEncrResult &result) |
Call the interface provided by GPGME to symmetrical encryption. More... | |
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. More... | |
gpgme_error_t | Decrypt (BypeArrayRef in_buffer, ByteArrayPtr &out_buffer, GpgDecrResult &result) |
Call the interface provided by gpgme for decryption operation. More... | |
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 time. More... | |
gpgme_error_t | Verify (BypeArrayRef in_buffer, ByteArrayPtr &sig_buffer, GpgVerifyResult &result) const |
Call the interface provided by gpgme for verification operation. More... | |
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. More... | |
void | SetSigners (KeyArgsList &signers) |
Set the private key for signatures, this operation is a global operation. More... | |
std::unique_ptr< KeyArgsList > | GetSigners () |
Get a global signature private keys that has been set. More... | |
Public Member Functions inherited from GpgFrontend::SingletonFunctionObject< GpgBasicOperator > | |
int | GetChannel () const |
Get the Channel object. More... | |
SingletonFunctionObject (GpgBasicOperator &&)=delete | |
Construct a new Singleton Function Object object. More... | |
SingletonFunctionObject (const GpgBasicOperator &)=delete | |
Construct a new Singleton Function Object object. More... | |
void | operator= (const GpgBasicOperator &)=delete |
Private Attributes | |
GpgContext & | ctx_ |
Corresponding context. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from GpgFrontend::SingletonFunctionObject< GpgBasicOperator > | |
static GpgBasicOperator & | GetInstance (int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL) |
Get the Instance object. More... | |
static GpgBasicOperator & | CreateInstance (int channel, std::function< std::unique_ptr< GpgBasicOperator >(void)> factory) |
Create a Instance object. More... | |
static GpgBasicOperator & | CreateInstance (int channel, std::unique_ptr< GpgBasicOperator > p_obj=nullptr) |
Create a Instance object. More... | |
static GpgBasicOperator & | ReleaseChannel (int channel) |
static int | GetDefaultChannel () |
Get the Default Channel object. More... | |
Protected Member Functions inherited from GpgFrontend::SingletonFunctionObject< GpgBasicOperator > | |
SingletonFunctionObject ()=default | |
Construct a new Singleton Function Object object. More... | |
SingletonFunctionObject (int channel) | |
Construct a new Singleton Function Object object. More... | |
virtual | ~SingletonFunctionObject ()=default |
Destroy the Singleton Function Object object. More... | |
void | SetChannel (int channel) |
Set the Channel object. More... | |
Basic operation collection.
|
explicit |
Construct a new Basic Operator object.
channel | Channel corresponding to the context |
Copyright (C) 2021 Saturneric
This file is part of GpgFrontend.
GpgFrontend is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
GpgFrontend is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GpgFrontend. If not, see https://www.gnu.org/licenses/.
The initial version of the source code is inherited from the gpg4usb project, which is under GPL-3.0-or-later.
All the source code of GpgFrontend was modified and released by Saturnericeric@ starting on May 12, 2021. bktu s.com
SPDX-License-Identifier: GPL-3.0-or-later
GpgFrontend::GpgError GpgFrontend::GpgBasicOperator::Decrypt | ( | BypeArrayRef | in_buffer, |
GpgFrontend::ByteArrayPtr & | out_buffer, | ||
GpgFrontend::GpgDecrResult & | result | ||
) |
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::_new_result(), GpgFrontend::check_gpg_error(), and GpgFrontend::GpgData::Read2Buffer().
Referenced by GpgFrontend::GpgFileOpera::DecryptFile(), and GpgFrontend::UI::MainWindow::slot_decrypt().
gpgme_error_t GpgFrontend::GpgBasicOperator::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 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::_new_result(), GpgFrontend::check_gpg_error(), and GpgFrontend::GpgData::Read2Buffer().
Referenced by GpgFrontend::GpgFileOpera::DecryptVerifyFile(), and GpgFrontend::UI::MainWindow::slot_decrypt_verify().
GpgFrontend::GpgError GpgFrontend::GpgBasicOperator::Encrypt | ( | KeyListPtr | keys, |
GpgFrontend::BypeArrayRef | in_buffer, | ||
GpgFrontend::ByteArrayPtr & | out_buffer, | ||
GpgFrontend::GpgEncrResult & | result | ||
) |
Call the interface provided by gpgme for encryption operation.
All incoming data pointers out_buffer will be replaced with new valid values
keys | list of public keys |
in_buffer | data that needs to be encrypted |
out_buffer | encrypted data |
result | the result of the operation |
References GpgFrontend::_new_result(), GpgFrontend::check_gpg_error(), and GpgFrontend::GpgData::Read2Buffer().
Referenced by GpgFrontend::GpgFileOpera::EncryptFile(), and GpgFrontend::UI::MainWindow::slot_encrypt().
gpgme_error_t GpgFrontend::GpgBasicOperator::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.
keys | List of public keys |
signers | Private key for signatures |
in_buffer | Data for operation |
out_buffer | Encrypted data |
encr_result | Encrypted results |
sign_result | Signature result |
References GpgFrontend::_new_result(), GpgFrontend::check_gpg_error(), and GpgFrontend::GpgData::Read2Buffer().
Referenced by GpgFrontend::GpgFileOpera::EncryptSignFile(), and GpgFrontend::UI::MainWindow::slot_encrypt_sign().
gpg_error_t GpgFrontend::GpgBasicOperator::EncryptSymmetric | ( | BypeArrayRef | in_buffer, |
ByteArrayPtr & | out_buffer, | ||
GpgEncrResult & | result | ||
) |
Call the interface provided by GPGME to symmetrical encryption.
in_buffer | Data for encryption |
out_buffer | Encrypted data |
result | Encrypted results |
References GpgFrontend::_new_result(), GpgFrontend::check_gpg_error(), and GpgFrontend::GpgData::Read2Buffer().
Referenced by GpgFrontend::GpgFileOpera::EncryptFileSymmetric(), and GpgFrontend::UI::MainWindow::slot_encrypt().
std::unique_ptr< GpgFrontend::KeyArgsList > GpgFrontend::GpgBasicOperator::GetSigners | ( | ) |
Get a global signature private keys that has been set.
void GpgFrontend::GpgBasicOperator::SetSigners | ( | KeyArgsList & | signers | ) |
Set the private key for signatures, this operation is a global operation.
keys |
References GpgFrontend::check_gpg_error().
Referenced by GpgFrontend::GpgKeyManager::SignKey().
GpgFrontend::GpgError GpgFrontend::GpgBasicOperator::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.
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::_new_result(), GpgFrontend::check_gpg_error(), and GpgFrontend::GpgData::Read2Buffer().
Referenced by GpgFrontend::GpgFileOpera::SignFile(), and GpgFrontend::UI::MainWindow::slot_sign().
GpgFrontend::GpgError GpgFrontend::GpgBasicOperator::Verify | ( | BypeArrayRef | in_buffer, |
ByteArrayPtr & | sig_buffer, | ||
GpgVerifyResult & | result | ||
) | const |
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::_new_result(), and GpgFrontend::check_gpg_error().
Referenced by GpgFrontend::UI::MainWindow::slot_verify(), and GpgFrontend::GpgFileOpera::VerifyFile().
|
private |
Corresponding context.