fix: update date field on signing

This commit is contained in:
saturneric 2024-11-28 21:25:55 +01:00
parent e7948aa6c0
commit 799ec5c9b2
2 changed files with 8 additions and 4 deletions

View File

@ -664,6 +664,10 @@ auto SignEMLData(int channel, const QString& key,
"application/pgp-signature")); "application/pgp-signature"));
content_type_header_field->setBoundary(body_boundary); content_type_header_field->setBoundary(body_boundary);
// update date field
auto datetime_header_field = header->Date();
datetime_header_field->setValue(vmime::datetime::now());
auto root_body_part = vmime::make_shared<vmime::body>(); auto root_body_part = vmime::make_shared<vmime::body>();
auto container_part = vmime::make_shared<vmime::bodyPart>(); auto container_part = vmime::make_shared<vmime::bodyPart>();
auto mime_part = vmime::make_shared<vmime::bodyPart>(); auto mime_part = vmime::make_shared<vmime::bodyPart>();

View File

@ -52,7 +52,7 @@ GF_MODULE_API_DEFINE("com.bktus.gpgfrontend.module.gnupg_info_gathering",
DEFINE_TRANSLATIONS_STRUCTURE(ModuleGnuPGInfoGathering); DEFINE_TRANSLATIONS_STRUCTURE(ModuleGnuPGInfoGathering);
extern auto CalculateBinaryChacksum(const QString &path) extern auto CalculateBinaryChecksum(const QString &path)
-> std::optional<QString>; -> std::optional<QString>;
extern void GetGpgComponentInfos(void *, int, const char *, const char *); extern void GetGpgComponentInfos(void *, int, const char *, const char *);
@ -186,7 +186,7 @@ auto StartGatheringGnuPGInfo() -> int {
return 0; return 0;
} }
auto CalculateBinaryChacksum(const QString &path) -> std::optional<QString> { auto CalculateBinaryChecksum(const QString &path) -> std::optional<QString> {
// check file info and access rights // check file info and access rights
QFileInfo const info(path); QFileInfo const info(path);
if (!info.exists() || !info.isFile() || !info.isReadable()) { if (!info.exists() || !info.isFile() || !info.isReadable()) {
@ -258,7 +258,7 @@ void GetGpgComponentInfos(void *data, int exit_code, const char *out,
c_i_gpgconf.desc = "GPG Configure"; c_i_gpgconf.desc = "GPG Configure";
c_i_gpgconf.version = "/"; c_i_gpgconf.version = "/";
c_i_gpgconf.path = context->gpgconf_path; c_i_gpgconf.path = context->gpgconf_path;
auto gpgconf_binary_checksum = CalculateBinaryChacksum(context->gpgconf_path); auto gpgconf_binary_checksum = CalculateBinaryChecksum(context->gpgconf_path);
c_i_gpgconf.binary_checksum = c_i_gpgconf.binary_checksum =
(gpgconf_binary_checksum.has_value() ? gpgconf_binary_checksum.value() (gpgconf_binary_checksum.has_value() ? gpgconf_binary_checksum.value()
: QString("/")); : QString("/"));
@ -292,7 +292,7 @@ void GetGpgComponentInfos(void *data, int exit_code, const char *out,
component_path.replace("%3a", ":"); component_path.replace("%3a", ":");
#endif #endif
auto binary_checksum = CalculateBinaryChacksum(component_path); auto binary_checksum = CalculateBinaryChecksum(component_path);
MLogDebug( MLogDebug(
QString("gnupg component name: %1 desc: %2 checksum: %3 path: %4") QString("gnupg component name: %1 desc: %2 checksum: %3 path: %4")