Commit Graph

242 Commits

Author SHA1 Message Date
Ingo Klöcker
1dbfc419ad
Unify spelling of the name of the C++ bindings for GpgME
* lang/cpp/README, lang/cpp/src/GpgmeppConfig-w32.cmake.in.in,
lang/cpp/src/GpgmeppConfig.cmake.in.in,
lang/cpp/src/GpgmeppConfigVersion.cmake.in,
lang/cpp/src/Makefile.am, lang/cpp/tests/run-getkey.cpp,
lang/cpp/tests/run-keylist.cpp, lang/cpp/tests/run-verify.cpp,
lang/cpp/tests/run-wkdlookup.cpp, lang/qt/README: Replace GpgMEpp with
GpgME++.
* lang/cpp/src/GpgmeppConfig-w32.cmake.in.in,
lang/cpp/src/GpgmeppConfig.cmake.in.in,
lang/cpp/src/GpgmeppConfigVersion.cmake.in,
lang/cpp/src/Makefile.am: Replace GPGME-CL (c&p error) with GpgME++.
* lang/cpp/tests/Makefile.am: Replace GPGME with GPGME++.
* lang/cpp/tests/run-getkey.cpp, lang/cpp/tests/run-keylist.cpp,
lang/cpp/tests/run-verify.cpp: Replace QGpgME (c&p error) with GpgME++.
--
2024-06-11 15:06:57 +02:00
Ingo Klöcker
6334960bbe
build,cpp: Support building C++ bindings as nested package of gpgme
* Makefile.am: Add variables languages, dist_languages,
distcheck_languages, release_languages, sign_release_languages,
distclean_languages. Add rules for nested language bindings.
(distclean-local, dist-all, distcheck-all, release-all,
sign-release-all): New rules.
(.PHONY): Add all new rules.
* autogen-all.sh: New.
* configure.ac: Add cpp to available languages if subdir exists. Add
cpp to nested languages if enabled to generate corresponding make
targets. Call configure script of nested cpp package recursively.
* lang/cpp/configure.ac: Check if gpgmepp is built as nested package
and set GPGME_CFLAGS and GPGME_LIBS accordingly.
--

This re-adds the ability to build the C++ bindings together with gpgme
with a single `configure && make` command (if building from git). It
also adds make targets for running dist, distcheck, release and
sign-release for gpgme and all enabled nested languages with a single
make command.

GnuPG-bug-id: 7110
2024-06-11 14:58:00 +02:00
Ingo Klöcker
28c23ce8db
build,cpp: Separate C++ bindings from gpgme
* configure.ac: Remove definition and substitution of
LIBGPGMEPP_LT_CURRENT, LIBGPGMEPP_LT_AGE, LIBGPGMEPP_LT_REVISION.
Remove "cpp" from available_languages and from default_languages.
Remove checks for C++ 11 and for support of visibility attribute.
Remove substitution of GPGME_CPP_CFLAGS.
Remove definition and substitution of GPGMEPP_PKGCONFIG_LIBS,
GPGMEPP_PKGCONFIG_CFLAGS, GPGMEPP_PKGCONFIG_HOST.
Remove generation of files in lang/cpp.
* lang/Makefile.am (DIST_SUBDIRS): Remove cpp.
* lang/cpp/.gitignore, lang/cpp/AUTHORS, lang/cpp/COPYING,
lang/cpp/COPYING.LESSER, lang/cpp/COPYING.LIB, lang/cpp/ChangeLog,
lang/cpp/INSTALL, lang/cpp/NEWS, lang/cpp/autogen.rc,
lang/cpp/autogen.sh, lang/cpp/configure.ac: New.
* lang/cpp/Makefile.am (EXTRA_DIST): Add autogen.sh, autogen.rc,
VERSION.
(RELEASE_ARCHIVE_SUFFIX, ACLOCAL_AMFLAGS, dist-hook, distcheck-hook,
.PHONY, gen_start_date, gen-ChangeLog, RELEASE_NAME, release,
sign-release): New (copied from top-level Makefile.am).
* lang/cpp/build-aux/compile, lang/cpp/build-aux/config.guess,
lang/cpp/build-aux/config.sub, lang/cpp/build-aux/depcomp,
lang/cpp/build-aux/install-sh, lang/cpp/build-aux/libtool-patch.sed,
lang/cpp/build-aux/ltmain.sh, lang/cpp/build-aux/missing: New.
* m4/ax_cxx_compile_stdcxx.m4: Move to...
* lang/cpp/m4/ax_cxx_compile_stdcxx.m4: ...here.
* m4/ax_gcc_func_attribute.m4: Move to...
* lang/cpp/m4/ax_gcc_func_attribute.m4: ...here.
* lang/cpp/m4/gpg-error.m4, lang/cpp/m4/gpgme.m4,
lang/cpp/m4/libtool.m4, lang/cpp/m4/ltoptions.m4,
lang/cpp/m4/ltsugar.m4, lang/cpp/m4/ltversion.m4,
lang/cpp/m4/lt~obsolete.m4: New.
* lang/cpp/src/GpgmeppConfig-w32.cmake.in.in,
lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove @LIBASSUAN_LIBS@ from
INTERFACE_LINK_LIBRARIES of Gpgmepp target.
* lang/cpp/src/Makefile.am (AM_CPPFLAGS): Replace include paths of
gpgme relative to top_builddir with @GPGME_CFLAGS@. Remove
@LIBASSUAN_CFLAGS@.
(libgpgmepp_la_LIBADD): Replace relative paths of libgpgme.la with
@GPGME_LIBS@. Remove @LIBASSUAN_LIBS@.
* lang/cpp/tests/Makefile.am (LDADD): Replace relative paths of
libgpgme.la with @GPGME_LIBS@.
(AM_CPPFLAGS): Replace include paths of gpgme relative to top_builddir
with @GPGME_CFLAGS@. Remove @LIBASSUAN_CFLAGS@. Remove -DTOP_SRCDIR.
--

This makes building and distributing GpgME++ independent of the sources
of gpgme. Many of the new files are copied from gpgme to make GpgME++ a
self-contained package. A later commit re-adds the possibility to build
GpgME++ as nested package together with gpgme.

GnuPG-bug-id: 7110
2024-06-11 14:23:40 +02:00
Ingo Klöcker
e64dd7ee51
cpp: Don't include config.h
* lang/cpp/src/*.cpp, lang/cpp/tests/*.cpp: Remove config.h include.
--

The C++ binding sources don't need anything from config.h.

GnuPG-bug-id: 7110
2024-06-11 14:23:40 +02:00
Ingo Klöcker
76b38f54a5
cpp: Add pkgconfig file for gpgmepp
* configure.ac: Add substitutions GPGMEPP_PKGCONFIG_LIBS,
GPGMEPP_PKGCONFIG_CFLAGS, GPGMEPP_PKGCONFIG_HOST. Apply them. Configure
gpgmepp.pc file.
* lang/cpp/src/Makefile.am (pkgconfigdir, pkgconfig_DATA): New.
(EXTRA_DIST): Add gpgmepp.pc.in.
* lang/cpp/src/gpgmepp.pc.in: New.
--

This pkgconfig file will be used by qgpgme to find gpgmepp.

GnuPG-bug-id: 7110
2024-06-10 14:58:53 +02:00
Ingo Klöcker
8be031ebdb
build,cpp: Create forwarding headers in a gpgme++ folder
* lang/cpp/src/Makefile.am (copied_headers): New.
(build rule for all copied headers): New.
(BUILT_SOURCES): New.
(CLEANFILES): Add copied_headers.
--

The forwarding headers make it easier to use the headers from the Qt
bindings when building them against the built but not installed C++
bindings because we can always include the C++ headers with gpgme++/
prefix.

GnuPG-bug-id: 7110
2024-06-10 14:58:53 +02:00
Ingo Klöcker
4136928f0d
cpp: Remove commented out and disabled code
* lang/cpp/src/configuration.cpp: Remove disabled, abandoned code.
* lang/cpp/src/context.cpp: Remove commented out, obsolete code.
--
2024-06-10 14:54:48 +02:00
Ingo Klöcker
6aa359b1e8
cpp: Fix includes in public headers
* lang/cpp/src/defaultassuantransaction.h,
lang/cpp/src/gpgadduserideditinteractor.h,
lang/cpp/src/gpgagentgetinfoassuantransaction.h,
lang/cpp/src/gpggencardkeyinteractor.h,
lang/cpp/src/gpgsetexpirytimeeditinteractor.h,
lang/cpp/src/gpgsetownertrusteditinteractor.h,
lang/cpp/src/gpgsignkeyeditinteractor.h,
lang/cpp/src/interfaces/assuantransaction.h,
lang/cpp/src/interfaces/dataprovider.h,
lang/cpp/src/interfaces/statusconsumer.h,
lang/cpp/src/scdgetinfoassuantransaction.h,
lang/cpp/src/statusconsumerassuantransaction.h,
lang/cpp/src/trustitem.h: Use #include "foo.h" instead of
#include <foo.h> for own headers.
--

This fixes the build for projects that include the headers (as intended)
with #include <gpgme++/...> and that don't add the gpgme++ subdirectory
to the list of include paths for the compiler.

GnuPG-bug-id: 7110
2024-05-24 10:51:32 +02:00
Ingo Klöcker
f0d1f2c4c7
Merge branch 'ikloecker/t7118-revkeys' 2024-05-24 10:47:15 +02:00
Tobias Fella
15718cb295
qt,cpp: Implement adding ADSKs to existing keys
* lang/cpp/src/context.cpp: Add functions for adding ADSKs.
* lang/cpp/src/context.h: Ditto.
* lang/qt/src/qgpgmequickjob.cpp: Add implementation of ADSK job.
* lang/qt/src/qgpgmequickjob.h: Ditto.
* lang/qt/src/quickjob.h: Add job for adding ADSKs.
2024-05-22 13:08:50 +02:00
Ingo Klöcker
90eb80134b
cpp: Add information about revocation keys to Key
* lang/cpp/src/gpgmefw.h (gpgme_revocation_key_t): New forward
declaration.
* lang/cpp/src/key.cpp, lang/cpp/src/key.h (class Key): New methods
revocationKey, numRevocationKeys, revocationKeys.
(class RevocationKey): New.
(swap): New overload for RevocationKey.
(operator<<): New overload for RevocationKey.
* lang/cpp/src/key.cpp (operator<<): Add information about revocation
keys to the output stream for Key.

* lang/cpp/tests/run-keylist.cpp (main): Don't output Key if nextKey
failed, e.g. at the end of the key listing.
--

GnuPG-bug-id: 7118
2024-05-21 16:38:59 +02:00
Ingo Klöcker
e4a95746ad
cpp: Handle smart card op failure status messages
* lang/cpp/src/editinteractor.cpp (parse_sc_op_failure): New.
(CallbackHelper::edit_interactor_callback_impl): Parse failure code on
GPGME_STATUS_SC_OP_FAILURE status.
(sc_op_failure_to_error): New.
--

This converts a SC_OP_FAILURE status message logged by gpg to a
corresponding error. Unfortunately, GPG_ERR_BAD_PIN and
GPG_ERR_BAD_RESET_CODE are mapped to the same SC_OP_FAILURE code, so
that we had to choose one.

GnuPG-bug-id: 6971
2024-04-05 15:08:01 +02:00
Ingo Klöcker
85c7a94d63
cpp,tests: Launch dirmngr with gpg-conf
* lang/cpp/tests/run-wkdlookup.cpp (main): Replace backslashes with
forward slashes in homedir returned by GpgME::dirInfo. Use "gpgconf
--launch dirmngr" to start dirmngr.
--

With this change the same code as by QGpgMEWKDLookupJob is again used to
launch dirmngr. It also fixes the bad example of starting dirmngr
without the help of gpgconf.

GnuPG-bug-id: 6833
2024-01-09 11:22:43 +01:00
Ingo Klöcker
60c0fd7c95
cpp: Support new flags for direct signing/encryption of files
* lang/cpp/src/context.h (enum EncryptionFlags): Add constant
EncryptFile.
* lang/cpp/src/global.h (enum SignatureMode): Add constant SignFile.
* lang/cpp/src/context.cpp (sigflags2sigflags): Handle new flag
SignFile.
(encryptflags2encryptflags): Handle new flag EncryptFile.
(operator<<): Add new flags to the corresponding debug streams.
* lang/cpp/src/signingresult.cpp (CreatedSignature::mode): Handle
new flag SignFile (even if it cannot occur).
--

GnuPG-bug-id: 6550
2023-12-19 14:01:18 +01:00
Ingo Klöcker
bd448c9cbf
cpp,doc: Fix typos in API documentation and source code comments
--

Anonymous contribution

Signed-off-by: Ingo Klöcker <dev@ingo-kloecker.de>
2023-10-13 09:21:47 +02:00
Ingo Klöcker
a9e5a25b56
cpp: Support new key capability flags
* lang/cpp/src/key.cpp, lang/cpp/src/key.h (class Key): New methods
hasCertify, hasSign, hasEncrypt, hasAuthenticate.
--

GnuPG-bug-id: 6748
2023-10-05 15:27:52 +02:00
Ingo Klöcker
7a2a3f317b
cpp: Remove unused include
--
2023-08-15 11:50:28 +02:00
Carl Schwan
8701e98937
cpp: Expose gpgme_decrypt_result_t.is_mime through cpp API
* 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 <carl.schwan@gnupg.com>
2023-08-04 11:34:27 +02:00
Andre Heinecke
5811d069d3
qt, cpp: Support larger size-hint on 32 bit builds
* 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-16 14:33:19 +02:00
Andre Heinecke
cbcea4a09b
cpp: Expose gpgme_data_set_flag through cpp API
* 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-16 12:35:36 +02:00
Ingo Klöcker
7990f70107
doc,cpp: Treat GPG_ERR_FULLY_CANCELED as canceled
* 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-06-01 09:37:41 +02:00
Biswapriyo Nath
e2103be390
cpp,python: Respect --disable-gpg-test for tests
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 <nathbappai@gmail.com>
ChangeLog entries added by wk.
2023-05-30 11:44:17 +02:00
Ingo Klöcker
5bd84cfd3f
cpp: Fix Key::canSign()
* 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-04-18 13:16:22 +02:00
Werner Koch
6d21256c92
core,cpp: Add new key flags to gpgme_subkey_t
* 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-03-21 08:37:47 +01:00
Ingo Klöcker
3aaed9cfbf
cpp: Improve debug output of some enums
* 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-09 09:56:18 +01:00
Ingo Klöcker
1698eec2ae
cpp: Return successful verification for signed but not encrypted data
* 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-02 12:11:29 +01:00
Ingo Klöcker
b3bdf14b37
cpp: Update decryption flags
* 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-02 09:56:22 +01:00
Ingo Klöcker
8478064691
cpp: Add const-overloads of version comparison operators
* 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-02-02 09:47:10 +01:00
Ingo Klöcker
41a30f6d9f
cpp: Fix debug output of SignatureMode
* 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-31 12:01:33 +01:00
Werner Koch
3cdcfa33f7
Merge branch 'ikloecker/t6342-gpgtar' into master
--
Solved conflicts:
	NEWS
	lang/cpp/src/context.cpp
	lang/cpp/src/context.h
2023-01-31 07:59:50 +01:00
Ingo Klöcker
2faa031af2
cpp: Support new archive signing flag
* 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-30 12:49:12 +01:00
Ingo Klöcker
d28ea8c6b3
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
2023-01-27 12:16:02 +01:00
Ingo Klöcker
261245a2e0
cpp: Add convenience overload to set file name
* lang/cpp/src/data.h, lang/cpp/src/data.cpp (setFileName): Add
overload.
--

GnuPG-bug-id: 6342
2023-01-27 12:14:10 +01:00
Ingo Klöcker
3e31f648e5
cpp: Support all encryption flags
* 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-26 12:01:28 +01:00
Ingo Klöcker
70aaf05a6a
cpp: Pass ThrowKeyIds and EncryptWrap flags to GpgME
* 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-26 12:01:10 +01:00
Ingo Klöcker
1a9dfdfccb
cpp,doc: Update list of allowed values for dirInfo
--

GnuPG-bug-id: 6342
2023-01-18 10:33:54 +01:00
Ingo Klöcker
2e9d72a0be
cpp: Fix comparisons of integer expressions of different signedness
* lang/cpp/src/gpgrevokekeyeditinteractor.cpp
(GpgRevokeKeyEditInteractor::Private::nextState): Cast signed nextLine
value to std::size_t.
--
2023-01-05 20:29:27 +01:00
Ingo Klöcker
dc9cc9aa07
cpp: Expliticly declare compiler generated copy constructors
* 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.
2023-01-05 20:17:57 +01:00
Ingo Klöcker
e7953dcf13
cpp: Handle status errors in the base edit interactor
* 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-08 15:31:37 +01:00
Ingo Klöcker
c419376b85
cpp: Handle statuses that need no response in the base edit interactor
* 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-12-08 15:31:21 +01:00
Ingo Klöcker
d9ac138595
cpp: Allow setting the curve to use when generating ECC keys
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-10-24 12:22:09 +02:00
Ingo Klöcker
eedaaf7016
cpp: Reject signing expired keys
* 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-09-14 10:41:38 +02:00
Ingo Klöcker
f02c20cc9c cpp: Fix building with C++11
* 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-19 11:05:37 +02:00
Ingo Klöcker
2fa5c80aeb cpp: Fix handling of "no key" or "invalid time" situations
* 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-18 10:43:19 +02:00
Ingo Klöcker
125867f268 cpp: Add support for gpgme_op_set_uid_flag
* lang/cpp/src/context.cpp, lang/cpp/src/context.h
(Context::setPrimaryUid, Context::startSetPrimaryUid): New.
--

GnuPG-bug-id: 5938
2022-08-09 14:52:42 +02:00
Ingo Klöcker
6e45da30ae cpp: Remove obsolete compatibility with KF5 variants
* 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
a3cf30f894.
2022-06-30 12:30:15 +02:00
Andre Heinecke
f3011b5a19
cpp: Export KeyListModeSaver
* lang/cpp/src/context.h (Context::KeyListModeSaver): Add Export.

--
This is required for Windows.
2022-05-12 09:34:15 +02:00
Ingo Klöcker
306fd9c915 cpp: Output more properties of a subkey
* 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-05 17:25:47 +02:00
Ingo Klöcker
e029fd2735 cpp,tests: Actually parse the --with-secret option
* 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
2022-05-05 17:24:59 +02:00
Ingo Klöcker
3519d61173 cpp: Allow retrieving import result of key listing with locate mode
* 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-04 14:31:03 +02:00