aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* cpp,doc: Fix typos in API documentation and source code commentsIngo Klöcker2023-10-132-2/+2
| | | | | | | | -- Anonymous contribution Signed-off-by: Ingo Klöcker <[email protected]>
* cpp: Support new key capability flagsIngo Klöcker2023-10-052-0/+37
| | | | | | | | * lang/cpp/src/key.cpp, lang/cpp/src/key.h (class Key): New methods hasCertify, hasSign, hasEncrypt, hasAuthenticate. -- GnuPG-bug-id: 6748
* cpp: Remove unused includeIngo Klöcker2023-08-156-8/+0
| | | | --
* cpp: Expose gpgme_decrypt_result_t.is_mime through cpp APICarl Schwan2023-08-042-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]>
* qt, cpp: Support larger size-hint on 32 bit buildsAndre Heinecke2023-06-162-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
* cpp: Expose gpgme_data_set_flag through cpp APIAndre Heinecke2023-06-162-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.
* doc,cpp: Treat GPG_ERR_FULLY_CANCELED as canceledIngo Klöcker2023-06-011-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
* cpp,python: Respect --disable-gpg-test for testsBiswapriyo Nath2023-05-301-1/+7
| | | | | | | | | | | lang/cpp/Makefile.am (SUBDIRS): Depend tests in RUN_GPG_TESTS. lang/python/Makefile.am (SUBDIRS): Ditto. -- This is similar to the core and qt switch to disable the tests. Signed-off-by: Biswapriyo Nath <[email protected]> ChangeLog entries added by wk.
* cpp: Fix Key::canSign()Ingo Klöcker2023-04-182-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
* core,cpp: Add new key flags to gpgme_subkey_tWerner Koch2023-03-212-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
* cpp: Improve debug output of some enumsIngo Klöcker2023-02-091-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
* cpp: Return successful verification for signed but not encrypted dataIngo Klöcker2023-02-021-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
* cpp: Update decryption flagsIngo Klöcker2023-02-021-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
* cpp: Add const-overloads of version comparison operatorsIngo Klöcker2023-02-021-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
* cpp: Fix debug output of SignatureModeIngo Klöcker2023-01-311-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
* Merge branch 'ikloecker/t6342-gpgtar' into masterWerner Koch2023-01-316-16/+37
|\ | | | | | | | | | | | | | | -- Solved conflicts: NEWS lang/cpp/src/context.cpp lang/cpp/src/context.h
| * cpp: Support new archive signing flagIngo Klöcker2023-01-303-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
| * cpp: Support new archive encryption flagIngo Klöcker2023-01-272-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
| * cpp: Add convenience overload to set file nameIngo Klöcker2023-01-272-0/+6
| | | | | | | | | | | | | | | | * lang/cpp/src/data.h, lang/cpp/src/data.cpp (setFileName): Add overload. -- GnuPG-bug-id: 6342
| * cpp,doc: Update list of allowed values for dirInfoIngo Klöcker2023-01-181-1/+1
| | | | | | | | | | | | -- GnuPG-bug-id: 6342
* | cpp: Support all encryption flagsIngo Klöcker2023-01-262-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
* | cpp: Pass ThrowKeyIds and EncryptWrap flags to GpgMEIngo Klöcker2023-01-261-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
* cpp: Fix comparisons of integer expressions of different signednessIngo Klöcker2023-01-051-2/+2
| | | | | | | * lang/cpp/src/gpgrevokekeyeditinteractor.cpp (GpgRevokeKeyEditInteractor::Private::nextState): Cast signed nextLine value to std::size_t. --
* cpp: Expliticly declare compiler generated copy constructorsIngo Klöcker2023-01-0515-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.
* cpp: Handle status errors in the base edit interactorIngo Klöcker2022-12-082-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
* cpp: Handle statuses that need no response in the base edit interactorIngo Klöcker2022-12-088-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
* cpp: Allow setting the curve to use when generating ECC keysIngo Klöcker2022-10-242-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
* cpp: Reject signing expired keysIngo Klöcker2022-09-141-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
* cpp: Fix building with C++11Ingo Klöcker2022-08-191-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
* cpp: Fix handling of "no key" or "invalid time" situationsIngo Klöcker2022-08-181-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
* cpp: Add support for gpgme_op_set_uid_flagIngo Klöcker2022-08-092-0/+13
| | | | | | | | * lang/cpp/src/context.cpp, lang/cpp/src/context.h (Context::setPrimaryUid, Context::startSetPrimaryUid): New. -- GnuPG-bug-id: 5938
* cpp: Remove obsolete compatibility with KF5 variantsIngo Klöcker2022-06-302-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.
* cpp: Export KeyListModeSaverAndre Heinecke2022-05-121-1/+1
| | | | | | | * lang/cpp/src/context.h (Context::KeyListModeSaver): Add Export. -- This is required for Windows.
* cpp: Output more properties of a subkeyIngo Klöcker2022-05-051-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
* cpp,tests: Actually parse the --with-secret optionIngo Klöcker2022-05-051-0/+4
| | | | | | | | | | | * lang/cpp/tests/run-keylist.cpp (main): Handle --with-secret option. Print error for unknown option. -- The --with-secret option was already listed in the help. Now it also works. GnuPG-bug-id: 5965
* cpp: Allow retrieving import result of key listing with locate modeIngo Klöcker2022-05-042-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
* cpp: Allow merging the results of two importsIngo Klöcker2022-05-042-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
* cpp: Add RAII class for saving/restoring the key list modeIngo Klöcker2022-05-022-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
* cpp,tests: Verify that requested keylist mode is usedIngo Klöcker2022-04-282-0/+12
| | | | | | | | | | | | * lang/cpp/tests/run-getkey.cpp, lang/cpp/tests/run-keylist.cpp (main): Check used keylist mode. -- Since Context::setKeyListMode() does not return the error returned by gpgme, we need to verify explicitly that the keylist mode was set successfully. GnuPG-bug-id: 5951
* cpp: Support new keylist modesIngo Klöcker2022-04-275-13/+34
| | | | | | | | | | | | | | * 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
* cpp: Allow changing the error of a resultIngo Klöcker2022-04-221-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
* cpp: Handle canceling of an edit operationIngo Klöcker2022-04-051-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
* cpp: Return actual error if revocation failsIngo Klöcker2022-04-053-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
* cpp: Add internal utility function for splitting stringsIngo Klöcker2022-04-051-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
* cpp: Do not export symbols of the Private classIngo Klöcker2022-04-051-1/+1
| | | | | | | | * lang/cpp/src/gpgrevokekeyeditinteractor.h (class GpgRevokeKeyEditInteractor): Mark nested class Private as hidden. -- GnuPG-bug-id: 5904
* cpp: Add interactor to revoke a keyIngo Klöcker2022-03-304-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
* cpp: Set default visibility of all symbols to hiddenIngo Klöcker2022-03-281-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
* cpp: Put local helper function into unnamed namespaceIngo Klöcker2022-03-281-0/+2
| | | | | | | lang/cpp/src/context.cpp (to_auditlog_flags): Wrap in unnamed namespace. -- GnuPG-bug-id: 5906
* cpp: Allow import of keys given by key idsIngo Klöcker2022-02-032-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
* cpp: Add internal adapter for passing a vector of strings to gpgmeIngo Klöcker2022-02-033-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