cpp: Support new archive encryption flag

* lang/cpp/src/context.h (EncryptArchive): New flag.
* lang/cpp/src/context.cpp (encryptflags2encryptflags): Convert
EncryptArchive to corresponding gpgme encrypt flags.
(operator<<): Add new flag to debug stream.
--

GnuPG-bug-id: 6342
This commit is contained in:
Ingo Klöcker 2023-01-27 09:40:05 +01:00
parent 261245a2e0
commit d28ea8c6b3
No known key found for this signature in database
GPG Key ID: F5A5D1692277A1E9
2 changed files with 6 additions and 1 deletions

View File

@ -1335,6 +1335,9 @@ static gpgme_encrypt_flags_t encryptflags2encryptflags(Context::EncryptionFlags
if (flags & Context::Symmetric) { if (flags & Context::Symmetric) {
result |= GPGME_ENCRYPT_SYMMETRIC; result |= GPGME_ENCRYPT_SYMMETRIC;
} }
if (flags & Context::EncryptArchive) {
result |= GPGME_ENCRYPT_ARCHIVE;
}
return static_cast<gpgme_encrypt_flags_t>(result); return static_cast<gpgme_encrypt_flags_t>(result);
} }
@ -1909,6 +1912,7 @@ std::ostream &operator<<(std::ostream &os, Context::EncryptionFlags flags)
CHECK(ExpectSign); CHECK(ExpectSign);
CHECK(NoCompress); CHECK(NoCompress);
CHECK(Symmetric); CHECK(Symmetric);
CHECK(EncryptArchive);
#undef CHECK #undef CHECK
return os << ')'; return os << ')';
} }

View File

@ -447,7 +447,8 @@ public:
NoCompress = 16, NoCompress = 16,
Symmetric = 32, Symmetric = 32,
ThrowKeyIds = 64, ThrowKeyIds = 64,
EncryptWrap = 128 EncryptWrap = 128,
EncryptArchive = 512,
}; };
EncryptionResult encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags); EncryptionResult encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);
GpgME::Error encryptSymmetrically(const Data &plainText, Data &cipherText); GpgME::Error encryptSymmetrically(const Data &plainText, Data &cipherText);