aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-10-13cpp,doc: Fix typos in API documentation and source code commentsIngo Klöcker1-1/+1
-- Anonymous contribution Signed-off-by: Ingo Klöcker <[email protected]>
2023-10-05cpp: Support new key capability flagsIngo Klöcker2-0/+37
* lang/cpp/src/key.cpp, lang/cpp/src/key.h (class Key): New methods hasCertify, hasSign, hasEncrypt, hasAuthenticate. -- GnuPG-bug-id: 6748
2023-08-15cpp: Remove unused includeIngo Klöcker4-6/+0
--
2023-08-04cpp: Expose gpgme_decrypt_result_t.is_mime through cpp APICarl Schwan2-0/+6
* lang/cpp/src/descriptionresult.cpp (DescriptionResult::isMime): New. * lang/cpp/src/descriptionresult.h: Update accordingly. -- This exposes the is_mime metadata from a decryption result to users of the C++ library. GnuPG-bug-id: 6199 Signed-off-by: Carl Schwan <[email protected]>
2023-06-16qt, cpp: Support larger size-hint on 32 bit buildsAndre Heinecke2-0/+10
* NEWS: Mention this. * lang/cpp/src/data.h, lang/cpp/src/data.cpp (Data::setSizeHint): New. * lang/qt/src/qgpgmedecryptjob.cpp, lang/qt/src/qgpgmedecryptverifyarchivejob.cpp, lang/qt/src/qgpgmedecryptverifyjob.cpp, lang/qt/src/qgpgmeencryptjob.cpp, lang/qt/src/qgpgmesignencryptjob.cpp, lang/qt/src/qgpgmesignjob.cpp, lang/qt/src/qgpgmeverifydetachedjob.cpp, lang/qt/src/qgpgmeverifyopaquejob.cpp: Set size for input IODevice. -- This fixes the case where the old detection of the size of QIOdevice using seek would overflow and instead explicitly uses QIODevice::size to check for the size and pass it through as an uint64. GnuPG-Bug-Id: T6534
2023-06-16cpp: Expose gpgme_data_set_flag through cpp APIAndre Heinecke2-0/+8
* lang/cpp/src/data.cpp (Data::setFlag): New. * lang/cpp/src/data.h: Update accordingly. * NEWS: Mention this. -- This exposes the generic flag mechanism for data to users of the C++ library. It is similar to Context::setFlag but has no getter.
2023-06-01doc,cpp: Treat GPG_ERR_FULLY_CANCELED as canceledIngo Klöcker1-1/+1
* doc/gpgme.texi (GPG_ERR_FULLY_CANCELED): New. * lang/cpp/src/context.cpp (Error::isCanceled): Also return true for GPG_ERR_FULLY_CANCELED. -- For internal purposes, GnuPG sometimes uses the error code GPG_ERR_FULLY_CANCELED instead of GPG_ERR_CANCELED. From a user perspective both values mean the same thing and should therefore be treated identically. GnuPG-bug-id: 6510
2023-04-18cpp: Fix Key::canSign()Ingo Klöcker2-17/+4
* lang/cpp/src/key.h (canReallySign): Deprecate. * lang/cpp/src/key.cpp (canSign): Remove workaround. Use implementation of canReallySign. (canReallySign): Use canSign(). (operator<<): Use canSign(). -- The workaround in canSign was added 19 years ago and canReallySign, the workaround for the workaround, was added 13 years ago. Time to get rid of those workarounds for a bug in gpgme which has been fixed long ago and which cause bugs for any unsuspecting user of Key::canSign(). GnuPG-bug-id: 6456
2023-03-21core,cpp: Add new key flags to gpgme_subkey_tWerner Koch2-0/+21
* src/gpgme.h.in (struct _gpgme_subkey): Add bit flags can_renc, can_timestamp, adn is_group_owned. Reduce size of _unused. * src/keylist.c (set_subkey_capability): Set them. * tests/run-keylist.c (main): Print them. * lang/cpp/src/key.h (Subkey::canRenc): New. (Subkey::canTimestamp): New. (Subkey::isGroupOwned): New. * lang/cpp/src/key.cpp: Implement new methods. (Subkey::isQualified): Print them. (std::ostream &operator<<): Print them. -- GnuPG-bug-id: 6395
2023-02-09cpp: Improve debug output of some enumsIngo Klöcker1-19/+32
* lang/cpp/src/verificationresult.cpp (operator<<): Fix output of Signature::PKAStatus which doesn't represent flags. Print corresponding name of enum value if Signature::Summary or Notation::Flags are 0. -- GnuPG-bug-id: 6368
2023-02-02cpp: Return successful verification for signed but not encrypted dataIngo Klöcker1-7/+15
* lang/cpp/src/context.cpp (Context::decrypt): Use decryptionResult(). (Context::verifyDetachedSignature, Context::verifyOpaqueSignature): Use verificationResult(). (Context::verificationResult): Ignore "no data" error for signed but not encrypted data. (Context::decryptAndVerify): Use decryptionResult() and verificationResult(). -- gpgme's decrypt operations set the error to GPG_ERR_NO_DATA if no encrypted data was found. It makes sense to use this error for the encryption result, but it doesn't make sense to use it also for the verfication result if signed data was found. This way using the combined decrypt-verify operations on data that may be encrypted and/or signed doesn't produce confusing results. GnuPG-bug-id: 6342
2023-02-02cpp: Update decryption flagsIngo Klöcker1-0/+1
* lang/cpp/src/context.h (DecryptArchive): New flag. -- This flag corresponds to the GPGME_DECRYPT_ARCHIVE flag in gpgme. GnuPG-bug-id: 6342
2023-02-02cpp: Add const-overloads of version comparison operatorsIngo Klöcker1-0/+70
* lang/cpp/src/engineinfo.h (EngineInfo::Version): Add const-overloads of all comparison operators. -- We keep the non-const overloads for binary compatibility. GnuPG-bug-id: 6342
2023-01-31cpp: Fix debug output of SignatureModeIngo Klöcker1-1/+9
* lang/cpp/src/context.cpp (operator<<): Treat signature mode as combination of a 2-bit flag and a 1-bit flag. -- This fixes the output for normal signature mode. GnuPG-bug-id: 6342
2023-01-30cpp: Support new archive signing flagIngo Klöcker3-15/+25
* lang/cpp/src/global.h (enum SignatureMode): Add constant SignArchive. * lang/cpp/src/context.cpp (sigmode2sigmode): Rename to sigflags2sigflags (sigflags2sigflags): ... and rename argument mode to flags and treat it as flags. Adjust the callers. (operator<<): Change local CHECK macro to handle flags. Add new flag to debug stream. * lang/cpp/src/signingresult.cpp (CreatedSignature::mode): Handle new flags (even if it cannot occur currently). -- GnuPG-bug-id: 6342
2023-01-27cpp: Support new archive encryption flagIngo Klöcker2-1/+6
* 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
2023-01-27cpp: Add convenience overload to set file nameIngo Klöcker2-0/+6
* lang/cpp/src/data.h, lang/cpp/src/data.cpp (setFileName): Add overload. -- GnuPG-bug-id: 6342
2023-01-26cpp: Support all encryption flagsIngo Klöcker2-1/+6
* lang/cpp/src/context.h (WantAddress): New flag. * lang/cpp/src/context.cpp (encryptflags2encryptflags): Convert WantAddress to corresponding gpgme encrypt flags. (operator<<): Add new flag to debug stream. -- GnuPG-bug-id: 6359
2023-01-26cpp: Pass ThrowKeyIds and EncryptWrap flags to GpgMEIngo Klöcker1-0/+8
* lang/cpp/src/context.cpp (encryptflags2encryptflags): Convert ThrowKeyIds and EncryptWrap to corresponding gpgme encrypt flags. (operator<<): Add flags to debug stream. -- GnuPG-bug-id: 6359
2023-01-18cpp,doc: Update list of allowed values for dirInfoIngo Klöcker1-1/+1
-- GnuPG-bug-id: 6342
2023-01-05cpp: Fix comparisons of integer expressions of different signednessIngo Klöcker1-2/+2
* lang/cpp/src/gpgrevokekeyeditinteractor.cpp (GpgRevokeKeyEditInteractor::Private::nextState): Cast signed nextLine value to std::size_t. --
2023-01-05cpp: Expliticly declare compiler generated copy constructorsIngo Klöcker15-2/+25
* lang/cpp/src/configuration.h (Component, Option), lang/cpp/src/data.h (Data), lang/cpp/src/decryptionresult.h (DecryptionResult, DecryptionResult::Recipient), lang/cpp/src/encryptionresult.h (EncryptionResult, InvalidRecipient), lang/cpp/src/engineinfo.h (EngineInfo), lang/cpp/src/importresult.h (ImportResult, Import), lang/cpp/src/key.h (Key, Subkey, UserID, UserID::Signature), lang/cpp/src/keygenerationresult.h (KeyGenerationResult), lang/cpp/src/keylistresult.h (KeyListResult), lang/cpp/src/notation.h (Notation), lang/cpp/src/signingresult.h (SigningResult, InvalidSigningKey, CreatedSignature), lang/cpp/src/swdbresult.h (SwdbResult), lang/cpp/src/tofuinfo.h (TofuInfo), lang/cpp/src/verificationresult.h (VerificationResult, Signature), lang/cpp/src/vfsmountresult.h (VfsMountResult): Explitily declare compiler generated copy constructor. -- This fixes "implicitly-declared copy constructor is deprecated" warnings.
2022-12-08cpp: Handle status errors in the base edit interactorIngo Klöcker2-4/+3
* lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl): Handle status errors. * lang/cpp/src/gpgrevokekeyeditinteractor.cpp (GpgRevokeKeyEditInteractor::Private::nextState): Remove handling of status errors. -- With this change status errors are handled for all interactors. In particular, this makes all edit interactors handle canceled password prompts correctly. GnuPG-bug-id: 6305
2022-12-08cpp: Handle statuses that need no response in the base edit interactorIngo Klöcker8-28/+7
* lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl): Do not call nextState() if status needs no response. * lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp (GpgAddExistingSubkeyEditInteractor::Private::nextState), lang/cpp/src/gpgadduserideditinteractor.cpp (GpgAddUserIDEditInteractor::nextState), lang/cpp/src/gpggencardkeyinteractor.cpp (GpgGenCardKeyInteractor::nextState), lang/cpp/src/gpgrevokekeyeditinteractor.cpp (GpgRevokeKeyEditInteractor::Private::nextState), lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp (GpgSetExpiryTimeEditInteractor::nextState), lang/cpp/src/gpgsetownertrusteditinteractor.cpp (GpgSetOwnerTrustEditInteractor::nextState), lang/cpp/src/gpgsignkeyeditinteractor.cpp (GpgSignKeyEditInteractor::nextState): Remove handling of statuses that need no response. -- This change removes superfluous code duplication. GnuPG-bug-id: 6305
2022-10-24cpp: Allow setting the curve to use when generating ECC keysIngo Klöcker2-7/+34
lang/cpp/src/gpggencardkeyinteractor.h (class GpgGenCardKeyInteractor): Add enum Curve. Add member function setCurve. lang/cpp/src/gpggencardkeyinteractor.cpp (class GpgGenCardKeyInteractor::Private): Initialize simple members in-class. Add member curve. (GpgGenCardKeyInteractor::~GpgGenCardKeyInteractor): Use default d'tor. (GpgGenCardKeyInteractor::setCurve): New. (GpgGenCardKeyInteractor::action): Return curve defaulting to Curve25519. -- This enables users of this interactor to request the generation of ECC keys with a specific curve as smart card keys. It's up to the user to specify a curve that is actually supported by the smart card. GnuPG-bug-id: 4429
2022-09-14cpp: Reject signing expired keysIngo Klöcker1-0/+6
* lang/cpp/src/gpgsignkeyeditinteractor.cpp (enum SignKeyState): Add new state REJECT_SIGN_EXPIRED. (makeTable): Add entries for new state to transition map. (GpgSignKeyEditInteractor::action): Handle new state. -- With this change the edit interactor aborts the key signing operation with a "key expired" error instead of with a "general error". GnuPG-bug-id: 6155
2022-08-19cpp: Fix building with C++11Ingo Klöcker1-7/+7
* lang/cpp/src/importresult.cpp (ImportResult::mergeWith): Replace 'auto' in lambdas with the actual type. -- Generic lambdas require C++14. GnuPG-bug-id: 6141
2022-08-18cpp: Fix handling of "no key" or "invalid time" situationsIngo Klöcker1-2/+2
* lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp (GpgAddExistingSubkeyEditInteractor::Private::nextState): Fix inverted logic of string comparisons. -- This fixes the problem that the interactor didn't return the proper error code if gpg didn't accept the key grip or the expiration date. GnuPG-bug-id: 6137
2022-08-09cpp: Add support for gpgme_op_set_uid_flagIngo Klöcker2-0/+13
* lang/cpp/src/context.cpp, lang/cpp/src/context.h (Context::setPrimaryUid, Context::startSetPrimaryUid): New. -- GnuPG-bug-id: 5938
2022-06-30cpp: Remove obsolete compatibility with KF5 variantsIngo Klöcker2-8/+0
* lang/cpp/src/GpgmeppConfig-w32.cmake.in.in, lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove find_package() call. -- The KF5 variants have been removed years ago with revision a3cf30f89418c8a6bc9456533d95ba7fc2a33a4c.
2022-05-12cpp: Export KeyListModeSaverAndre Heinecke1-1/+1
* lang/cpp/src/context.h (Context::KeyListModeSaver): Add Export. -- This is required for Windows.
2022-05-05cpp: Output more properties of a subkeyIngo Klöcker1-3/+9
* lang/cpp/src/key.cpp (ostream operator<< for Subkey): Fix wrong output of isInvalid and isDisabled flags. Add output of key grip, card serial number and the flags isSecret, isQualified, isDeVs, and isCardKey. -- This makes it easier to check those properties for different keys, e.g. with the run-keylist test program. GnuPG-bug-id: 5965
2022-05-04cpp: Allow retrieving import result of key listing with locate modeIngo Klöcker2-3/+10
* lang/cpp/src/context_p.h (enum Context::Private::Operation): Add value KeyListWithImport. * lang/cpp/src/context.cpp (Context::startKeyListing, Context::nextKey): Set lastop to KeyListWithImport if keylist mode includes Locate. -- Adding Import to lastop for keylist operations that perform a locate allows retrieving the import result with Context::importResult. GnuPG-bug-id: 5951
2022-05-04cpp: Allow merging the results of two importsIngo Klöcker2-0/+135
* lang/cpp/src/importresult.h, lang/cpp/src/importresult.cpp (class ImportResult): Add member function mergeWith. -- This allows creating a consolidated result of several independent imports. If the import results to merge considered the same keys, then not all counts can be consolidated correctly, but the important numbers like the number of considered keys, the number of imported keys, the number of unchanged keys and the numbers of new user IDs, subkeys, signatures and revocations should be correct. GnuPG-bug-id: 5951
2022-05-02cpp: Add RAII class for saving/restoring the key list modeIngo Klöcker2-0/+24
* lang/cpp/src/context.h, lang/cpp/src/context.cpp (class Context): Add nested class KeyListModeSaver. -- This RAII-style class can be used to save the currently used key list mode in case it needs to be changed temporarily. On destruction, it will restore the key list mode that was active at construction time. GnuPG-bug-id: 5951
2022-04-27cpp: Support new keylist modesIngo Klöcker3-13/+18
* lang/cpp/src/global.h (ForceExtern, LocateExternal, KeyListModeMask): New. * lang/cpp/src/context.cpp (operator<<): Add check. * lang/cpp/src/util.h (gpgme_keylist_mode_t, convert_from_gpgme_keylist_mode_t): Handle ForceExtern. * lang/cpp/tests/run-getkey.cpp (show_usage, main): Add arguments --force-extern and --locate-external. * lang/cpp/tests/run-keylist.cpp (show_usage, main): Ditto. -- GnuPG-bug-id: 5951
2022-04-22cpp: Allow changing the error of a resultIngo Klöcker1-0/+8
* lang/cpp/src/result.h (class Result): Add member function setError. -- This can be used to replace the error of a result with a more suitable error. GnuPG-bug-id: 5939
2022-04-05cpp: Handle canceling of an edit operationIngo Klöcker1-2/+2
* lang/cpp/src/editinteractor.cpp (CallbackHelper::edit_interactor_callback_impl): Check for error _or_ canceled state. -- Without this canceling an edit operation resulted in a "General error". GnuPG-bug-id: 5904
2022-04-05cpp: Return actual error if revocation failsIngo Klöcker3-0/+22
* lang/cpp/src/editinteractor.cpp, lang/cpp/src/editinteractor.h (EditInteractor::parseStatusError): New. * lang/cpp/src/gpgrevokekeyeditinteractor.cpp (GpgRevokeKeyEditInteractor::Private::nextState): Handle status error. -- With this change the interactor returns a proper error like "Bad Passphrase" or "Empty Passphrase" instead of an unspecific "General Error" if a status error occurred. GnuPG-bug-id: 5904
2022-04-05cpp: Add internal utility function for splitting stringsIngo Klöcker1-0/+13
* lang/cpp/src/util.h (split): New. -- This function splits a given string using the given delimiter into several strings. GnuPG-bug-id: 5904
2022-04-05cpp: Do not export symbols of the Private classIngo Klöcker1-1/+1
* lang/cpp/src/gpgrevokekeyeditinteractor.h (class GpgRevokeKeyEditInteractor): Mark nested class Private as hidden. -- GnuPG-bug-id: 5904
2022-03-30cpp: Add interactor to revoke a keyIngo Klöcker4-0/+283
* lang/cpp/src/global.h (enum class RevocationReason): New. * lang/cpp/src/gpgrevokekeyeditinteractor.cpp, lang/cpp/src/gpgrevokekeyeditinteractor.h: New. * lang/cpp/src/Makefile.am: Add new files. -- GnuPG-bug-id: 5904
2022-03-28cpp: Set default visibility of all symbols to hiddenIngo Klöcker1-1/+2
* configure.ac: Add -fvisibility=hidden to GPGME_CPP_CFLAGS if gcc supports the flag. * lang/cpp/src/Makefile.am (AM_CPPFLAGS): Add GPGME_CPP_CFLAGS. * m4/ax_gcc_func_attribute.m4: New. -- With this change all defined symbols are hidden by default, so that they are not exported anymore. All symbols that are part of the ABI and that shall still be exported are already marked as having default visibility. The m4 macro was taken from the website mentioned in the License header of the file. GnuPG-bug-id: 5906
2022-03-28cpp: Put local helper function into unnamed namespaceIngo Klöcker1-0/+2
lang/cpp/src/context.cpp (to_auditlog_flags): Wrap in unnamed namespace. -- GnuPG-bug-id: 5906
2022-02-03cpp: Allow import of keys given by key idsIngo Klöcker2-0/+20
* lang/cpp/src/context.h (class Context): Add overloads of member functions importKeys and startKeyImport * lang/cpp/src/context.cpp (class Context): ... and implement them. -- GnuPG-bug-id: 5808
2022-02-03cpp: Add internal adapter for passing a vector of strings to gpgmeIngo Klöcker3-2/+73
* lang/cpp/src/util.h (class StringsToCStrings): New. * lang/cpp/src/util.cpp: New. * lang/cpp/src/Makefile.am: Add new file. -- This adapter simplifies passing a vector of strings as NULL-terminated array of const char* to the C-interface of gpgme. GnuPG-bug-id: 5808
2022-01-12cpp: Add interactor to add existing subkeys to other keysIngo Klöcker3-0/+270
* lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp, lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h: New. * lang/cpp/src/Makefile.am: Add new files. -- GnuPG-bug-id: 5770
2022-01-04cpp: Allow export of secret subkeysIngo Klöcker2-4/+30
* lang/cpp/src/context.h (enum Context::ExportMode): Add value ExportSecretSubkey. (class Context): Add member functions exportSecretSubkeys and startSecretSubkeyExport. * lang/cpp/src/context.cpp (Context::exportPublicKeys, Context::startPublicKeyExport): Return error if ExportSecretSubkey mode flag is set. (Context::exportSecretSubkeys, Context::startSecretSubkeyExport): Implement. -- GnuPG-bug-id: 5757
2022-01-04cpp: Allow export of secret keysIngo Klöcker2-13/+87
* lang/cpp/src/context.h (class Context): New member functions exportSecretKeys, startSecretKeyExport, exportKeys, startKeyExport. (Context::exportPublicKeys, Context::startPublicKeyExport): Rename argument flags/export_mode to mode. * lang/cpp/src/context.cpp (Context::exportPublicKeys): Return error if ExportSecret mode flag is set. Call exportKeys(). (Context::startPublicKeyExport): Return error if ExportSecret mode flag is set. Call startKeyExport(). (Context::exportSecretKeys, Context::startSecretKeyExport, Context::exportKeys, Context::startKeyExport): Implement. -- This adds export functions for secret key exports and generic export functions that can be used for any key export supported by gpgme_op_export[_ext][_start]. GnuPG-bug-id: 5757
2022-01-04cpp: Mark ExportNoUID flag as obsoleteIngo Klöcker1-1/+1
* lang/cpp/src/context.h (enum Context::ExportMode): Mark value ExportNoUID as obsolete -- GnuPG-bug-id: 5757