aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* cpp,doc: Update list of allowed values for dirInfoIngo Klöcker2023-01-181-1/+1
| | | | | | -- GnuPG-bug-id: 6342
* 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
* cpp: Add interactor to add existing subkeys to other keysIngo Klöcker2022-01-123-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
* cpp: Allow export of secret subkeysIngo Klöcker2022-01-042-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
* cpp: Allow export of secret keysIngo Klöcker2022-01-042-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
* cpp: Mark ExportNoUID flag as obsoleteIngo Klöcker2022-01-041-1/+1
| | | | | | | | * lang/cpp/src/context.h (enum Context::ExportMode): Mark value ExportNoUID as obsolete -- GnuPG-bug-id: 5757
* cpp: Remove obsolete workaroundIngo Klöcker2022-01-041-18/+0
| | | | | | | | | | | | | * lang/cpp/src/context.cpp (Context::startKeyListing, Context::exportPublicKeys, Context::startPublicKeyExport): Remove workaround. -- gpgme_op_keylist_ext[_start] supports GPGME_KEYLIST_MODE_EXTERN since a long time. And the export doesn't use a keylisting (anymore), so that the keylisting mode is irrelevant for the export. GnuPG-bug-id: 5757
* cpp: Check fpr of import status for NULLIngo Klöcker2021-12-221-1/+3
| | | | | | | | * lang/cpp/src/importresult.cpp (GpgME::ImportResult::Private): Check fpr for NULL. -- GnuPG-bug-id: 5713
* cpp,tests: Add test runner for doing a WKD lookup without importIngo Klöcker2021-12-102-1/+166
| | | | | | | | | | | | | | | | | * lang/cpp/tests/Makefile.am (run_wkdlookup_SOURCES, programs_unix): New. (noinst_PROGRAMS): Add $(programs_unix). * lang/cpp/tests/run-wkdlookup.cpp: New. -- This test runner is a prototype for doing a WKD lookup without implicit import of the found key(s). Building this test runner is disabled on Windows because it may not work there. Feel free to enable it on Windows if the test runner works there. GnuPG-bug-id: 5728
* cpp: Add new supported components to API docs of dirInfo()Ingo Klöcker2021-12-101-1/+2
| | | | | | | lang/cpp/src/global.h: Update API doc of dirInfo(). -- GnuPG-bug-id: 5727
* cpp: Return engine info for engine used by the contextIngo Klöcker2021-12-071-1/+1
| | | | | | | | | | | | | | lang/cpp/src/context.cpp (Context::engineInfo()): Return engine info for protocol of context. -- This change also fixes Context::setEngineFileName() and Context::setEngineHomeDirectory() which overwrote home dir resp. file name of the engine info for the protocol of context with the corresponding value of the "first" engine info (i.e. engine info for gpg) instead of keeping the current home dir resp. file name. GnuPG-bug-id: 5722
* cpp: Factor out common code of GpgME::engineInfo() overloadsIngo Klöcker2021-12-071-28/+26
| | | | | | | | | | * lang/cpp/src/context.cpp (get_engine_info, get_static_engine_info): New. (GpgME::engineInfo(GpgME::Protocol), GpgME::engineInfo(GpgME::Engine)): Use get_static_engine_info(). -- GnuPG-bug-id: 5722
* core: Support dirinfo("socketdir")Werner Koch2021-11-251-1/+1
| | | | | | | | | | | | | | | | | | | * src/dirinfo.c (WANT_SOCKETDIR): New. (dirinfo): Add field socketdir. (parse_output): Support "socketdir". (get_gpgconf_item): Return socketdir. * tests/t-engine-info.c (main): Add socketdir to the output. * src/w32-util.c (_gpgme_create_process_utf8): Fix indentation. -- GnuPG-bug-id: 5613 This is not strictly necessary because we could deduce this from one of the other socket info items but it is more clean to have a dedicated info item. The socketdir item is available for 5 years now (GnuPG commit 8e3fa5a4b205c534de2142e5d071712f957cf06a)
* cpp: Do not close stdout/stderr when destroying EditInteractorIngo Klöcker2021-05-061-7/+6
| | | | | | | | | | | | | | | * lang/cpp/src/editinteractor.cpp (EditInteractor::Private): Initialize members 'state' and 'debug' in-class. Add member 'debugNeedsClosing'. (EditInteractor::Private::Private): Remove members initializers. Remember if 'debug' needs to be closed. (EditInteractor::Private::~Private): Only close 'debug' if it needs to be closed. -- This fixes the problem that after destroying an edit interactor all debug output went to /dev/null instead of stderr (or stdout) if one enabled debugging of the edit interactors with GPGMEPP_INTERACTOR_DEBUG set to stderr (or stdout).
* cpp: Add support for trust signatures to sign key edit interactorIngo Klöcker2021-05-052-10/+45
| | | | | | | | | | | | | | | | * lang/cpp/src/gpgsignkeyeditinteractor.h, lang/cpp/src/gpgsignkeyeditinteractor.cpp (GpgSignKeyEditInteractor::setTrustSignatureTrust): New. (GpgSignKeyEditInteractor::setTrustSignatureDepth): New. (GpgSignKeyEditInteractor::setTrustSignatureScope): New. * lang/cpp/src/gpgsignkeyeditinteractor.cpp (GpgSignKeyEditInteractor::Private::Private): Initialize new member. (makeTable): Add new transition. Fix typos in existing transitions. (GpgSignKeyEditInteractor::action): Handle SET_TRUST_VALUE, SET_TRUST_DEPTH, and SET_TRUST_REGEXP. -- GnuPG-bug-id: 5245, 5421
* cpp: Add getters for the attributes of a trust signatureIngo Klöcker2021-05-052-0/+34
| | | | | | | | | | | | * lang/cpp/src/key.h (TrustSignatureTrust): New enum. * lang/cpp/src/key.h, lang/cpp/src/key.cpp (UserID::Signature::isTrustSignature): New. (UserID::Signature::trustValue): New. (UserID::Signature::trustDepth): New. (UserID::Signature::trustScope): New. -- GnuPG-bug-id: 5245, 5420
* cpp: Add const-overload of UserID::Signature::operator<Ingo Klöcker2021-01-042-1/+9
| | | | | | | | | lang/cpp/src/key.h, lang/cpp/src/key.cpp (UserID::Signature::operator<): Add const-overload. Deprecate non-const overload. -- This fixes compilation on FreeBSD with clang 10.
* Revert "cpp: Use portable off_t size_t"Andre Heinecke2020-11-203-7/+147
| | | | | | | | | This reverts commit 88294023c196497cfa6737be262c8b0c09d2a3ce. -- This commit was too early and i needed to test more this is breaking more then it helps so for now revert it before we can do a proper solution.
* cpp: Use portable off_t size_tAndre Heinecke2020-11-183-147/+7
| | | | | | | | | | | | | | | | | * configure.ac: Configure cpp data.h.in * lang/cpp/src/Makefile.am: Generate data.h * lang/cpp/src/data.cpp, lang/cpp/src/data.h: Use portable types. * lang/qt/src/Makefile.am: Include build dir. * lang/qt/tests/makefile.am: Include build dir. -- These kind of patches have been around for a while, IMO this should not create an ABI incompatbility for cases where it already works because the types should be the same so I think this is not an interface break. GnuPG-Bug-Id: T3996
* cpp: Mark helper functions as staticIngo Klöcker2020-11-031-6/+6
| | | | | lang/cpp/src/key.cpp (find_subkey, verify_subkey, find_uid, verify_uid, find_signature, verify_signature): Mark as static.
* cpp: Make signatures belonging to the same user ID sortableIngo Klöcker2020-11-032-1/+63
| | | | | | | | | | | | | | | | | lang/cpp/src/key.h, lang/cpp/src/key.cpp (UserID::Signature::operator<): New. lang/cpp/src/key.cpp (signature_index): New. -- operator< defines a canonical sort order for signatures belonging to the same user ID. It is based on the sort order defined by cmp_signodes() in g10/keylist.c of gnupg. In particular, the ordering of signatures made with the same key by creation time allows to see easily whether the most recent signature is a certification or a revocation. GnuPG-bug-id: 5094 recent
* cpp: Add support for gpgme_op_revsigIngo Klöcker2020-10-292-12/+57
| | | | | | | | | | | | * lang/cpp/src/context.cpp, lang/cpp/src/context.h (Context::revokeSignature, Context::startRevokeSignature): New. * lang/cpp/src/context.cpp (getLFSeparatedListOfStrings, getLFSeparatedListOfUserIds): New. (getLFSeparatedListOfFingerprintsFromSubkeys): Extracted second part of function to getLFSeparatedListOfStrings. -- GnuPG-bug-id: 5094
* cpp: Add support for gpgme_cancelIngo Klöcker2020-10-232-0/+6
| | | | | | | | | | | | | * lang/cpp/src/context.cpp, lang/cpp/context.h (Context::cancelPendingOperationImmediately): New. * NEWS: Mention added API -- This allows immediate canceling of running operations, e.g. when a thread with a long running operation (like SCD DEVINFO --watch) is going to be terminated (on application shutdown). GnuPG-bug-id: 5066