GpgFrontend::KeyPackageOperator Class Reference

give the possibility to import or export a key package More...

`#include <KeyPackageOperator.h>`

Collaboration diagram for GpgFrontend::KeyPackageOperator:

## Static Public Member Functions

static bool | GeneratePassphrase (const std::filesystem::path &phrase_path, std::string &phrase)
| generate passphrase for key package and save it to file More...
static std::string | GenerateKeyPackageName ()
| generate the name of the key package More...
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 More...
static bool | ImportKeyPackage (const std::filesystem::path &key_package_path, const std::filesystem::path &phrase_path, GpgFrontend::GpgImportInformation &import_info)
| import key package More...

## Static Private Member Functions

static std::string | generate_key_package_name ()
| generate key package name More...

## Detailed Description

give the possibility to import or export a key package

## Member Function Documentation

## generate_key_package_name()

static std::string GpgFrontend::KeyPackageOperator::generate_key_package_name | ( |  | ) |

inlinestaticprivate

generate key package name

Returns
  std::string key package name

< Random device

< Mersenne twister

Referenced by GenerateKeyPackageName().

## GenerateKeyPackage()

bool GpgFrontend::KeyPackageOperator::GenerateKeyPackage | ( | const std::filesystem::path & | key_package_path,
|  | const std::string & | key_package_name,
|  | KeyIdArgsListPtr & | key_ids,
|  | std::string & | phrase,
|  | bool | secret
| ) |  |

static

generate key package

Parameters

  key_package_path | path to key package
  key_package_name | name of the key package
  key_ids | key ids to export
  phrase | passphrase to encrypt key package
  secret | true if secret key should be exported

Returns
  true if key package was generated
  false if key package was not generated

References GpgFrontend::SingletonFunctionObject< GpgKeyImportExporter >::GetInstance(), and GpgFrontend::FileOperator::WriteFileStd().

## GenerateKeyPackageName()

std::string GpgFrontend::KeyPackageOperator::GenerateKeyPackageName | ( |  | ) |

static

generate the name of the key package

Returns
  std::string name of the key package

References generate_key_package_name().

Referenced by GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog().

## GeneratePassphrase()

bool GpgFrontend::KeyPackageOperator::GeneratePassphrase | ( | const std::filesystem::path & | phrase_path,
|  | std::string & | phrase
| ) |  |

static

generate passphrase for key package and save it to file

Parameters

  phrase_path | path to passphrase file
  phrase | passphrase generated

Returns
  true if passphrase was generated and saved
  false if passphrase was not generated and saved

References GpgFrontend::PassphraseGenerator::Generate(), GpgFrontend::SingletonFunctionObject< PassphraseGenerator >::GetInstance(), and GpgFrontend::FileOperator::WriteFileStd().

## ImportKeyPackage()

bool GpgFrontend::KeyPackageOperator::ImportKeyPackage | ( | const std::filesystem::path & | key_package_path,
|  | const std::filesystem::path & | phrase_path,
|  | GpgFrontend::GpgImportInformation & | import_info
| ) |  |

static

import key package

Parameters

  key_package_path | path to key package
  phrase_path | path to passphrase file
  import_info | import info

Returns
  true if key package was imported
  false if key package was not imported

References GpgFrontend::SingletonFunctionObject< GpgKeyImportExporter >::GetInstance(), GpgFrontend::GpgKeyImportExporter::ImportKey(), and GpgFrontend::FileOperator::ReadFileStd().

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

- src/core/function/KeyPackageOperator.h
- src/core/function/KeyPackageOperator.cpp