aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg/function/GpgKeyImportExporter.h
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-01-14 11:35:01 +0000
committerSaturneric <[email protected]>2022-01-14 11:35:01 +0000
commit990aefc086795d74170b22055c5051595ce5b0fc (patch)
tree65354401a49d0b8cf2eb82fb17d580abff6476cc /src/gpg/function/GpgKeyImportExporter.h
parent<feat>(project): Generate compile commands.json by default (diff)
downloadGpgFrontend-990aefc086795d74170b22055c5051595ce5b0fc.tar.gz
GpgFrontend-990aefc086795d74170b22055c5051595ce5b0fc.zip
<doc>(core): add comment for code
Diffstat (limited to '')
-rw-r--r--src/gpg/function/GpgKeyImportExporter.h114
1 files changed, 96 insertions, 18 deletions
diff --git a/src/gpg/function/GpgKeyImportExporter.h b/src/gpg/function/GpgKeyImportExporter.h
index 64b3b8a9..52de8091 100644
--- a/src/gpg/function/GpgKeyImportExporter.h
+++ b/src/gpg/function/GpgKeyImportExporter.h
@@ -34,18 +34,31 @@
namespace GpgFrontend {
+/**
+ * @brief
+ *
+ */
class GpgImportedKey {
public:
- std::string fpr;
- int import_status;
+ std::string fpr; ///<
+ int import_status; ///<
};
-typedef std::list<GpgImportedKey> GpgImportedKeyList;
+typedef std::list<GpgImportedKey> GpgImportedKeyList; ///<
+/**
+ * @brief
+ *
+ */
class GpgImportInformation {
public:
GpgImportInformation() = default;
+ /**
+ * @brief Construct a new Gpg Import Information object/**
+ *
+ * @param result
+ */
explicit GpgImportInformation(gpgme_import_result_t result) {
if (result->unchanged) unchanged = result->unchanged;
if (result->considered) considered = result->considered;
@@ -63,49 +76,114 @@ class GpgImportInformation {
if (result->not_imported) not_imported = result->not_imported;
}
- int considered = 0;
- int no_user_id = 0;
- int imported = 0;
- int imported_rsa = 0;
- int unchanged = 0;
- int new_user_ids = 0;
- int new_sub_keys = 0;
- int new_signatures = 0;
- int new_revocations = 0;
- int secret_read = 0;
- int secret_imported = 0;
- int secret_unchanged = 0;
- int not_imported = 0;
- GpgImportedKeyList importedKeys;
+ int considered = 0; ///<
+ int no_user_id = 0; ///<
+ int imported = 0; ///<
+ int imported_rsa = 0; ///<
+ int unchanged = 0; ///<
+ int new_user_ids = 0; ///<
+ int new_sub_keys = 0; ///<
+ int new_signatures = 0; ///<
+ int new_revocations = 0; ///<
+ int secret_read = 0; ///<
+ int secret_imported = 0; ///<
+ int secret_unchanged = 0; ///<
+ int not_imported = 0; ///<
+ GpgImportedKeyList importedKeys; ///<
};
+/**
+ * @brief
+ *
+ */
class GpgKeyImportExporter
: public SingletonFunctionObject<GpgKeyImportExporter> {
public:
+ /**
+ * @brief Construct a new Gpg Key Import Exporter object
+ *
+ * @param channel
+ */
explicit GpgKeyImportExporter(
int channel = SingletonFunctionObject::GetDefaultChannel())
: SingletonFunctionObject<GpgKeyImportExporter>(channel) {}
+ /**
+ * @brief
+ *
+ * @param inBuffer
+ * @return GpgImportInformation
+ */
GpgImportInformation ImportKey(StdBypeArrayPtr inBuffer);
+ /**
+ * @brief
+ *
+ * @param uid_list
+ * @param out_buffer
+ * @param secret
+ * @return true
+ * @return false
+ */
bool ExportKeys(KeyIdArgsListPtr& uid_list, ByteArrayPtr& out_buffer,
bool secret = false) const;
+ /**
+ * @brief
+ *
+ * @param keys
+ * @param outBuffer
+ * @param secret
+ * @return true
+ * @return false
+ */
bool ExportKeys(const KeyArgsList& keys, ByteArrayPtr& outBuffer,
bool secret = false) const;
+ /**
+ * @brief
+ *
+ * @param key
+ * @param out_buffer
+ * @return true
+ * @return false
+ */
bool ExportKey(const GpgKey& key, ByteArrayPtr& out_buffer) const;
+ /**
+ * @brief
+ *
+ * @param key
+ * @param out_buffer
+ * @return true
+ * @return false
+ */
bool ExportKeyOpenSSH(const GpgKey& key, ByteArrayPtr& out_buffer) const;
+ /**
+ * @brief
+ *
+ * @param key
+ * @param outBuffer
+ * @return true
+ * @return false
+ */
bool ExportSecretKey(const GpgKey& key, ByteArrayPtr& outBuffer) const;
+ /**
+ * @brief
+ *
+ * @param key
+ * @param outBuffer
+ * @return true
+ * @return false
+ */
bool ExportSecretKeyShortest(const GpgKey& key,
ByteArrayPtr& outBuffer) const;
private:
GpgContext& ctx =
- GpgContext::GetInstance(SingletonFunctionObject::GetChannel());
+ GpgContext::GetInstance(SingletonFunctionObject::GetChannel()); ///<
};
} // namespace GpgFrontend