aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Add Assuan transaction that forwards status lines to another objectIngo Klöcker2020-10-234-1/+164
| | | | | | | | | | | | | | | * lang/cpp/src/Makefile.am: Add new files. * lang/cpp/src/interfaces/statusconsumer.h, lang/cpp/src/statusconsumerassuantransaction.cpp, lang/cpp/src/statusconsumerassuantransaction.h: New. * NEWS: Mention new API. -- This Assuan transaction is useful for long running Assuan commands. Classes implementing the StatusConsumer interface can process received status lines while the Assuan command is still running. GnuPG-bug-id: 5066
* cpp, qt: Add missing comparison operators for version info comparisonIngo Klöcker2020-10-231-0/+30
| | | | | | | | | * lang/cpp/src/engineinfo.h (EngineInfo::Version::operator<=, EngineInfo::Version::operator>=, EngineInfo::Version::operator!=): New. * lang/qt/tests/t-various.cpp (TestVarious::testVersion): Add tests for new comparison operators. * NEWS: Mention added API
* cpp, qt: Fix version info comparisonIngo Klöcker2020-10-231-2/+3
| | | | | | | | | | | | * lang/cpp/src/engineinfo.h (EngineInfo::Version::operator>(const Version &)): Fix logic. (EngineInfo::Version::operator>(const char *)): Use Version-overload of operator>. * lang/qt/tests/t-various.cpp: Add test. -- This fixes a logic error that 2.0.0 > 2.0.0 would return true.
* cpp: Update key with --with-secret instead of updating it twiceIngo Klöcker2020-09-081-5/+11
| | | | | | | | | | | * lang/cpp/src/key.cpp (Key::update): Call Context::key() only once with KeyListMode::WithSecret. -- With gpg >= 2.1, get the key with --with-secret instead of first trying to get the secret key and, if that fails, getting the public key. GnuPG-bug-id: 4794
* cpp: Add keylist mode WithSecretIngo Klöcker2020-09-073-3/+13
| | | | | | | | | | * lang/cpp/src/global.h (WithSecret): New. * lang/cpp/src/context.cpp (operator<<): Handle WithSecret. * lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t, convert_from_gpgme_keylist_mode_t): Ditto. -- GnuPG-bug-id: 4794
* cpp: Add missing keylist modesIngo Klöcker2020-09-071-7/+23
| | | | | | | | * lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Sort modes as in enum definition and add missing modes to check. (convert_from_gpgme_keylist_mode_t): Add missing handling of GPGME_KEYLIST_MODE_WITH_TOFU and GPGME_KEYLIST_MODE_WITH_KEYGRIP.
* cpp: Copy some more subkey properties when merging keysIngo Klöcker2020-09-031-0/+4
| | | | | | | | | | | * lang/cpp/src/key.cpp (Key::mergeWith): Also merge secret flag and keygrip -- The keygrip was lost if the result of a public key listing was merged with the result of a secret key listing as done by QGpgMEListAllKeysJob. GnuPG-bug-id: 4794
* cpp: Make private helper a file staticIngo Klöcker2020-08-102-3/+1
| | | | | | | | | * lang/cpp/src/context.h, lang/cpp/src/context.cpp (Context::getLFSeparatedListOfFingerprintsFromSubkeys): Remove from Context; make it a static function instead -- GnuPG-bug-id: 5003
* cpp: Use cstdlib getenv for portabilityAndre Heinecke2020-08-061-1/+2
| | | | | | | | | | * lang/cpp/src/editinteractor.cpp (EditInteractor::Private::Private): Use std::getenv. -- This should fix compiling on MacOS X GnuPG-Bug-Id: T5013
* cpp: Add support for gpgme_op_setexpireIngo Klöcker2020-08-042-1/+72
| | | | | | | | | | | | | | | | * lang/cpp/src/context.cpp (Context::setExpire, Context::startSetExpire): New. (Context::getLFSeparatedListOfFingerprintsFromSubkeys): New helper. * lang/cpp/src/context.h (Context::SetExpireFlags): New enum. (Context::setExpire, Context::startSetExpire): Add prototypes. (Context::getLFSeparatedListOfFingerprintsFromSubkeys): Add as private helper. -- GnuPG-bug-id: 5003
* cpp: Add ostream operator for subkeyIngo Klöcker2020-08-042-0/+23
| | | | | | | | * lang/cpp/src/key.cpp (Subkey): Add ostream operator. * lang/cpp/src/key.h: Update accordingly. -- This is helpful for debugging / showing the state of a subkey.
* qt, cpp: Support export modesAndre Heinecke2020-07-162-10/+46
| | | | | | | | | | | | | * lang/cpp/context.cpp, lang/cpp/context.h (Context::startPublicKeyExport, Context::exportPublicKeys): Extend with flags paramenter. (Context::ExportMode): New. * lang/qt/src/exportjob.h (ExportJob::setExportMode): New. * lang/qt/src/qgpgmeexportjob.cpp, lang/qt/src/qgpgmeexportjob.h: Update accordingly. -- This adds the C++ and Qt API for export modes.
* core: New keylist mode GPGME_KEYLIST_MODE_WITH_KEYGRIP.Werner Koch2020-07-155-3/+10
| | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_KEYGRIP): New. * src/gpgme-json.c (op_keylist): New flag "keygrip". * src/engine-gpg.c (gpg_keylist_build_options): Pass the options. * lang/cpp/src/global.h (WithKeygrip): New. * lang/cpp/src/context.cpp: Add check. * lang/cpp/src/key.cpp (Key::update): Handle WithKeygrip. * lang/cpp/src/verificationresult.cpp: Ditto. * lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Ditto. -- GnuPG-bug-id: 4939 Signed-off-by: Werner Koch <[email protected]>
* cpp, qt: Use uidhash to select uids for signingAndre Heinecke2019-12-134-1/+23
| | | | | | | | | | | | | | | | * lang/cpp/src/gpgsignkeyeditinteractor.cpp (action): Use uidhash instead of number. (GpgSignKeyEditInteractor::setKey): New. * lang/cpp/src/gpgsignkeyeditinteractor.h: Update accordingly. * lang/cpp/src/key.h, lang/cpp/src/key.cpp: Wrap uidhash. * lang/qt/src/qgpgmesignkeyjob.cpp: Set the key. -- Using the uidhash avoids problems when the user ids on --edit-key are different ones then the uids captured by gpgme when listing keys. Or if they are in a different order. This can happen with cached keys or keys with user attributes.
* cpp: Add API to obtain mutliple remarksAndre Heinecke2019-11-042-0/+20
| | | | | | | | | | | * lang/cpp/src/key.cpp, lang/cpp/src/key.h (UserID::remarks): New. * NEWS: Mention this. -- This can be useful if we want to show remarks made by others, too. For: GnuPG-Bug-Id: T4734
* cpp: Fix dupe_ok state for single uidAndre Heinecke2019-11-041-0/+1
| | | | | * lang/cpp/src/gpgsignkeyeditinteractor.cpp (makeTable): Add transition from command to dupe_ok
* cpp: Minor optimization in remark lookupAndre Heinecke2019-11-011-2/+6
| | | | | | | | * lang/cpp/src/key.cpp (UserID::remark): Use C-API. -- The other parts of that function already use the C API so we can also avoid function calls for the keyListMode.
* cpp: Fix adding duplicated sigs on multiple uidsAndre Heinecke2019-11-011-0/+5
| | | | | | | | | | | | * lang/cpp/src/gpgsignkeyeditinteractor.cpp: Add another state DUPE_OK2 to allow gpg looping over all uids. -- When duplicated signatures should be added to multiple user ids GnuPG will ask for each uid so we have to add a transition for that. GnuPG-Bug-Id: T4734
* cpp: Add env var to control editinteractor debugAndre Heinecke2019-11-011-2/+17
| | | | | | | | | | | | * lang/cpp/src/editinteractor.cpp (EditInteractor::Private::Private): Read "GPGMEPP_INTERACTOR_DEBUG" env var. (EditInteractor::Private::~Private): Close debug file. -- While it was possible for the application to control the debug through setDebugChannel it is often times helpful to just debug without changing the application using GPGME
* cpp: Add support for multiple keysigs in editAndre Heinecke2019-10-292-1/+19
| | | | | | | | | | | | | | | | * lang/cpp/src/gpgsignkeyeditinteractor.cpp (GpgSignKeyEditInteractor::setDupeOk): New. (makeTable): Add new tansitions. (SignKeyState): Add DUPE_OK Status. (GpgSignKeyEditInteractor::action): Handle DUPE_OK. (GpgSignKeyEditInteractor::Private::Private): Carry flag. -- When extended-edit is enabled this can be used to answer the "dupe_ok" query from the edit-key with yes. This is for: GnuPG-Bug-Id: T4734
* cpp: Add convenience API to obtain remarksAndre Heinecke2019-10-292-0/+67
| | | | | | | | | | | * lang/cpp/src/key.h, lang/cpp/src/key.cpp (UserID::remark): New. -- A remark made by one key on another is a signature notation on a user id certification signature with the name "[email protected]". This helps with: GnuPG-Bug-Id: T4734
* cpp: Minor coding style fixAndre Heinecke2019-10-291-3/+2
| | | | --
* cpp: Fix initialization warningAndre Heinecke2019-05-031-1/+1
| | | | | * lanc/cpp/src/gpggencardkeyinteractor.cpp (GpgGenCardKeyInteractor::Private): Fix initialization warning.
* cpp: Add wrapper for gpgme_set_global_flagAndre Heinecke2019-04-242-0/+8
| | | | | | | | * lang/cpp/src/context.cpp (setGlobalFlag): New. * lang/cpp/src/global.h (setGlobalFlag): Export it. -- GnuPG-Bug-Id: T4471
* cpp: Fix GenCardKeyInteractor and extend itAndre Heinecke2019-03-262-2/+139
| | | | | | | | | | | | | | * NEWS: Mention interface change. * lang/cpp/src/gpggencardkeyinteractor.cpp (GpgGenCardKeyInteractor::setAlgo): New. (GpgGenCardKeyInteractor::action), (GpgGenCardKeyInteractor::nextState: Handle new interface. -- Tested that this workes with the old interface of GnuPG 2.2.5 and the new interface since GnuPG 2.2.6 GnuPG-Bug-Id: T4428
* cpp: Fix Error::hasSystemErrorAndre Heinecke2019-03-131-1/+1
| | | | | | | | | * lang/cpp/src/context.cpp (Error::hasSystemError): Invert logic to do what it says. -- This is safe because according to codesearch it is only used in QGpgME
* cpp: Add ostream operators for import resultAndre Heinecke2019-02-212-1/+46
| | | | | * lang/cpp/src/importresult.cpp: Add ostream operators. * lang/cpp/src/importresult.h: Update accordingly.
* cpp: Make GpgME::Data::toKeys really constAndre Heinecke2019-02-211-0/+2
| | | | | | | | * lang/cpp/src/data.cpp (GpgME::Data::toKeys): Rewind afterards. -- This fixes unexpected behavior that the seek pointer is changed after calling the const toKeys.
* qt,cpp: Consistently use nullptr and overrideAndre Heinecke2018-12-0337-250/+252
| | | | | | | | | | | | | | | * lang/cpp/src/Makefile.am, lang/qt/src/Makefile.am (AM_CPPFLAGS): Add suggest-override and zero-as-null-pointer-constant warnings. * lang/cpp/src/*, lang/qt/src/*: Consistenly use nullptr and override. -- This was especially important for the headers so that downstream users of GpgME++ or QGpgME do not get flooded by warnings if they have these warnings enabled. It also improves compiler errors/warnings in case of accidental mistakes.
* spelling: fix misspellingsDaniel Kahn Gillmor2018-11-081-1/+1
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* cpp: Add some convenience functionsAndre Heinecke2018-10-254-0/+41
| | | | | | | | | | | | | | | | * lang/cpp/src/context.cpp (Context::create): New. * lang/cpp/src/context.h: Update accordingly. * lang/cpp/src/key.cpp, lang/cpp/src/key.h: (Key::isBad, Subkey::isBad, UserID::isBad) (UserID::Signature::isBad): Add shorthand for the isX checks. * NEWS: Mention it. -- I don't know how often I wrote: if (key.isNull() || key.isExpired() || key.isRevoked() ... And for the context it is good practice to use a unique ptr so the API should make it easy.
* cpp: Add KeyListMode::LocateAndre Heinecke2018-10-091-0/+1
| | | | | | | * cpp/src/global.h (KeyListMode): Add Locate. -- Similar to locate in core.
* cpp: Initialize all gpgme_key_t's in contextAndre Heinecke2018-10-091-3/+3
| | | | | | | | | * lang/cpp/src/context.cpp (Context::startKeyListing), (Context::keyListResult, Context::signingKeys): Initialize key. -- "Should" not be neccessary but it's cleaner and would have covered the case of the previous commit.
* cpp: Fix use after free in gencardkeyinteractorAndre Heinecke2018-08-081-5/+4
| | | | | | | | | | | * lang/cpp/src/gpggencardkeyinteractor.cpp (GpgGenCardKeyInteractor::Private::keysize): Change to string. -- The value is only required as string so we can save it this way to avoid the need to convert it for the action command. GnuPG-Bug-Id: T4094
* cpp: Add safety checks for key updateAndre Heinecke2018-07-242-1/+4
| | | | | | | * lang/cpp/src/key.cpp (Key::update): Check that the key is not NULL. * lang/cpp/src/verificationresult.cpp (GpgME::Signature::key): Check for fingerprint.
* cpp: Print origin and last update for key/uidAndre Heinecke2018-07-191-0/+4
| | | | | * lang/cpp/src/key.cpp: Print origin and last update in iostream operators.
* cpp: Add enum mapping for GPGME_AUDIT_LOG_DIAGAndre Heinecke2018-07-052-0/+5
| | | | | * src/context.cpp (to_auditlog_flags): Map DIAG value. * src/context.h (AuditLogFlags): Add it.
* cpp: Fix memory of DecryptionResult::symkeyAlgoAndre Heinecke2018-07-041-0/+7
| | | | | * lang/cpp/src/decryptionresult.cpp (Private, ~Private): strdup the symkey algo.
* cpp: Add proper gpgme_op_createkeyAndre Heinecke2018-06-082-0/+25
| | | | | | | | | | * lang/cpp/src/context.cpp, lang/cpp/src/context.h (Context::createKeyEx): New. -- The createKeyEx function follows the usual pattern that the synchronous call returns a result directly while for the async an extra call is neccessary.
* cpp: Add gpgme_(get)set_ctx_flagAndre Heinecke2018-06-012-0/+14
| | | | | | * NEWS: Mention API extensions. * lang/cpp/src/context.cpp, lang/cpp/src/context.h (Context::setFlag, Context::getFlag): New.
* cpp: Add legacy_cipher_nomdcAndre Heinecke2018-06-012-0/+8
| | | | | | | * lang/cpp/src/decryptionresult.cpp, lang/cpp/src/decryptionresult.h (DecryptionResult::isLegacyCipherNoMDC): New. --
* cpp: Add gpgme_data_rewind to cpp APIAndre Heinecke2018-05-292-0/+8
| | | | | | | | | | | * lang/cpp/src/data.h, lang/cpp/src/data.cpp (Data::rewind): New. * lang/qt/tests/t-various.cpp (testDataRewind): Test it. -- The advantage of this convieniance function in GPGME is that it avoids the messiness that are declarations with off_t. GnuPG-Bug-Id: T3996
* cpp: Expose sessionKey and symkeyAlgoAndre Heinecke2018-05-222-0/+15
| | | | | * lang/cpp/decryptionresult.cpp, lang/cpp/decryptionresult.h (DecryptionResult::symkeyAlgo, DecryptionResult::sessionKey): New.