+2016-11-16 Werner Koch <wk@gnupg.org>
+
+ Release 1.8.0.
+ * configure.ac: Set version to 1.8.0. Set LT version C28/A17/RO.
+ Set CPP LT version to C9/A3/R0. Set Qt LT version to C8/A1/R0.
+
+ core: Do not leak the override session key to ps(1).
+ * src/engine-gpg.c (struct engine_gpg): New field
+ override_session_key.
+ (gpg_release): Free that field.
+ (gpg_decrypt): With gnupg 2.1.16 use --override-session-key-fd.
+
+ * tests/run-decrypt.c (main): Fix setting over the override key.
+
+2016-11-16 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+
+ doc,tests: Require use of ctx_flag before use of session_key.
+ * doc/gpgme.texi: Document requirements of verifying that it is OK to
+ use session_key.
+ * tests/run-decrypt.c: Ensure that we fail if we're unable to access
+ the session key, so that we do not violate the guidance above.
+
+
+ Changed the description
+
+ -@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns
+ -@code{GPG_ERR_NO_ERROR} or @code{gpgme_get_ctx_flag (ctx,
+ -"export-session-key")} returns @code{"1"}.
+ +@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success
+ +or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true
+ +(non-empty string).
+
+ to get gpgme_get_ctx_flag for boolean values in sync with its own
+ description.
+
+ Note that I don't agree with the above suggestion but it does not
+ really harm to have it in the man page.
+
+2016-11-15 Andre Heinecke <aheinecke@intevation.de>
+
+ qt, cpp: Add cmake config files for w32.
+ * lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
+ lang/qt/src/QGpgmeConfig-w32.cmake.in.in: New.
+ * lang/cpp/src/GpgmeppConfig.cmake.in.in,
+ lang/qt/src/QGpgmeConfig.cmake.in.in: Remove libsuffix handling.
+ * lang/cpp/src/Makefile.am,
+ lang/qt/src/Makefile.am: Create / install w32 config files.
+ * configure.ac: Configure them.
+
+ qt: Use new style connect in th..mixin.
+ * lang/qt/src/threadedjobmixin.h
+ (ThreadedJobMixin::lateInitialization): Use new style connect.
+
+2016-11-15 Werner Koch <wk@gnupg.org>
+
+ core: Implement context flag "override-session-key".
+ * src/gpgme.c (gpgme_set_ctx_flag): Add flags "export-session-key" and
+ "override-session-key".
+ (gpgme_get_ctx_flag): Ditto.
+ (gpgme_set_export_session_keys): Remove.
+ (gpgme_get_export_session_keys): Remove.
+ * src/gpgme.def, src/libgpgme.vers: Remove them.
+ * src/context.h (struct gpgme_context): Add field
+ override_session_key.
+ * src/decrypt-verify.c (decrypt_verify_start): Pass
+ override_session_key value to the engine.
+ * src/decrypt.c (decrypt_start): Ditto.
+ * src/engine.c (_gpgme_engine_op_decrypt): Ditto.
+ (_gpgme_engine_op_decrypt_verify): Ditto.
+ * src/engine-backend.h (struct engine_ops): Extend DECRYPT and
+ DECRYPT_VERIFY_START with override_session_key.
+ * src/engine-uiserver.c (_uiserver_decrypt): Add stub arg
+ override_session_key.
+ (uiserver_decrypt): Ditto.
+ (uiserver_decrypt_verify): Ditto.
+ * src/engine-gpgsm.c (gpgsm_decrypt): Ditto.
+ * src/engine-gpg.c (gpg_decrypt): Add arg override_session_key and set
+ corresponding gpg option.
+
+ * tests/run-decrypt.c (print_result): Print the session key if
+ available.
+ (main): Add options --export-session-key and --override-session-key.
+
+ core: Add public function gpgme_get_ctx_flag.
+ * src/gpgme.h.in (gpgme_get_ctx_flag): New.
+ * src/gpgme.c (gpgme_set_ctx_flag): Move down the file and add a trace
+ statement.
+ (gpgme_get_ctx_flag): New.
+ * src/gpgme.def, src/libgpgme.vers: Add new interface.
+
+2016-11-15 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+
+ core: Enable extraction of session keys.
+ * src/gpgme.c (gpgme_set_export_session_keys): New function.
+ (gpgme_get_export_session_keys): New function.
+ * src/gpgme.h.in (struct _gpgme_op_decrypt_result): Add session_key
+ member.
+ (gpgme_{set,get}_export_session_keys): Declare new functions.
+ * src/libgpgme.vers, src/gpgme.def: Export new functions in shared
+ object.
+ * src/engine.h: (_gpgme_engine_op_decrypt) Add export_session_key
+ parameter.
+ (_gpgme_engine_op_decrypt_verify): Add export_session_key parameter.
+ * src/engine-backend.h: (struct engine_ops): Change function
+ pointer declarations to match.
+ * src/context.h (struct gpgme_context): Add export_session_keys member.
+ * src/decrypt.c (release_op_data): Free result.session_key.
+ (_gpgme_decrypt_status_handler): Store a copy of the exported session
+ key.
+ (decrypt_start): Pass export_session_keys from the context.
+ * src/decrypt-verify.c (decrypt_verify_start): Pass
+ export_session_keys from context.
+ * src/engine.c (_gpgme_engine_op_decrypt): Pass through
+ export_session_key flag.
+ (_gpgme_engine_op_decrypt_verify): Pass through export_session_key
+ flag.
+ * src/engine-gpg.c (gpg_decrypt): If export_session_key is set, add
+ --export-session-key to argument list.
+ * src/engine-gpgsm.c (gpgsm_decrypt): Ignore export_session_key for
+ now, since gpgsm offers no such mechanism.
+ * src/engine-uiserver.c (_uiserver_decrypt): If export_session_key is
+ set, add --export-session-key flag to cmd.
+ * doc/gpgme.texi: Document new functions and session_key member of
+ decrypt_result_t.
+ * doc/uiserver.texi: Add --export-session-key flag to DECRYPT command.
+
+2016-11-14 Andre Heinecke <aheinecke@intevation.de>
+
+ qt: Add API to get the context for a Job.
+ * lang/qt/src/job.cpp,
+ lang/qt/src/job.h (Job::context): New.
+ * lang/qt/src/threadedjobmixin.cpp
+ (ThreadedJobMixin::~ThreadedJobMixin): New. Unregister context.
+ (ThreadedJobMixin::lateInitialization): Register context.
+ * NEWS: Update for cpp and qt.
+
+ cpp: Add get / set Sender API.
+ * cpp/src/context.cpp, cpp/src/context.h (Context::setSender),
+ (Context::getSender): Add simple wrappers.
+
+ qt, cpp: Enable dll build for windows.
+ * lang/cpp/src/Makefile.am,
+ lang/qt/src/Makefile.am: Add -no-undefined to LDFLAGS.
+
+ w32: Fix build of w32-glib.
+ * src/Makefile.am (main_sources): Remove system_components_not_extra.
+ (libgpgme_la_SOURCES): Add system_components_not_extra.
+ (libgpgme_glib_la_SOURCES): Remove duplicated ath files.
+
+2016-11-11 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+
+ doc: Correct deftypefun for gpgme_op_decrypt_verify_start.
+ * doc/gpgme.texi: Documentationabout gpgme_op_decrypt_verify_start was
+ stored under the name gpgme_op_decrypt_verify instead.
+
+ doc: Correct text about gpgme_cancel_async.
+ * doc/gpgme.texi: Documentation about gpgme_cancel_async should refer
+ to the correct name.
+
+ core: Non-zero values should set _armor, _textmode, and _online.
+ * src/gpgme.c (gpgme_set_armor, gpgme_set_textmode,
+ gpgme_set_offline): Ensure that non-zero values actually set the
+ appropriate internal bit.
+
+2016-11-11 Alon Bar-Lev <alon.barlev@gmail.com>
+
+ tests,python: Atomic directory creation.
+ * lang/python/tests/Makefile.am: Use MIDIR_P.
+ * tests/gpg/Makefile.am: Ditto.
+ * tests/gpgsm/Makefile.am: Ditto.
+
+2016-11-10 Werner Koch <wk@gnupg.org>
+
+ core: Use better error code when using select with a too high fd.
+ * src/posix-io.c (_gpgme_io_select): Return EMFILE instead of EBADF.
+
+2016-11-10 Andre Heinecke <aheinecke@intevation.de>
+
+ tests: Reduce thread count in new thread tests.
+ * gpg/t-thread-keylist-verify.c,
+ gpg/t-thread-keylist.c: Reduce threads to 100
+
+2016-11-10 Werner Koch <wk@gnupg.org>
+
+ core: Detect unreadable keyrings.
+ * src/keylist.c (op_data_t): Add field keydb_search_err.
+ (keylist_status_handler): Parse STATUS_ERROR into that var.
+ (gpgme_op_keylist_next): Use that err instead of GPG_ERR_EOF.
+
+2016-11-10 Andre Heinecke <aheinecke@intevation.de>
+
+ tests: Fix additional memleaks in thread tests.
+ * tests/gpg/t-thread-keylist-verify.c (start_verify): Release
+ data.
+ (start_keylist): Unref keys.
+ * tests/gpg/t-thread-keylist.c (start_keylist): Unref keys.
+
+ tests: Improve new thread tests.
+ * tests/gpg/t-thread-keylist-verify.c (start_keylist): Mark
+ arg as unused. Release context.
+ (start_verify): Ditto.
+ (main): Mark args as unused.
+ * tests/gpg/t-thread-keylist.c (start_keylist): Mark
+ arg as unused. Release context.
+ (main): Mark args as unused.
+
+ core: Use gpgrt locking for thread safeness.
+ * configure.ac: Require libgpg-error 1.17. No longer
+ check for pthread.
+ * doc/gpgme.texi: Document removed neccessity for thread
+ safe gpgme flavours.
+ * src/sema.h (DEFINE_GLOBAL_LOCK),
+ (DEFINE_STATIC_LOCK, INIT_LOCK, DECLARE_LOCK)
+ (DESTROY_LOCK, LOCK, UNLOCK): Change to gpgrt equivalents.
+ * src/posix-sema.c, src/w32-sema.c: Removed.
+ * src/Makefile.am: Remove libpthread and
+ Update accordingly.
+ * src/ath.c, src/ath.h (ath_mutex_init)
+ (ath_mutex_destroy, ath_mutex_lock, ath_mutex_unlock): Removed.
+ * src/ath.h (ATH_MUTEX_INITIALIZER): Removed.
+ * src/version.c (do_subsystem_inits): sema_subsystem_init is
+ no longer required.
+ * tests/gpg/Makefile.am: Add new threading tests.
+ (t_thread1_LDADD, t_cancel_LDADD):
+ Use just gpgme.
+ * tests/gpg/t-thread-keylist-verify.c,
+ tests/gpg/t-thread-keylist.c: New.
+ * src/gpgme-config.in: Use -lgpgme for thread-model pthread.
+
+2016-11-09 Justus Winter <justus@g10code.com>
+
+ python: Require at least GPGME 1.7 for out-of-tree builds.
+ * lang/python/setup.py.in: Bump required version to 1.7.
+
+2016-11-09 Werner Koch <wk@gnupg.org>
+
+ w32: Better protect the IO-system's fd_table.
+ * src/w32-io.c (fd_table_lock): New.
+ (new_fd): Lock allocation of a new slot.
+ (release_fd): Lock deallocation of a slot.
+
+2016-11-04 Andre Heinecke <aheinecke@intevation.de>
+
+ cpp: Add API for swdb queries.
+ * lang/cpp/src/swdbresult.cpp,
+ lang/cpp/src/swdbresult.h (SwdbResult): New.
+ * lang/cpp/src/Makefile.am: Update accordingly.
+
+ cpp: Add more EngineInfo::Version ctors.
+ * lang/cpp/src/engineinfo.h
+ (EngineInfo::Version::Version(const char*)),
+ (EngineInfo::Version::Version()): New.
+
+ cpp: Don't include gpgme.h in tofuinfo header.
+ * lang/cpp/src/tofuinfo.h: Don't include gpgme.h
+
+ cpp: Extend gpgmefw for tofuinfo and swdb query.
+ * lang/cpp/src/gpgmefw.h (gpgme_tofu_info_t)
+ (gpgme_query_swdb_result_t): New forwards.
+
+2016-11-04 Werner Koch <wk@gnupg.org>
+
+ w32: Fix locating gpgconf on 64 bit systems.
+ * src/w32-util.c (find_program_at_standard_place): Use access to check
+ whether the binary is at CSIDL_PROGRAM_FILES before testing
+ CSIDL_PROGRAM_FILESX86.
+
+2016-11-03 Werner Koch <wk@gnupg.org>
+
+ core: Add gpgme_op_query_swdb and helper.
+ * src/gpgme.h.in (gpgme_query_swdb_result_t): New.
+ (gpgme_op_query_swdb): New.
+ (gpgme_op_query_swdb_result): New.
+ * src/libgpgme.vers, src/gpgme.def: Add the two new functions.
+ * src/queryswdb.c: New.
+ * src/Makefile.am (main_sources): Add new file.
+ * src/context.h (OPDATA_QUERY_SWDB): New.
+ * src/engine-backend.h (struct engine_ops): Add field 'query_swdb'.
+ Adjust all initializer.
+ * src/engine.c (_gpgme_engine_op_query_swdb): New.
+ * src/engine-gpgconf.c (parse_swdb_line): New.
+ (gpgconf_query_swdb): New.
+ (_gpgme_engine_ops_gpgconf): Register that function.
+
+ * src/util.h (GPG_ERR_TOO_OLD): Define for older libgpg-error.
+ (GPG_ERR_ENGINE_TOO_OLD): Ditto.
+
+ * tests/run-swdb.c: New.
+ * tests/Makefile.am (noinst_PROGRAMS): Add new debug tool.
+
+2016-11-03 Andre Heinecke <aheinecke@intevation.de>
+
+ qt: Change license of export / version header.
+ * lang/qt/src/qgpgme_export.h,
+ lang/qt/src/qgpgme_version.h: Change license to GPLv2+
+
+2016-11-03 Werner Koch <wk@gnupg.org>
+
+ core: Make use of --homedir in gpgconf.
+ * src/engine-gpgconf.c (struct engine_gpgconf): Add field 'version'.
+ (have_gpgconf_version): New.
+ (gpgconf_release): Free VERSION.
+ (gpgconf_new): Set VERSION.
+ (gpgconf_read, gpgconf_write): Use --homedir with recent gnupg.
+
+2016-11-02 Andras Mantia <andras@kdab.com>
+
+ qt: Fix build with g++ 4.8.x.
+ * lang/qt/src/defaultkeygenerationjob.cpp
+ (DefaultKeyGenerationJob::start): Explicitly connect pointer
+ in the QPointer.
+
+2016-11-02 Andre Heinecke <aheinecke@intevation.de>
+
+ qt, cpp: Fix versioning in cmake config and header.
+ * configure.ac (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO): New
+ subst variables for the version header.
+ * lang/cpp/src/GpgmeppConfigVersion.cmake.in,
+ lang/cpp/src/gpgmepp_version.h.in,
+ lang/qt/src/QGpgmeConfigVersion.cmake.in,
+ lang/qt/src/qgpgme_version.h.in: Use new variables.
+
+ qt: Install cmake config into qgpgme subdir.
+ * lang/qt/src/Makefile.am: Install cmake config file in qgpgme subdir.
+
+ qt: Require gpgmepp from cmake config script.
+ * lang/qt/src/QGpgmeConfig.cmake.in.in: Require cpp.
+
+ qt, cpp: Add all generated files to cleanfiles.
+ * cpp/src/Makefile.am (CLEANFILES),
+ qt/src/Makefile.am (CLEANFILES): Add all generated files
+ to cleanfiles.
+
+2016-11-01 Andre Heinecke <aheinecke@intevation.de>
+
+ qt: Add Distinguished Name parser from libkleo.
+ * lang/qt/src/dn.cpp (DN, DN::Attribute): New public API.
+ * lang/qt/src/dn.h: New.
+ * lang/qt/src/Makefile.am: Update accordingly.
+
+ qt, cpp: Install version headers in subdirs.
+ * lang/cpp/src/Makefile.am,
+ lang/qt/src/Makefile.am: Install version headers in include
+ subdirs.
+
+2016-10-31 Justus Winter <justus@g10code.com>
+
+ python: Use vanity modules for constants in tests and examples.
+ * lang/python/gpg/constants/sig/notation.py: New file.
+ * lang/python/gpg/constants/sig/__init__.py: Import new module.
+
+ * lang/python/examples/assuan.py: Use more specific module for
+ constants, e.g. 'protocol.ASSUAN' instead of 'PROTOCOL_ASSUAN'.
+ * lang/python/examples/testCMSgetkey.py: Likewise.
+ * lang/python/tests/initial.py: Likewise.
+ * lang/python/tests/t-callbacks.py: Likewise.
+ * lang/python/tests/t-decrypt-verify.py: Likewise.
+ * lang/python/tests/t-decrypt.py: Likewise.
+ * lang/python/tests/t-edit.py: Likewise.
+ * lang/python/tests/t-encrypt-large.py: Likewise.
+ * lang/python/tests/t-encrypt-sign.py: Likewise.
+ * lang/python/tests/t-encrypt-sym.py: Likewise.
+ * lang/python/tests/t-encrypt.py: Likewise.
+ * lang/python/tests/t-export.py: Likewise.
+ * lang/python/tests/t-file-name.py: Likewise.
+ * lang/python/tests/t-idiomatic.py: Likewise.
+ * lang/python/tests/t-import.py: Likewise.
+ * lang/python/tests/t-keylist.py: Likewise.
+ * lang/python/tests/t-protocol-assuan.py: Likewise.
+ * lang/python/tests/t-sig-notation.py: Likewise.
+ * lang/python/tests/t-sign.py: Likewise.
+ * lang/python/tests/t-signers.py: Likewise.
+ * lang/python/tests/t-trustlist.py: Likewise.
+ * lang/python/tests/t-verify.py: Likewise.
+ * lang/python/tests/t-wait.py: Likewise.
+
+ python: Import the topmost module in tests and examples.
+ * examples/verifydetails.py: Only import the topmost module 'gpg' and
+ update the code accordingly.
+ * tests/support.py: Likewise.
+ * tests/t-callbacks.py: Likewise.
+ * tests/t-data.py: Likewise.
+ * tests/t-decrypt-verify.py: Likewise.
+ * tests/t-decrypt.py: Likewise.
+ * tests/t-edit.py: Likewise.
+ * tests/t-encrypt-large.py: Likewise.
+ * tests/t-encrypt-sign.py: Likewise.
+ * tests/t-encrypt-sym.py: Likewise.
+ * tests/t-encrypt.py: Likewise.
+ * tests/t-export.py: Likewise.
+ * tests/t-file-name.py: Likewise.
+ * tests/t-import.py: Likewise.
+ * tests/t-keylist.py: Likewise.
+ * tests/t-sig-notation.py: Likewise.
+ * tests/t-sign.py: Likewise.
+ * tests/t-signers.py: Likewise.
+ * tests/t-trustlist.py: Likewise.
+ * tests/t-verify.py: Likewise.
+ * tests/t-wait.py: Likewise.
+ * tests/t-wrapper.py: Likewise.
+
+ python: Improve constants module.
+ * lang/python/gpg/constants/__init__.py: Import all modules below
+ 'constants/'. Interface hygiene: delete 'util'.
+ * lang/python/gpg/constants/data/encoding.py: Delete 'util'.
+ * lang/python/gpg/constants/event.py: Likewise.
+ * lang/python/gpg/constants/import.py: Likewise.
+ * lang/python/gpg/constants/keylist/mode.py: Likewise.
+ * lang/python/gpg/constants/md.py: Likewise.
+ * lang/python/gpg/constants/pk.py: Likewise.
+ * lang/python/gpg/constants/protocol.py: Likewise.
+ * lang/python/gpg/constants/sig/mode.py: Likewise.
+ * lang/python/gpg/constants/sigsum.py: Likewise.
+ * lang/python/gpg/constants/validity.py: Likewise.
+ * lang/python/gpg/errors.py: Likewise.
+
+2016-10-31 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
+
+ python: Rename Python module from PyME to gpg.
+ This follows weeks of discussion on the gnupg-devel mailing list.
+ Hopefully it will make it easier for people using Python to use GnuPG
+ in the future.
+
+2016-10-25 Werner Koch <wk@gnupg.org>
+
+ core: New API functions gpgme_set_sender, gpgme_get_sender.
+ * src/context.h (struct gpgme_context): Add field 'sender'.
+ * src/gpgme.c: Include mbox-util.h.
+ (gpgme_release): Free SENDER.
+ (gpgme_set_sender): New.
+ (gpgme_get_sender): New.
+ * src/gpgme.def, src/libgpgme.vers: Add new functions.
+
+ * src/engine-gpg.c (append_args_from_sender): New.
+ (gpg_encrypt_sign, gpg_sign): Call append_args_from_sender.
+ (gpg_verify): Add arg CTX. Call append_args_from_sender/
+ * src/engine-gpgsm.c (gpgsm_verify): Add dummy arg CTX.
+ * src/engine-uiserver.c (uiserver_verify): Ditto.
+ * src/engine.c (_gpgme_engine_op_verify): Add arg CTX.
+ * src/verify.c (verify_start): Pass CTX to engine function.
+
+ * tests/gpg/t-verify.c (main): Add some checks for new functions.
+ * tests/run-sign.c (main): Add option --sender.
+ * tests/run-verify.c (main): Ditto.
+
+2016-10-19 Andre Heinecke <aheinecke@intevation.de>
+
+ qt: Improve WKSPublishJob apidoc.
+ * lang/qt/src/wkspublishjob.h: Improve doc.
+
2016-10-18 Werner Koch <wk@gnupg.org>
Release 1.7.1.
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+# License along with this program; if not, see <https://www.gnu.org/licenses/>.
## Process this file with automake to produce Makefile.in
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+# License along with this program; if not, see <https://www.gnu.org/licenses/>.
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
$(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in $(top_srcdir)/build-aux/mkinstalldirs \
- $(top_srcdir)/lang/python/pyme/version.py.in COPYING \
+ $(top_srcdir)/lang/python/gpg/version.py.in COPYING \
COPYING.LESSER THANKS TODO build-aux/compile \
build-aux/config.guess build-aux/config.sub build-aux/depcomp \
build-aux/install-sh build-aux/mdate-sh missing \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = lang/python/pyme/version.py
+CONFIG_CLEAN_FILES = lang/python/gpg/version.py
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
distclean-hdr:
-rm -f config.h stamp-h1
-lang/python/pyme/version.py: $(top_builddir)/config.status $(top_srcdir)/lang/python/pyme/version.py.in
+lang/python/gpg/version.py: $(top_builddir)/config.status $(top_srcdir)/lang/python/gpg/version.py.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
+Noteworthy changes in version 1.8.0 (2016-11-16)
+------------------------------------------------
+
+ * The module of the Python bindings has been renamed to 'gpg'.
+
+ * New interface to query current software versions.
+
+ * New feature to use gpg's --{show,override}session-key options.
+
+ * New interface to set the sender of a mail.
+
+ * qt: Added Distinguished Name parser from libkleo
+
+ * The --homedir option is now used with recent gpgconf versions.
+
+ * On 64 bit Windows systems gpgconf is now properly located.
+
+ * The internal locking functions have been replaced by libgpg-error
+ locking functions.
+
+ * Interface changes relative to the 1.7.1 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ gpgme_set_sender NEW.
+ gpgme_get_sender NEW.
+ gpgme_op_query_swdb NEW.
+ gpgme_op_query_swdb_result NEW.
+ gpgme_query_swdb_result_t NEW.
+ gpgme_get_ctx_flag NEW.
+ gpgme_decrypt_result_t EXTENDED: New field session_key.
+ qt: DN NEW.
+ qt: DN::Attribute NEW.
+ qt: Job::context(Job*) NEW.
+ cpp: EngineInfo::Version::Version(const char*) NEW.
+ cpp: EngineInfo::Version::Version() NEW.
+ cpp: SwdbResult NEW.
+ cpp: Context::setSender(const char*) NEW.
+ cpp: Context::getSender() NEW.
+
+ [c=C28/A17/R0 cpp=C9/A3/R0 qt=C8/A1/R0]
+
+
Noteworthy changes in version 1.7.1 (2016-10-18)
------------------------------------------------
a) If you have a trusted Version of GnuPG installed, you can simply check
the supplied signature:
- $ gpg --verify gpgme-x.y.z.tar.gz.sig
+ $ gpg --verify gpgme-x.y.z.tar.gz.sig gpgme-x.y.z.tar.gz
This checks that the detached signature gpgme-x.y.z.tar.gz.sig is
indeed a a signature of gpgme-x.y.z.tar.gz. The key used to create
[ -z "${SILENT}" ] && cat <<EOF
*** Activating trailing whitespace git pre-commit hook. ***
For more information see this thread:
- http://mail.gnome.org/archives/desktop-devel-list/2009-May/msg00084.html
+ https://mail.gnome.org/archives/desktop-devel-list/2009-May/msg00084.html
To deactivate this pre-commit hook again move .git/hooks/pre-commit
and .git/hooks/pre-commit.sample out of the way.
EOF
/* Define if the ttyname_r function has a POSIX compliant declaration. */
#undef HAVE_POSIXDECL_TTYNAME_R
-/* Define if we have pthread. */
-#undef HAVE_PTHREAD
-
/* If available, contains the Python version number currently in use. */
#undef HAVE_PYTHON
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gpgme 1.7.1.
+# Generated by GNU Autoconf 2.69 for gpgme 1.8.0.
#
# Report bugs to <http://bugs.gnupg.org>.
#
# Identity of this package.
PACKAGE_NAME='gpgme'
PACKAGE_TARNAME='gpgme'
-PACKAGE_VERSION='1.7.1'
-PACKAGE_STRING='gpgme 1.7.1'
+PACKAGE_VERSION='1.8.0'
+PACKAGE_STRING='gpgme 1.8.0'
PACKAGE_BUGREPORT='http://bugs.gnupg.org'
PACKAGE_URL=''
GPGME_QT_LIBS
GPGME_QT_CFLAGS
HAVE_CXX11
-HAVE_PTHREAD_FALSE
-HAVE_PTHREAD_TRUE
BUILD_W32_GLIB_FALSE
BUILD_W32_GLIB_TRUE
HAVE_ANDROID_SYSTEM_FALSE
AS
CC_FOR_BUILD
VERSION_NUMBER
+VERSION_MICRO
+VERSION_MINOR
+VERSION_MAJOR
LIBQGPGME_LT_REVISION
LIBQGPGME_LT_AGE
LIBQGPGME_LT_CURRENT
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures gpgme 1.7.1 to adapt to many kinds of systems.
+\`configure' configures gpgme 1.8.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of gpgme 1.7.1:";;
+ short | recursive ) echo "Configuration of gpgme 1.8.0:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gpgme configure 1.7.1
+gpgme configure 1.8.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by gpgme $as_me 1.7.1, which was
+It was created by gpgme $as_me 1.8.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=27
-LIBGPGME_LT_AGE=16
+LIBGPGME_LT_CURRENT=28
+LIBGPGME_LT_AGE=17
LIBGPGME_LT_REVISION=0
-LIBGPGMEPP_LT_CURRENT=8
-LIBGPGMEPP_LT_AGE=2
+# If there is an ABI break in gpgmepp or qgpgme also bump the
+# version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in
+
+LIBGPGMEPP_LT_CURRENT=9
+LIBGPGMEPP_LT_AGE=3
LIBGPGMEPP_LT_REVISION=0
-LIBQGPGME_LT_CURRENT=7
-LIBQGPGME_LT_AGE=0
+LIBQGPGME_LT_CURRENT=8
+LIBQGPGME_LT_AGE=1
LIBQGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
##############################################
-NEED_GPG_ERROR_VERSION=1.11
+NEED_GPG_ERROR_VERSION=1.17
NEED_LIBASSUAN_API=2
NEED_LIBASSUAN_VERSION=2.0.2
PACKAGE=$PACKAGE_NAME
VERSION=$PACKAGE_VERSION
+VERSION_MAJOR=1
+VERSION_MINOR=8
+VERSION_MICRO=0
+
ac_aux_dir=
for ac_dir in build-aux "$srcdir"/build-aux; do
if test -f "$ac_dir/install-sh"; then
# Define the identity of the package.
PACKAGE='gpgme'
- VERSION='1.7.1'
+ VERSION='1.8.0'
cat >>confdefs.h <<_ACEOF
+
+
+
cat >>confdefs.h <<_ACEOF
#define PACKAGE "$PACKAGE"
_ACEOF
#define VERSION "$VERSION"
_ACEOF
-VERSION_NUMBER=0x010701
+VERSION_NUMBER=0x010800
# We need to compile and run a program on the build machine. A
$as_echo "no" >&6; }
if test "$PKG_CONFIG" = "no" ; then
echo "*** A new enough version of pkg-config was not found."
- echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+ echo "*** See https://www.freedesktop.org/software/pkgconfig/"
else
if test -f conf.glibtest ; then
:
;;
*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_create=yes
-else
- ac_cv_lib_pthread_pthread_create=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
- have_pthread=yes
-fi
-
- if test "$have_pthread" = yes; then
-
-$as_echo "#define HAVE_PTHREAD /**/" >>confdefs.h
-
- fi
-
# XXX: Probably use exec-prefix here?
# GPG_DEFAULT='/usr/bin/gpg'
# GPGSM_DEFAULT='/usr/bin/gpgsm'
fi
- if test "$have_pthread" = "yes"; then
- HAVE_PTHREAD_TRUE=
- HAVE_PTHREAD_FALSE='#'
-else
- HAVE_PTHREAD_TRUE='#'
- HAVE_PTHREAD_FALSE=
-fi
-
-
# Check whether --enable-fixed-path was given.
if test "${enable_fixed_path+set}" = set; then :
#
# Provide information about the build.
#
-BUILD_REVISION="2c490cd"
+BUILD_REVISION="f06220b"
cat >>confdefs.h <<_ACEOF
BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
-BUILD_FILEVERSION="${BUILD_FILEVERSION}11337"
+BUILD_FILEVERSION="${BUILD_FILEVERSION}61538"
# Check whether --enable-build-timestamp was given.
ac_config_files="$ac_config_files lang/cpp/Makefile lang/cpp/src/Makefile"
+ac_config_files="$ac_config_files lang/cpp/src/GpgmeppConfig-w32.cmake.in"
+
ac_config_files="$ac_config_files lang/cpp/src/GpgmeppConfig.cmake.in"
ac_config_files="$ac_config_files lang/cpp/src/GpgmeppConfigVersion.cmake"
ac_config_files="$ac_config_files lang/qt/Makefile lang/qt/src/Makefile"
+ac_config_files="$ac_config_files lang/qt/src/QGpgmeConfig-w32.cmake.in"
+
ac_config_files="$ac_config_files lang/qt/src/QGpgmeConfig.cmake.in"
ac_config_files="$ac_config_files lang/qt/src/QGpgmeConfigVersion.cmake"
fi
ac_config_files="$ac_config_files lang/qt/doc/Makefile"
-ac_config_files="$ac_config_files lang/python/Makefile lang/python/pyme/version.py lang/python/tests/Makefile"
+ac_config_files="$ac_config_files lang/python/Makefile lang/python/gpg/version.py lang/python/tests/Makefile"
ac_config_files="$ac_config_files lang/python/setup.py"
as_fn_error $? "conditional \"BUILD_W32_GLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${HAVE_PTHREAD_TRUE}" && test -z "${HAVE_PTHREAD_FALSE}"; then
- as_fn_error $? "conditional \"HAVE_PTHREAD\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${HAVE_DOXYGEN_TRUE}" && test -z "${HAVE_DOXYGEN_FALSE}"; then
as_fn_error $? "conditional \"HAVE_DOXYGEN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by gpgme $as_me 1.7.1, which was
+This file was extended by gpgme $as_me 1.8.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-gpgme config.status 1.7.1
+gpgme config.status 1.8.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
"src/gpgme-config") CONFIG_FILES="$CONFIG_FILES src/gpgme-config" ;;
"lang/cpp/Makefile") CONFIG_FILES="$CONFIG_FILES lang/cpp/Makefile" ;;
"lang/cpp/src/Makefile") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/Makefile" ;;
+ "lang/cpp/src/GpgmeppConfig-w32.cmake.in") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/GpgmeppConfig-w32.cmake.in" ;;
"lang/cpp/src/GpgmeppConfig.cmake.in") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/GpgmeppConfig.cmake.in" ;;
"lang/cpp/src/GpgmeppConfigVersion.cmake") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/GpgmeppConfigVersion.cmake" ;;
"lang/cpp/src/gpgmepp_version.h") CONFIG_FILES="$CONFIG_FILES lang/cpp/src/gpgmepp_version.h" ;;
"lang/qt/Makefile") CONFIG_FILES="$CONFIG_FILES lang/qt/Makefile" ;;
"lang/qt/src/Makefile") CONFIG_FILES="$CONFIG_FILES lang/qt/src/Makefile" ;;
+ "lang/qt/src/QGpgmeConfig-w32.cmake.in") CONFIG_FILES="$CONFIG_FILES lang/qt/src/QGpgmeConfig-w32.cmake.in" ;;
"lang/qt/src/QGpgmeConfig.cmake.in") CONFIG_FILES="$CONFIG_FILES lang/qt/src/QGpgmeConfig.cmake.in" ;;
"lang/qt/src/QGpgmeConfigVersion.cmake") CONFIG_FILES="$CONFIG_FILES lang/qt/src/QGpgmeConfigVersion.cmake" ;;
"lang/qt/tests/Makefile") CONFIG_FILES="$CONFIG_FILES lang/qt/tests/Makefile" ;;
"lang/qt/doc/Doxyfile") CONFIG_FILES="$CONFIG_FILES lang/qt/doc/Doxyfile" ;;
"lang/qt/doc/Makefile") CONFIG_FILES="$CONFIG_FILES lang/qt/doc/Makefile" ;;
"lang/python/Makefile") CONFIG_FILES="$CONFIG_FILES lang/python/Makefile" ;;
- "lang/python/pyme/version.py") CONFIG_FILES="$CONFIG_FILES lang/python/pyme/version.py" ;;
+ "lang/python/gpg/version.py") CONFIG_FILES="$CONFIG_FILES lang/python/gpg/version.py" ;;
"lang/python/tests/Makefile") CONFIG_FILES="$CONFIG_FILES lang/python/tests/Makefile" ;;
"lang/python/setup.py") CONFIG_FILES="$CONFIG_FILES lang/python/setup.py" ;;
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# can be downloaded from https://www.gnu.org/licenses/gpl.html, or
# obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
echo "
GPGME v${VERSION} has been configured as follows:
- Revision: 2c490cd (11337)
+ Revision: f06220b (61538)
Platform: $host
UI Server: $uiserver
FD Passing: $use_descriptor_passing
- GPGME Pthread: $have_pthread
Language bindings: ${enabled_languages_v:-$enabled_languages}
"
# Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
# (Process this file with autoconf to produce a configure script.)
AC_PREREQ(2.59)
# commit and push so that the git magic is able to work. See below
# for the LT versions.
m4_define(mym4_version_major, [1])
-m4_define(mym4_version_minor, [7])
-m4_define(mym4_version_micro, [1])
+m4_define(mym4_version_minor, [8])
+m4_define(mym4_version_micro, [0])
# Below is m4 magic to extract and compute the revision number, the
# decimalized short revision number, a beta version string, and a flag
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=27
-LIBGPGME_LT_AGE=16
+LIBGPGME_LT_CURRENT=28
+LIBGPGME_LT_AGE=17
LIBGPGME_LT_REVISION=0
-LIBGPGMEPP_LT_CURRENT=8
-LIBGPGMEPP_LT_AGE=2
+# If there is an ABI break in gpgmepp or qgpgme also bump the
+# version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in
+
+LIBGPGMEPP_LT_CURRENT=9
+LIBGPGMEPP_LT_AGE=3
LIBGPGMEPP_LT_REVISION=0
-LIBQGPGME_LT_CURRENT=7
-LIBQGPGME_LT_AGE=0
+LIBQGPGME_LT_CURRENT=8
+LIBQGPGME_LT_AGE=1
LIBQGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
##############################################
-NEED_GPG_ERROR_VERSION=1.11
+NEED_GPG_ERROR_VERSION=1.17
NEED_LIBASSUAN_API=2
NEED_LIBASSUAN_VERSION=2.0.2
PACKAGE=$PACKAGE_NAME
VERSION=$PACKAGE_VERSION
+VERSION_MAJOR=mym4_version_major
+VERSION_MINOR=mym4_version_minor
+VERSION_MICRO=mym4_version_micro
+
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/gpgme.h.in)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
+AC_SUBST(VERSION_MAJOR)
+AC_SUBST(VERSION_MINOR)
+AC_SUBST(VERSION_MICRO)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \
;;
*)
- AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
- if test "$have_pthread" = yes; then
- AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
- fi
-
# XXX: Probably use exec-prefix here?
# GPG_DEFAULT='/usr/bin/gpg'
# GPGSM_DEFAULT='/usr/bin/gpgsm'
AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
-AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
-
AC_ARG_ENABLE([fixed-path],
AC_HELP_STRING([--enable-fixed-path=PATH],
src/gpgme.h)
AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile)
+AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in)
AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig.cmake.in)
AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfigVersion.cmake)
AC_CONFIG_FILES(lang/cpp/src/gpgmepp_version.h)
AC_CONFIG_FILES(lang/qt/Makefile lang/qt/src/Makefile)
+AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig-w32.cmake.in)
AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig.cmake.in)
AC_CONFIG_FILES(lang/qt/src/QGpgmeConfigVersion.cmake)
AC_CONFIG_FILES(lang/qt/tests/Makefile)
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])])
AC_CONFIG_FILES(lang/qt/doc/Makefile)
AC_CONFIG_FILES([lang/python/Makefile
- lang/python/pyme/version.py
+ lang/python/gpg/version.py
lang/python/tests/Makefile])
AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
AC_OUTPUT
UI Server: $uiserver
FD Passing: $use_descriptor_passing
- GPGME Pthread: $have_pthread
Language bindings: ${enabled_languages_v:-$enabled_languages}
"
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
This file documents the GPGME library.
- This is Edition 1.7.1, last updated 26 August 2015, of ‘The ‘GnuPG
-Made Easy’ Reference Manual’, for Version 1.7.1.
+ This is Edition 1.8.0-beta50, last updated 16 November 2016, of ‘The
+‘GnuPG Made Easy’ Reference Manual’, for Version 1.8.0-beta50.
Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH.
\1f
Indirect:
-gpgme.info-1: 1670
-gpgme.info-2: 305786
+gpgme.info-1: 1686
+gpgme.info-2: 314031
\1f
Tag Table:
(Indirect)
-Node: Top\7f1670
-Node: Introduction\7f9061
-Node: Getting Started\7f9851
-Node: Features\7f11312
-Node: Overview\7f12624
-Node: Preparation\7f13733
-Node: Header\7f14730
-Node: Building the Source\7f15477
-Node: Largefile Support (LFS)\7f17887
-Node: Using Automake\7f23301
-Node: Using Libtool\7f25747
-Node: Library Version Check\7f26109
-Node: Signal Handling\7f32121
-Node: Multi Threading\7f33391
-Ref: Multi Threading-Footnote-1\7f35625
-Node: Protocols and Engines\7f36048
-Node: Engine Version Check\7f38693
-Node: Engine Information\7f41110
-Node: Engine Configuration\7f44970
-Node: OpenPGP\7f46254
-Node: Cryptographic Message Syntax\7f46594
-Node: Assuan\7f46907
-Node: Algorithms\7f47281
-Ref: Algorithms-Footnote-1\7f47760
-Node: Public Key Algorithms\7f47888
-Node: Hash Algorithms\7f50375
-Node: Error Handling\7f51565
-Node: Error Values\7f53439
-Node: Error Sources\7f58642
-Node: Error Codes\7f61082
-Node: Error Strings\7f65873
-Node: Exchanging Data\7f67680
-Node: Creating Data Buffers\7f69546
-Node: Memory Based Data Buffers\7f70062
-Node: File Based Data Buffers\7f73495
-Node: Callback Based Data Buffers\7f75697
-Node: Destroying Data Buffers\7f79888
-Node: Manipulating Data Buffers\7f81376
-Node: Data Buffer I/O Operations\7f81868
-Node: Data Buffer Meta-Data\7f84241
-Node: Data Buffer Convenience\7f88607
-Node: Contexts\7f90584
-Node: Creating Contexts\7f91770
-Node: Destroying Contexts\7f92617
-Node: Result Management\7f92956
-Node: Context Attributes\7f94385
-Node: Protocol Selection\7f95353
-Node: Crypto Engine\7f96385
-Node: ASCII Armor\7f98228
-Node: Text Mode\7f98852
-Node: Offline Mode\7f99786
-Node: Pinentry Mode\7f100858
-Node: Included Certificates\7f102543
-Node: Key Listing Mode\7f103965
-Node: Passphrase Callback\7f108057
-Node: Progress Meter Callback\7f111442
-Node: Status Message Callback\7f113427
-Node: Locale\7f116045
-Node: Key Management\7f117604
-Node: Key objects\7f118832
-Node: Listing Keys\7f129832
-Node: Information About Keys\7f137278
-Node: Manipulating Keys\7f138586
-Node: Generating Keys\7f139156
-Node: Signing Keys\7f154630
-Node: Exporting Keys\7f158228
-Node: Importing Keys\7f164921
-Ref: Importing Keys-Footnote-1\7f171826
-Node: Deleting Keys\7f171954
-Node: Changing Passphrases\7f173399
-Node: Changing TOFU Data\7f174688
-Node: Advanced Key Editing\7f176739
-Node: Trust Item Management\7f179388
-Node: Listing Trust Items\7f180424
-Node: Manipulating Trust Items\7f182785
-Node: Crypto Operations\7f183428
-Node: Decrypt\7f184692
-Node: Verify\7f188562
-Node: Decrypt and Verify\7f200522
-Node: Sign\7f203352
-Node: Selecting Signers\7f203916
-Node: Creating a Signature\7f205303
-Node: Signature Notation Data\7f210073
-Node: Encrypt\7f212301
-Node: Encrypting a Plaintext\7f212657
-Node: Miscellaneous\7f219620
-Node: Running other Programs\7f219966
-Node: Using the Assuan protocol\7f222042
-Node: Run Control\7f224735
-Node: Waiting For Completion\7f225479
-Node: Using External Event Loops\7f227597
-Node: I/O Callback Interface\7f229569
-Node: Registering I/O Callbacks\7f234807
-Node: I/O Callback Example\7f236845
-Node: I/O Callback Example GTK+\7f243470
-Node: I/O Callback Example GDK\7f245259
-Node: I/O Callback Example Qt\7f246901
-Node: Cancellation\7f249189
-Node: UI Server Protocol\7f251453
-Ref: UI Server Protocol-Footnote-1\7f252888
-Node: UI Server Encrypt\7f253007
-Node: UI Server Sign\7f258152
-Node: UI Server Decrypt\7f260505
-Node: UI Server Verify\7f261971
-Node: UI Server Set Input Files\7f265543
-Node: UI Server Sign/Encrypt Files\7f266613
-Node: UI Server Verify/Decrypt Files\7f268421
-Node: UI Server Import/Export Keys\7f270297
-Node: UI Server Checksum Files\7f271359
-Node: Miscellaneous UI Server Commands\7f273575
-Ref: command SENDER\7f275506
-Node: Debugging\7f277208
-Node: Deprecated Functions\7f278957
-Node: Library Copying\7f305786
-Node: Copying\7f334002
-Node: Concept Index\7f371748
-Node: Function and Data Index\7f386308
+Node: Top\7f1686
+Node: Introduction\7f9293
+Node: Getting Started\7f10083
+Node: Features\7f11544
+Node: Overview\7f12856
+Node: Preparation\7f13965
+Node: Header\7f14962
+Node: Building the Source\7f15709
+Node: Largefile Support (LFS)\7f17853
+Node: Using Automake\7f23267
+Node: Using Libtool\7f25820
+Node: Library Version Check\7f26182
+Node: Signal Handling\7f32194
+Node: Multi-Threading\7f33464
+Ref: Multi-Threading-Footnote-1\7f34880
+Node: Protocols and Engines\7f35303
+Node: Engine Version Check\7f37948
+Node: Engine Information\7f40365
+Node: Engine Configuration\7f44225
+Node: OpenPGP\7f45509
+Node: Cryptographic Message Syntax\7f45849
+Node: Assuan\7f46162
+Node: Algorithms\7f46536
+Ref: Algorithms-Footnote-1\7f47015
+Node: Public Key Algorithms\7f47143
+Node: Hash Algorithms\7f49630
+Node: Error Handling\7f50820
+Node: Error Values\7f52694
+Node: Error Sources\7f57897
+Node: Error Codes\7f60337
+Node: Error Strings\7f65128
+Node: Exchanging Data\7f66935
+Node: Creating Data Buffers\7f68801
+Node: Memory Based Data Buffers\7f69317
+Node: File Based Data Buffers\7f72750
+Node: Callback Based Data Buffers\7f74952
+Node: Destroying Data Buffers\7f79143
+Node: Manipulating Data Buffers\7f80631
+Node: Data Buffer I/O Operations\7f81123
+Node: Data Buffer Meta-Data\7f83496
+Node: Data Buffer Convenience\7f87862
+Node: Contexts\7f89839
+Node: Creating Contexts\7f91025
+Node: Destroying Contexts\7f91872
+Node: Result Management\7f92211
+Node: Context Attributes\7f93754
+Node: Protocol Selection\7f94791
+Node: Crypto Engine\7f95823
+Node: Setting the Sender\7f97673
+Node: ASCII Armor\7f99148
+Node: Text Mode\7f99777
+Node: Offline Mode\7f100711
+Node: Pinentry Mode\7f101783
+Node: Included Certificates\7f103468
+Node: Key Listing Mode\7f104890
+Node: Passphrase Callback\7f108982
+Node: Progress Meter Callback\7f112369
+Node: Status Message Callback\7f114354
+Node: Locale\7f118175
+Node: Key Management\7f119734
+Node: Key objects\7f120962
+Node: Listing Keys\7f131962
+Node: Information About Keys\7f139408
+Node: Manipulating Keys\7f140716
+Node: Generating Keys\7f141286
+Node: Signing Keys\7f156760
+Node: Exporting Keys\7f160358
+Node: Importing Keys\7f167051
+Ref: Importing Keys-Footnote-1\7f173956
+Node: Deleting Keys\7f174084
+Node: Changing Passphrases\7f175529
+Node: Changing TOFU Data\7f176818
+Node: Advanced Key Editing\7f178869
+Node: Trust Item Management\7f181518
+Node: Listing Trust Items\7f182554
+Node: Manipulating Trust Items\7f184915
+Node: Crypto Operations\7f185558
+Node: Decrypt\7f186822
+Node: Verify\7f191524
+Node: Decrypt and Verify\7f203484
+Node: Sign\7f206320
+Node: Selecting Signers\7f206884
+Node: Creating a Signature\7f208271
+Node: Signature Notation Data\7f213041
+Node: Encrypt\7f215269
+Node: Encrypting a Plaintext\7f215625
+Node: Miscellaneous\7f222588
+Node: Running other Programs\7f223000
+Node: Using the Assuan protocol\7f225076
+Node: Checking for updates\7f227798
+Node: Run Control\7f232556
+Node: Waiting For Completion\7f233300
+Node: Using External Event Loops\7f235418
+Node: I/O Callback Interface\7f237390
+Node: Registering I/O Callbacks\7f242628
+Node: I/O Callback Example\7f244666
+Node: I/O Callback Example GTK+\7f251291
+Node: I/O Callback Example GDK\7f253080
+Node: I/O Callback Example Qt\7f254722
+Node: Cancellation\7f257010
+Node: UI Server Protocol\7f259280
+Ref: UI Server Protocol-Footnote-1\7f260715
+Node: UI Server Encrypt\7f260834
+Node: UI Server Sign\7f266192
+Node: UI Server Decrypt\7f268545
+Node: UI Server Verify\7f270200
+Node: UI Server Set Input Files\7f273772
+Node: UI Server Sign/Encrypt Files\7f274842
+Node: UI Server Verify/Decrypt Files\7f276650
+Node: UI Server Import/Export Keys\7f278526
+Node: UI Server Checksum Files\7f279588
+Node: Miscellaneous UI Server Commands\7f281804
+Ref: command SENDER\7f283735
+Node: Debugging\7f285437
+Node: Deprecated Functions\7f287186
+Node: Library Copying\7f314031
+Node: Copying\7f342247
+Node: Concept Index\7f379997
+Node: Function and Data Index\7f394776
\1f
End Tag Table
This file documents the GPGME library.
- This is Edition 1.7.1, last updated 26 August 2015, of ‘The ‘GnuPG
-Made Easy’ Reference Manual’, for Version 1.7.1.
+ This is Edition 1.8.0-beta50, last updated 16 November 2016, of ‘The
+‘GnuPG Made Easy’ Reference Manual’, for Version 1.8.0-beta50.
Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH.
Main Menu
*********
-This is Edition 1.7.1, last updated 26 August 2015, of ‘The ‘GnuPG Made
-Easy’ Reference Manual’, for Version 1.7.1 of the GPGME library.
+This is Edition 1.8.0-beta50, last updated 16 November 2016, of ‘The
+‘GnuPG Made Easy’ Reference Manual’, for Version 1.8.0-beta50 of the
+GPGME library.
* Menu:
* Using Libtool:: Avoiding compiler options entirely.
* Library Version Check:: Getting and verifying the library version.
* Signal Handling:: How GPGME affects signal handling.
-* Multi Threading:: How GPGME can be used in an MT environment.
+* Multi-Threading:: How GPGME can be used in an MT environment.
Protocols and Engines
* Protocol Selection:: Selecting the protocol used by a context.
* Crypto Engine:: Configuring the crypto engine.
+* Setting the Sender:: How to tell the engine the sender.
* ASCII Armor:: Requesting ASCII armored output.
* Text Mode:: Choosing canonical text mode.
* Offline Mode:: Choosing offline mode.
Miscellaneous
-* Running other Programs:: Running other Programs
+* Running other Programs:: Running other Programs.
+* Using the Assuan protocol:: Using the Assuan protocol.
+* Checking for updates:: How to check for software updates.
Run Control
* Using Libtool:: Avoiding compiler options entirely.
* Library Version Check:: Getting and verifying the library version.
* Signal Handling:: How GPGME affects signal handling.
-* Multi Threading:: How GPGME can be used in an MT environment.
+* Multi-Threading:: How GPGME can be used in an MT environment.
\1f
File: gpgme.info, Node: Header, Next: Building the Source, Up: Preparation
gcc -o foo foo.c `gpgme-config --cflags --libs`
- If you want to link to one of the thread-safe versions of GPGME, you
-must specify the ‘--thread’ option before any other option to select the
-thread package you want to link with. Supported thread packages are
-‘--thread=pth’ and ‘--thread=pthread’.
-
If you need to detect the installed language bindings you can use
list them using:
‘AM_PATH_GPGME_PTHREAD’ checks for the version of GPGME that can be
used with the native pthread implementation, and defines
- ‘GPGME_PTHREAD_CFLAGS’ and ‘GPGME_PTHREAD_LIBS’.
+ ‘GPGME_PTHREAD_CFLAGS’ and ‘GPGME_PTHREAD_LIBS’. Since version
+ 1.8.0 this is no longer required to GPGME_PTHREAD as GPGME itself
+ is thread safe.
This macro searches for ‘gpgme-config’ along the PATH. If you are
cross-compiling, it is useful to set the environment variable
portability to W32 systems.
\1f
-File: gpgme.info, Node: Signal Handling, Next: Multi Threading, Prev: Library Version Check, Up: Preparation
+File: gpgme.info, Node: Signal Handling, Next: Multi-Threading, Prev: Library Version Check, Up: Preparation
2.7 Signal Handling
===================
either before ‘gpgme_check_version’ is called or afterwards.
\1f
-File: gpgme.info, Node: Multi Threading, Prev: Signal Handling, Up: Preparation
+File: gpgme.info, Node: Multi-Threading, Prev: Signal Handling, Up: Preparation
-2.8 Multi Threading
+2.8 Multi-Threading
===================
-The GPGME library is not entirely thread-safe, but it can still be used
-in a multi-threaded environment if some care is taken. If the following
-requirements are met, there should be no race conditions to worry about:
-
- • GPGME supports the thread libraries pthread and GNU Pth. The
- support for this has to be enabled at compile time. GPGME will
- automatically detect the location in which the thread libraries are
- installed and activate the support for them at build time.
-
- Support for other thread libraries is very easy to add. Please
- contact us if you have the need.
-
- • If you want to use GPGME with threads, you must link to the right
- version of the library. The name of the right library is
- ‘libgpgme-’ followed by the name of the thread package you use.
- For example, if you use GNU Pth, the right name is ‘libgpgme-pth’.
- Use the Automake macros or ‘gpgme-config’ program for simplicity.
+The GPGME library is mostly thread-safe, and can be used in a
+multi-threaded environment but there are some requirements for
+multi-threaded use:
• The function ‘gpgme_check_version’ must be called before any other
function in the library, because it initializes the thread support
The detailed result of an operation is returned in operation-specific
structures such as ‘gpgme_decrypt_result_t’. The corresponding
retrieval functions such as ‘gpgme_op_decrypt_result’ provide static
-access to the results after an operation completes. The following
-interfaces make it possible to detach a result structure from its
-associated context and give it a lifetime beyond that of the current
-operation or context.
+access to the results after an operation completes. Those structures
+shall be considered read-only and an application must not allocate such
+a structure on its own. The following interfaces make it possible to
+detach a result structure from its associated context and give it a
+lifetime beyond that of the current operation or context.
-- Function: void gpgme_result_ref (void *RESULT)
The function ‘gpgme_result_ref’ acquires an additional reference
* Protocol Selection:: Selecting the protocol used by a context.
* Crypto Engine:: Configuring the crypto engine.
+* Setting the Sender:: How to tell the engine the sender.
* ASCII Armor:: Requesting ASCII armored output.
* Text Mode:: Choosing canonical text mode.
* Offline Mode:: Choosing offline mode.
use with the context CTX.
\1f
-File: gpgme.info, Node: Crypto Engine, Next: ASCII Armor, Prev: Protocol Selection, Up: Context Attributes
+File: gpgme.info, Node: Crypto Engine, Next: Setting the Sender, Prev: Protocol Selection, Up: Context Attributes
7.4.2 Crypto Engine
-------------------
successful, or an eror code on failure.
\1f
-File: gpgme.info, Node: ASCII Armor, Next: Text Mode, Prev: Crypto Engine, Up: Context Attributes
+File: gpgme.info, Node: Setting the Sender, Next: ASCII Armor, Prev: Crypto Engine, Up: Context Attributes
+
+7.4.3 How to tell the engine the sender.
+----------------------------------------
+
+Some engines can make use of the sender’s address, for example to figure
+out the best user id in certain trust models. For verification and
+signing of mails, it is thus suggested to let the engine know the sender
+("From:") address. GPGME provides two functions to accomplish that.
+Note that the esoteric use of multiple "From:" addresses is not
+supported.
+
+ -- Function: gpgme_error_t gpgme_set_sender (gpgme_ctx_t CTX,
+ int ADDRESS)
+
+ The function ‘gpgme_set_sender’ specifies the sender address for
+ use in sign and verify operations. ADDRESS is expected to be the
+ “addr-spec” part of an address but my also be a complete mailbox
+ address, in which case this function extracts the “addr-spec” from
+ it. Using ‘NULL’ for ADDRESS clears the sender address.
+
+ The function returns 0 on success or an error code on failure. The
+ most likely failure is that no valid “addr-spec” was found in
+ ADDRESS.
+
+ -- Function: const char * gpgme_get_sender (gpgme_ctx_t CTX)
+
+ The function ‘gpgme_get_sender’ returns the current sender address
+ from the context, or NULL if none was set. The returned value is
+ valid as long as the CTX is valid and ‘gpgme_set_sender’ has not
+ been called again.
+
+\1f
+File: gpgme.info, Node: ASCII Armor, Next: Text Mode, Prev: Setting the Sender, Up: Context Attributes
-7.4.3 ASCII Armor
+7.4.4 ASCII Armor
-----------------
-- Function: void gpgme_set_armor (gpgme_ctx_t CTX, int YES)
\1f
File: gpgme.info, Node: Text Mode, Next: Offline Mode, Prev: ASCII Armor, Up: Context Attributes
-7.4.4 Text Mode
+7.4.5 Text Mode
---------------
-- Function: void gpgme_set_textmode (gpgme_ctx_t CTX, int YES)
\1f
File: gpgme.info, Node: Offline Mode, Next: Pinentry Mode, Prev: Text Mode, Up: Context Attributes
-7.4.5 Offline Mode
+7.4.6 Offline Mode
------------------
-- Function: void gpgme_set_offline (gpgme_ctx_t CTX, int YES)
\1f
File: gpgme.info, Node: Pinentry Mode, Next: Included Certificates, Prev: Offline Mode, Up: Context Attributes
-7.4.6 Pinentry Mode
+7.4.7 Pinentry Mode
-------------------
-- Function: gpgme_error_t gpgme_set_pinentry_mode (gpgme_ctx_t CTX,
\1f
File: gpgme.info, Node: Included Certificates, Next: Key Listing Mode, Prev: Pinentry Mode, Up: Context Attributes
-7.4.7 Included Certificates
+7.4.8 Included Certificates
---------------------------
-- Function: void gpgme_set_include_certs (gpgme_ctx_t CTX,
\1f
File: gpgme.info, Node: Key Listing Mode, Next: Passphrase Callback, Prev: Included Certificates, Up: Context Attributes
-7.4.8 Key Listing Mode
+7.4.9 Key Listing Mode
----------------------
-- Function: gpgme_error_t gpgme_set_keylist_mode (gpgme_ctx_t CTX,
\1f
File: gpgme.info, Node: Passphrase Callback, Next: Progress Meter Callback, Prev: Key Listing Mode, Up: Context Attributes
-7.4.9 Passphrase Callback
--------------------------
+7.4.10 Passphrase Callback
+--------------------------
-- Data type: gpgme_error_t (*gpgme_passphrase_cb_t)(void *HOOK, const
char *UID_HINT, const char *PASSPHRASE_INFO, int PREV_WAS_BAD,
\1f
File: gpgme.info, Node: Progress Meter Callback, Next: Status Message Callback, Prev: Passphrase Callback, Up: Context Attributes
-7.4.10 Progress Meter Callback
+7.4.11 Progress Meter Callback
------------------------------
-- Data type: void (*gpgme_progress_cb_t)(void *HOOK, const char *WHAT,
\1f
File: gpgme.info, Node: Status Message Callback, Next: Locale, Prev: Progress Meter Callback, Up: Context Attributes
-7.4.11 Status Message Callback
+7.4.12 Status Message Callback
------------------------------
-- Data type: gpgme_error_t (*gpgme_status_cb_t)(void *HOOK, const char
("~") will not be removed from the ‘description’ field of the
‘gpgme_tofu_info_t’ object.
+ ‘"export-session-key"’
+ Using a VALUE of "1" specifies that the context should try to
+ export the symmetric session key when decrypting data. By
+ default, or when using an empty string or "0" for VALUE,
+ session keys are not exported.
+
+ ‘"override-session-key"’
+ The string given in VALUE is passed to the GnuPG engine to
+ override the session key for decryption. The format of that
+ session key is specific to GnuPG and can be retrieved during a
+ decrypt operation when the context flag "export-session-key"
+ is enabled. Please be aware that using this feature with
+ GnuPG < 2.1.16 will leak the session key on many platforms via
+ ps(1).
+
This function returns ‘0’ on success.
+ -- Function: const char * gpgme_get_ctx_flag (gpgme_ctx_t CTX,
+ const char *NAME)
+
+ The value of flags settable by ‘gpgme_set_ctx_flag’ can be
+ retrieved by this function. If NAME is unknown the function
+ returns ‘NULL’. For boolean flags an empty string is returned for
+ False and the string "1" is returned for True; either atoi(3) or a
+ test for an empty string can be used to get the boolean value.
+
\1f
File: gpgme.info, Node: Locale, Prev: Status Message Callback, Up: Context Attributes
-7.4.12 Locale
+7.4.13 Locale
-------------
A locale setting can be associated with a context. This locale is
This is a pointer to a structure used to store the result of a
‘gpgme_op_decrypt’ operation. After successfully decrypting data,
you can retrieve the pointer to the result with
- ‘gpgme_op_decrypt_result’. The structure contains the following
- members:
+ ‘gpgme_op_decrypt_result’. As with all result structures, it this
+ structure shall be considered read-only and an application must not
+ allocated such a strucure on its own. The structure contains the
+ following members:
‘char *unsupported_algorithm’
If an unsupported algorithm was encountered, this string
This is the filename of the original plaintext message file if
it is known, otherwise this is a null pointer.
+ ‘char *session_key’
+ A textual representation (nul-terminated string) of the
+ session key used in symmetric encryption of the message, if
+ the context has been set to export session keys (see
+ ‘gpgme_set_ctx_flag, "export-session-key"’), and a session key
+ was available for the most recent decryption operation.
+ Otherwise, this is a null pointer.
+
+ You must not try to access this member of the struct unless
+ ‘gpgme_set_ctx_flag (ctx, "export-session-key")’ returns
+ success or ‘gpgme_get_ctx_flag (ctx, "export-session-key")’
+ returns true (non-empty string).
+
-- Function: gpgme_decrypt_result_t gpgme_op_decrypt_result
(gpgme_ctx_t CTX)
The function ‘gpgme_op_decrypt_result’ returns a
not be retrieved, and passes through any errors that are reported
by the crypto engine support routines.
- -- Function: gpgme_error_t gpgme_op_decrypt_verify (gpgme_ctx_t CTX,
- gpgme_data_t CIPHER, gpgme_data_t PLAIN)
+ -- Function: gpgme_error_t gpgme_op_decrypt_verify_start
+ (gpgme_ctx_t CTX, gpgme_data_t CIPHER, gpgme_data_t PLAIN)
The function ‘gpgme_op_decrypt_verify_start’ initiates a
‘gpgme_op_decrypt_verify’ operation. It can be completed by
calling ‘gpgme_wait’ on the context. *Note Waiting For
* Running other Programs:: Running other Programs
* Using the Assuan protocol:: Using the Assuan protocol
+* Checking for updates:: How to check for software updates
\1f
File: gpgme.info, Node: Running other Programs, Next: Using the Assuan protocol, Up: Miscellaneous
This is the asynchronous variant of ‘gpgme_op_spawn’.
\1f
-File: gpgme.info, Node: Using the Assuan protocol, Prev: Running other Programs, Up: Miscellaneous
+File: gpgme.info, Node: Using the Assuan protocol, Next: Checking for updates, Prev: Running other Programs, Up: Miscellaneous
7.8.2 Using the Assuan protocol
-------------------------------
Synchronous variant.
\1f
+File: gpgme.info, Node: Checking for updates, Prev: Using the Assuan protocol, Up: Miscellaneous
+
+7.8.3 How to check for software updates
+---------------------------------------
+
+The GnuPG Project operates a server to query the current versions of
+software packages related to GnuPG. GPGME can be used to access this
+online database and check whether a new version of a software package is
+available.
+
+ -- Data type: gpgme_query_swdb_result_t
+ This is a pointer to a structure used to store the result of a
+ ‘gpgme_op_query_swdb’ operation. After success full call to that
+ function, you can retrieve the pointer to the result with
+ ‘gpgme_op_query_swdb_result’. The structure contains the following
+ member:
+
+ ‘name’
+ This is the name of the package.
+
+ ‘iversion’
+ The currently installed version or an empty string. This
+ value is either a copy of the argument given to
+ ‘gpgme_op_query_swdb’ or the version of the installed software
+ as figured out by GPGME or GnuPG.
+
+ ‘created’
+ This gives the date the file with the list of version numbers
+ has originally be created by the GnuPG project.
+
+ ‘retrieved’
+ This gives the date the file was downloaded.
+
+ ‘warning’
+ If this flag is set either an error has occurred or some of
+ the information in this structure are not properly set. For
+ example if the version number of the installed software could
+ not be figured out, the ‘update’ flag may not reflect a
+ required update status.
+
+ ‘update’
+ If this flag is set an update of the software is available.
+
+ ‘urgent’
+ If this flag is set an available update is important.
+
+ ‘noinfo’
+ If this flag is set, no valid information could be retrieved.
+
+ ‘unknown’
+ If this flag is set the given ‘name’ is not known.
+
+ ‘tooold’
+ If this flag is set the available information is not fresh
+ enough.
+
+ ‘error’
+ If this flag is set some other error has occured.
+
+ ‘version’
+ The version string of the latest released version.
+
+ ‘reldate’
+ The release date of the latest released version.
+
+ -- Function: gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t CTX,
+ const char *NAME, const char *IVERSION, gpgme_data_t RESERVED)
+
+ Query the software version database for software package NAME and
+ check against the installed version given by IVERSION. If IVERSION
+ is given as ‘NULL’ a check is only done if GPGME can figure out the
+ version by itself (for example when using "gpgme" or "gnupg"). If
+ ‘NULL’ is used for NAME the current gpgme version is checked.
+ RESERVED must be set to 0.
+
+ -- Function: gpgme_query_swdb_result_t gpgme_op_query_swdb_result
+ (gpgme_ctx_t CTX)
+
+ The function ‘gpgme_op_query_swdb_result’ returns a
+ ‘gpgme_query_swdb_result_t’ pointer to a structure holding the
+ result of a ‘gpgme_op_query_swdb’ operation. The pointer is only
+ valid if the last operation on the context was a sucessful call to
+ ‘gpgme_op_query_swdb’. If that call failed, the result might be a
+ ‘NULL’ pointer. The returned pointer is only valid until the next
+ operation is started on the context CTX.
+
+Here is an example on how to check whether GnuPG is current:
+
+ #include <gpgme.h>
+
+ int
+ main (void)
+ {
+ gpg_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_query_swdb_result_t result;
+
+ gpgme_check_version (NULL);
+ err = gpgme_new (&ctx);
+ if (err)
+ fprintf (stderr, "error creating context: %s\n", gpg_strerror (err));
+ else
+ {
+ gpgme_set_protocol (ctx, GPGME_PROTOCOL_GPGCONF);
+
+ err = gpgme_op_query_swdb (ctx, "gnupg", NULL, 0);
+ if (err)
+ fprintf (stderr, "error querying swdb: %s\n", gpg_strerror (err));
+ else
+ {
+ result = gpgme_op_query_swdb_result (ctx);
+ if (!result)
+ fprintf (stderr, "error querying swdb\n");
+ if (!result->warning && !result->update)
+ printf ("GnuPG version %s is current\n",
+ result->iversion);
+ else if (!result->warning && result->update)
+ printf ("GnuPG version %s can be updated to %s\n",
+ result->iversion, result->version);
+ else
+ fprintf (stderr, "error finding the update status\n");
+ }
+ gpgme_release (ctx);
+ }
+ return 0;
+ }
+
+\1f
File: gpgme.info, Node: Run Control, Prev: Miscellaneous, Up: Contexts
7.9 Run Control
this case the state of CTX is not modified).
-- Function: gpgme_ctx_t gpgme_cancel_async (gpgme_ctx_t CTX)
- The function ‘gpgme_cancel’ attempts to cancel a pending operation
- in the context CTX. This can be called by any thread at any time
- after starting an operation on the context, but will not take
- effect immediately. The actual cancellation happens at the next
- time GPGME processes I/O in that context.
+ The function ‘gpgme_cancel_async’ attempts to cancel a pending
+ operation in the context CTX. This can be called by any thread at
+ any time after starting an operation on the context, but will not
+ take effect immediately. The actual cancellation happens at the
+ next time GPGME processes I/O in that context.
The function returns an error code if the cancellation failed (in
this case the state of CTX is not modified).
Here is an example of a complete encryption sequence; client lines are
indicated by a C:, server responses by C::
- C: S: C: S: C: S: C: S: S: C: S: C: S: C: S:
+ C: RESET
+ S: OK
+ C: RECIPIENT foo@example.net
+ S: OK
+ C: RECIPIENT bar@example.com
+ S: OK
+ C: PREP_ENCRYPT
+ S: S PROTOCOL OpenPGP
+ S: OK
+ C: INPUT FD=17
+ S: OK
+ C: OUTPUT FD=18
+ S: OK
+ C: ENCRYPT
+ S: OK
\1f
File: gpgme.info, Node: UI Server Sign, Next: UI Server Decrypt, Prev: UI Server Encrypt, Up: UI Server Protocol
The decryption is started with the command:
-- Command: DECRYPT --protocol=NAME [--no-verify]
+ [--export-session-key]
NAME is the encryption protocol used for the message. For a
description of the allowed protocols see the ‘ENCRYPT’ command.
This argument is mandatory. If the option ‘--no-verify’ is given,
the server should not try to verify a signature, in case the input
- data is an OpenPGP combined message.
+ data is an OpenPGP combined message. If the option
+ ‘--export-session-key’ is given and the underlying engine knows how
+ to export the session key, it will appear on a status line
\1f
File: gpgme.info, Node: UI Server Verify, Next: UI Server Set Input Files, Prev: UI Server Decrypt, Up: UI Server Protocol
This file documents the GPGME library.
- This is Edition 1.7.1, last updated 26 August 2015, of ‘The ‘GnuPG
-Made Easy’ Reference Manual’, for Version 1.7.1.
+ This is Edition 1.8.0-beta50, last updated 16 November 2016, of ‘The
+‘GnuPG Made Easy’ Reference Manual’, for Version 1.8.0-beta50.
Copyright © 2002–2008, 2010, 2012–2016 g10 Code GmbH.
Version 3, 29 June 2007
- Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or
school, if any, to sign a “copyright disclaimer” for the program, if
necessary. For more information on this, and how to apply and follow
-the GNU GPL, see <http://www.gnu.org/licenses/>.
+the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use the
GNU Lesser General Public License instead of this License. But first,
-please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
+please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
\1f
File: gpgme.info, Node: Concept Index, Next: Function and Data Index, Prev: Copying, Up: Top
* context, pinentry mode: Pinentry Mode. (line 6)
* context, result of operation: Result Management. (line 6)
* context, selecting protocol: Protocol Selection. (line 6)
+* context, sender: Setting the Sender. (line 6)
* context, text mode: Text Mode. (line 6)
* crypto backend: Protocols and Engines. (line 6)
* crypto engine: Protocols and Engines. (line 6)
* error values, printing of: Error Strings. (line 6)
* event loop, external: Using External Event Loops.
(line 6)
+* From:: Setting the Sender. (line 6)
* GDK, using GPGME with: I/O Callback Example GDK.
(line 6)
* GnuPG: OpenPGP. (line 6)
* locale, default: Locale. (line 6)
* locale, of a context: Locale. (line 6)
* message digest algorithms: Hash Algorithms. (line 6)
-* multi-threading: Multi Threading. (line 6)
+* multi-threading: Multi-Threading. (line 6)
* notation data: Verify. (line 6)
* notation data <1>: Signature Notation Data.
(line 6)
* run control: Run Control. (line 6)
* S/MIME: Cryptographic Message Syntax.
(line 6)
+* sender: Setting the Sender. (line 6)
* sign: Sign. (line 6)
* signal handling: Signal Handling. (line 6)
* signals: Signal Handling. (line 6)
* status message callback: Status Message Callback.
(line 6)
* text mode: Text Mode. (line 6)
-* thread-safeness: Multi Threading. (line 6)
+* thread-safeness: Multi-Threading. (line 6)
* trust item: Trust Item Management. (line 6)
* trust item list: Listing Trust Items. (line 6)
* trust item, manipulation: Manipulating Trust Items.
(line 25)
* gpgme_genkey_result_t: Generating Keys. (line 295)
* gpgme_get_armor: ASCII Armor. (line 13)
+* gpgme_get_ctx_flag: Status Message Callback.
+ (line 73)
* gpgme_get_dirinfo: Engine Version Check.
(line 6)
* gpgme_get_engine_info: Engine Information. (line 46)
* gpgme_get_protocol: Protocol Selection. (line 21)
* gpgme_get_protocol_name: Protocols and Engines.
(line 51)
+* gpgme_get_sender: Setting the Sender. (line 26)
* gpgme_get_sig_key: Deprecated Functions.
(line 626)
* gpgme_get_sig_status: Deprecated Functions.
* gpgme_op_createsubkey: Generating Keys. (line 109)
* gpgme_op_createsubkey_start: Generating Keys. (line 151)
* gpgme_op_decrypt: Decrypt. (line 6)
-* gpgme_op_decrypt_result: Decrypt. (line 76)
+* gpgme_op_decrypt_result: Decrypt. (line 91)
* gpgme_op_decrypt_start: Decrypt. (line 20)
* gpgme_op_decrypt_verify: Decrypt and Verify. (line 6)
-* gpgme_op_decrypt_verify <1>: Decrypt and Verify. (line 30)
+* gpgme_op_decrypt_verify_start: Decrypt and Verify. (line 30)
* gpgme_op_delete: Deleting Keys. (line 6)
* gpgme_op_delete_start: Deleting Keys. (line 20)
* gpgme_op_edit: Deprecated Functions.
(line 6)
* gpgme_op_passwd_start: Changing Passphrases.
(line 19)
+* gpgme_op_query_swdb: Checking for updates.
+ (line 66)
+* gpgme_op_query_swdb_result: Checking for updates.
+ (line 76)
* gpgme_op_revuid: Generating Keys. (line 192)
* gpgme_op_revuid_start: Generating Keys. (line 218)
* gpgme_op_sign: Creating a Signature.
(line 59)
* gpgme_pubkey_algo_t: Public Key Algorithms.
(line 10)
+* gpgme_query_swdb_result_t: Checking for updates.
+ (line 11)
* gpgme_recipient_t: Decrypt. (line 30)
* gpgme_register_io_cb_t: I/O Callback Interface.
(line 23)
* gpgme_release: Destroying Contexts. (line 6)
-* gpgme_result_ref: Result Management. (line 14)
-* gpgme_result_unref: Result Management. (line 20)
+* gpgme_result_ref: Result Management. (line 15)
+* gpgme_result_unref: Result Management. (line 21)
* gpgme_set_armor: ASCII Armor. (line 6)
* gpgme_set_ctx_flag: Status Message Callback.
(line 37)
* gpgme_set_progress_cb: Progress Meter Callback.
(line 16)
* gpgme_set_protocol: Protocol Selection. (line 6)
+* gpgme_set_sender: Setting the Sender. (line 13)
* gpgme_set_status_cb: Status Message Callback.
(line 17)
* gpgme_set_textmode: Text Mode. (line 6)
@end copying
@c Macros used by the description of the UI server protocol
-@macro clnt
- @sc{c:} @c
+@macro clnt{string}
+ @sc{c:} \string\
@end macro
-@macro srvr
- @sc{s:} @c
+@macro srvr{string}
+ @sc{s:} \string\
@end macro
* Using Libtool:: Avoiding compiler options entirely.
* Library Version Check:: Getting and verifying the library version.
* Signal Handling:: How @acronym{GPGME} affects signal handling.
-* Multi Threading:: How @acronym{GPGME} can be used in an MT environment.
+* Multi-Threading:: How @acronym{GPGME} can be used in an MT environment.
Protocols and Engines
* Protocol Selection:: Selecting the protocol used by a context.
* Crypto Engine:: Configuring the crypto engine.
+* Setting the Sender:: How to tell the engine the sender.
* ASCII Armor:: Requesting @acronym{ASCII} armored output.
* Text Mode:: Choosing canonical text mode.
* Offline Mode:: Choosing offline mode.
Miscellaneous
-* Running other Programs:: Running other Programs
+* Running other Programs:: Running other Programs.
+* Using the Assuan protocol:: Using the Assuan protocol.
+* Checking for updates:: How to check for software updates.
Run Control
* Using Libtool:: Avoiding compiler options entirely.
* Library Version Check:: Getting and verifying the library version.
* Signal Handling:: How @acronym{GPGME} affects signal handling.
-* Multi Threading:: How @acronym{GPGME} can be used in an MT environment.
+* Multi-Threading:: How @acronym{GPGME} can be used in an MT environment.
@end menu
gcc -o foo foo.c `gpgme-config --cflags --libs`
@end example
-If you want to link to one of the thread-safe versions of
-@acronym{GPGME}, you must specify the @option{--thread} option before
-any other option to select the thread package you want to link with.
-Supported thread packages are @option{--thread=pth} and
-@option{--thread=pthread}.
-
If you need to detect the installed language bindings you can use list
them using:
@code{AM_PATH_GPGME_PTHREAD} checks for the version of @acronym{GPGME}
that can be used with the native pthread implementation, and defines
-@code{GPGME_PTHREAD_CFLAGS} and @code{GPGME_PTHREAD_LIBS}.
+@code{GPGME_PTHREAD_CFLAGS} and @code{GPGME_PTHREAD_LIBS}. Since
+version 1.8.0 this is no longer required to GPGME_PTHREAD as
+@acronym{GPGME} itself is thread safe.
This macro searches for @command{gpgme-config} along the PATH. If
you are cross-compiling, it is useful to set the environment variable
@code{gpgme_check_version} is called or afterwards.
-@node Multi Threading
-@section Multi Threading
+@node Multi-Threading
+@section Multi-Threading
@cindex thread-safeness
@cindex multi-threading
-The @acronym{GPGME} library is not entirely thread-safe, but it can
-still be used in a multi-threaded environment if some care is taken.
-If the following requirements are met, there should be no race
-conditions to worry about:
+The @acronym{GPGME} library is mostly thread-safe, and can be used
+in a multi-threaded environment but there are some requirements
+for multi-threaded use:
@itemize @bullet
@item
-@acronym{GPGME} supports the thread libraries pthread and GNU Pth.
-The support for this has to be enabled at compile time.
-@acronym{GPGME} will automatically detect the location in which the
-thread libraries are installed and activate the support for them at
-build time.
-
-Support for other thread libraries is very easy to add. Please
-contact us if you have the need.
-
-@item
-If you want to use @acronym{GPGME} with threads, you must link to the
-right version of the library. The name of the right library is
-@code{libgpgme-} followed by the name of the thread package you use.
-For example, if you use GNU Pth, the right name is
-@code{libgpgme-pth}. Use the Automake macros or
-@command{gpgme-config} program for simplicity.
-
-
-@item
The function @code{gpgme_check_version} must be called before any
other function in the library, because it initializes the thread
support subsystem in @acronym{GPGME}. To achieve this in
The detailed result of an operation is returned in operation-specific
structures such as @code{gpgme_decrypt_result_t}. The corresponding
retrieval functions such as @code{gpgme_op_decrypt_result} provide
-static access to the results after an operation completes. The
-following interfaces make it possible to detach a result structure
-from its associated context and give it a lifetime beyond that of the
-current operation or context.
+static access to the results after an operation completes. Those
+structures shall be considered read-only and an application must not
+allocate such a structure on its own. The following interfaces make
+it possible to detach a result structure from its associated context
+and give it a lifetime beyond that of the current operation or
+context.
@deftypefun void gpgme_result_ref (@w{void *@var{result}})
The function @code{gpgme_result_ref} acquires an additional reference
@menu
* Protocol Selection:: Selecting the protocol used by a context.
* Crypto Engine:: Configuring the crypto engine.
+* Setting the Sender:: How to tell the engine the sender.
* ASCII Armor:: Requesting @acronym{ASCII} armored output.
* Text Mode:: Choosing canonical text mode.
* Offline Mode:: Choosing offline mode.
@end deftypefun
+@node Setting the Sender
+@subsection How to tell the engine the sender.
+@cindex context, sender
+@cindex sender
+@cindex From:
+
+Some engines can make use of the sender’s address, for example to
+figure out the best user id in certain trust models. For verification
+and signing of mails, it is thus suggested to let the engine know the
+sender ("From:") address. @acronym{GPGME} provides two functions to
+accomplish that. Note that the esoteric use of multiple "From:"
+addresses is not supported.
+
+@deftypefun gpgme_error_t gpgme_set_sender @
+ (@w{gpgme_ctx_t @var{ctx}}, @
+ @w{int @var{address}})
+
+The function @code{gpgme_set_sender} specifies the sender address for
+use in sign and verify operations. @var{address} is expected to be
+the ``addr-spec'' part of an address but my also be a complete mailbox
+address, in which case this function extracts the ``addr-spec'' from
+it. Using @code{NULL} for @var{address} clears the sender address.
+
+The function returns 0 on success or an error code on failure. The
+most likely failure is that no valid ``addr-spec'' was found in
+@var{address}.
+
+@end deftypefun
+
+@deftypefun @w{const char *} gpgme_get_sender @
+ (@w{gpgme_ctx_t @var{ctx}})
+
+The function @code{gpgme_get_sender} returns the current sender
+address from the context, or NULL if none was set. The returned
+value is valid as long as the @var{ctx} is valid and
+@code{gpgme_set_sender} has not been called again.
+
+@end deftypefun
+
+
+
@c FIXME: Unfortunately, using @acronym here breaks texi2dvi.
@node ASCII Armor
@subsection @acronym{ASCII} Armor
be removed from the @code{description} field of the
@code{gpgme_tofu_info_t} object.
+@item "export-session-key"
+Using a @var{value} of "1" specifies that the context should try to
+export the symmetric session key when decrypting data. By default, or
+when using an empty string or "0" for @var{value}, session keys are
+not exported.
+
+@item "override-session-key"
+The string given in @var{value} is passed to the GnuPG engine to override
+the session key for decryption. The format of that session key is
+specific to GnuPG and can be retrieved during a decrypt operation when
+the context flag "export-session-key" is enabled. Please be aware that
+using this feature with GnuPG < 2.1.16 will leak the session key on
+many platforms via ps(1).
+
@end table
This function returns @code{0} on success.
@end deftypefun
+@deftypefun {const char *} gpgme_get_ctx_flag @
+ (@w{gpgme_ctx_t @var{ctx}}, @
+ @w{const char *@var{name}})
+
+The value of flags settable by @code{gpgme_set_ctx_flag} can be
+retrieved by this function. If @var{name} is unknown the function
+returns @code{NULL}. For boolean flags an empty string is returned
+for False and the string "1" is returned for True; either atoi(3) or a
+test for an empty string can be used to get the boolean value.
+
+@end deftypefun
+
+
@node Locale
@subsection Locale
@cindex locale, default
This is a pointer to a structure used to store the result of a
@code{gpgme_op_decrypt} operation. After successfully decrypting
data, you can retrieve the pointer to the result with
-@code{gpgme_op_decrypt_result}. The structure contains the following
-members:
+@code{gpgme_op_decrypt_result}. As with all result structures, it
+this structure shall be considered read-only and an application must
+not allocated such a strucure on its own. The structure contains the
+following members:
@table @code
@item char *unsupported_algorithm
@item char *file_name
This is the filename of the original plaintext message file if it is
known, otherwise this is a null pointer.
+
+@item char *session_key
+A textual representation (nul-terminated string) of the session key
+used in symmetric encryption of the message, if the context has been
+set to export session keys (see @code{gpgme_set_ctx_flag,
+"export-session-key"}), and a session key was available for the most
+recent decryption operation. Otherwise, this is a null pointer.
+
+You must not try to access this member of the struct unless
+@code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success
+or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true
+(non-empty string).
+
@end table
@end deftp
are reported by the crypto engine support routines.
@end deftypefun
-@deftypefun gpgme_error_t gpgme_op_decrypt_verify (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}})
+@deftypefun gpgme_error_t gpgme_op_decrypt_verify_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}})
The function @code{gpgme_op_decrypt_verify_start} initiates a
@code{gpgme_op_decrypt_verify} operation. It can be completed by
calling @code{gpgme_wait} on the context. @xref{Waiting For
@menu
* Running other Programs:: Running other Programs
* Using the Assuan protocol:: Using the Assuan protocol
+* Checking for updates:: How to check for software updates
@end menu
@end deftypefun
+@node Checking for updates
+@subsection How to check for software updates
+
+The GnuPG Project operates a server to query the current versions of
+software packages related to GnuPG. GPGME can be used to
+access this online database and check whether a new version of a
+software package is available.
+
+@deftp {Data type} {gpgme_query_swdb_result_t}
+This is a pointer to a structure used to store the result of a
+@code{gpgme_op_query_swdb} operation. After success full call to that
+function, you can retrieve the pointer to the result with
+@code{gpgme_op_query_swdb_result}. The structure contains the
+following member:
+
+@table @code
+@item name
+This is the name of the package.
+
+@item iversion
+The currently installed version or an empty string. This value is
+either a copy of the argument given to @code{gpgme_op_query_swdb} or
+the version of the installed software as figured out by GPGME or GnuPG.
+
+@item created
+This gives the date the file with the list of version numbers has
+originally be created by the GnuPG project.
+
+@item retrieved
+This gives the date the file was downloaded.
+
+@item warning
+If this flag is set either an error has occurred or some of the
+information in this structure are not properly set. For example if
+the version number of the installed software could not be figured out,
+the @code{update} flag may not reflect a required update status.
+
+@item update
+If this flag is set an update of the software is available.
+
+@item urgent
+If this flag is set an available update is important.
+
+@item noinfo
+If this flag is set, no valid information could be retrieved.
+
+@item unknown
+If this flag is set the given @code{name} is not known.
+
+@item tooold
+If this flag is set the available information is not fresh enough.
+
+@item error
+If this flag is set some other error has occured.
+
+@item version
+The version string of the latest released version.
+
+@item reldate
+The release date of the latest released version.
+
+@end table
+@end deftp
+
+@deftypefun gpgme_error_t gpgme_op_query_swdb @
+ (@w{gpgme_ctx_t @var{ctx}}, @
+ @w{const char *@var{name}}, @
+ @w{const char *@var{iversion}}, @
+ @w{gpgme_data_t @var{reserved}})
+
+Query the software version database for software package @var{name}
+and check against the installed version given by @var{iversion}. If
+@var{iversion} is given as @code{NULL} a check is only done if GPGME
+can figure out the version by itself (for example when using
+"gpgme" or "gnupg"). If @code{NULL} is used for @var{name} the
+current gpgme version is checked. @var{reserved} must be set to 0.
+
+@end deftypefun
+
+@deftypefun gpgme_query_swdb_result_t gpgme_op_query_swdb_result @
+ (@w{gpgme_ctx_t @var{ctx}})
+
+The function @code{gpgme_op_query_swdb_result} returns a
+@code{gpgme_query_swdb_result_t} pointer to a structure holding the
+result of a @code{gpgme_op_query_swdb} operation. The pointer is only
+valid if the last operation on the context was a sucessful call to
+@code{gpgme_op_query_swdb}. If that call failed, the result might
+be a @code{NULL} pointer. The returned pointer is only valid until
+the next operation is started on the context @var{ctx}.
+@end deftypefun
+
+@noindent
+Here is an example on how to check whether GnuPG is current:
+
+@example
+#include <gpgme.h>
+
+int
+main (void)
+@{
+ gpg_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_query_swdb_result_t result;
+
+ gpgme_check_version (NULL);
+ err = gpgme_new (&ctx);
+ if (err)
+ fprintf (stderr, "error creating context: %s\n", gpg_strerror (err));
+ else
+ @{
+ gpgme_set_protocol (ctx, GPGME_PROTOCOL_GPGCONF);
+
+ err = gpgme_op_query_swdb (ctx, "gnupg", NULL, 0);
+ if (err)
+ fprintf (stderr, "error querying swdb: %s\n", gpg_strerror (err));
+ else
+ @{
+ result = gpgme_op_query_swdb_result (ctx);
+ if (!result)
+ fprintf (stderr, "error querying swdb\n");
+ if (!result->warning && !result->update)
+ printf ("GnuPG version %s is current\n",
+ result->iversion);
+ else if (!result->warning && result->update)
+ printf ("GnuPG version %s can be updated to %s\n",
+ result->iversion, result->version);
+ else
+ fprintf (stderr, "error finding the update status\n");
+ @}
+ gpgme_release (ctx);
+ @}
+ return 0;
+@}
+@end example
+
+
@node Run Control
@section Run Control
@cindex run control
@deftypefun gpgme_ctx_t gpgme_cancel_async (@w{gpgme_ctx_t @var{ctx}})
-The function @code{gpgme_cancel} attempts to cancel a pending
+The function @code{gpgme_cancel_async} attempts to cancel a pending
operation in the context @var{ctx}. This can be called by any thread
at any time after starting an operation on the context, but will not
take effect immediately. The actual cancellation happens at the next
@c This file is intended to be included in another file.
@display
-Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/}
+Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{https://fsf.org/}
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
General Public License for more details.
You should have received a copy of the GNU General Public License
-along with this program. If not, see @url{http://www.gnu.org/licenses/}.
+along with this program. If not, see @url{https://www.gnu.org/licenses/}.
@end example
@noindent
You should also get your employer (if you work as a programmer) or school,
if any, to sign a ``copyright disclaimer'' for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
-@url{http://www.gnu.org/licenses/}.
+@url{https://www.gnu.org/licenses/}.
The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use
the GNU Lesser General Public License instead of this License. But
-first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}.
+first, please read @url{https://www.gnu.org/philosophy/why-not-lgpl.html}.
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
-% along with this program. If not, see <http://www.gnu.org/licenses/>.
+% along with this program. If not, see <https://www.gnu.org/licenses/>.
%
% As a special exception, when this file is read by TeX when processing
% a Texinfo source document, you may use the result without
%
% Please try the latest version of texinfo.tex before submitting bug
% reports; you can get the latest version from:
-% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
+% https://www.gnu.org/software/texinfo/ (the Texinfo home page), or
% ftp://tug.org/tex/texinfo.tex
% (and all CTAN mirrors, see http://www.ctan.org).
% The texinfo.tex in any given distribution could well be out
% extent. You can get the existing language-specific files from the
% full Texinfo distribution.
%
-% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
+% The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
\message{Loading texinfo [version \texinfoversion]:}
% We don't want .vr (or whatever) entries like this:
% \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
% "\acronym" won't work when it's read back in;
- % it needs to be
+ % it needs to be
% {\code {{\tt \backslashcurfont }acronym}
\shipout\vbox{%
% Do this early so pdf references go to the beginning of the page.
\def\?{?\spacefactor=\endofsentencespacefactor\space}
% @frenchspacing on|off says whether to put extra space after punctuation.
-%
+%
\def\onword{on}
\def\offword{off}
%
% that's what we do).
% double active backslashes.
-%
+%
{\catcode`\@=0 \catcode`\\=\active
@gdef@activebackslashdouble{%
@catcode`@\=@active
% us) handles it with this amazing macro to replace tokens, with minor
% changes for Texinfo. It is included here under the GPL by permission
% from the author, Heiko Oberdiek.
-%
+%
% #1 is the tokens to replace.
% #2 is the replacement.
% #3 is the control sequence with the string.
-%
+%
\def\HyPsdSubst#1#2#3{%
\def\HyPsdReplace##1#1##2\END{%
##1%
% tried to figure out what each command should do in the context
% of @url. for now, just make @/ a no-op, that's the only one
% people have actually reported a problem with.
- %
+ %
\normalturnoffactive
\def\@{@}%
\let\/=\empty
% Definitions for a main text size of 11pt. This is the default in
% Texinfo.
-%
+%
\def\definetextfontsizexi{%
% Text fonts (11.2pt, magstep1).
\def\textnominalsize{11pt}
% section, chapter, etc., sizes following suit. This is for the GNU
% Press printing of the Emacs 22 manual. Maybe other manuals in the
% future. Used with @smallbook, which sets the leading to 12pt.
-%
+%
\def\definetextfontsizex{%
% Text fonts (10pt).
\def\textnominalsize{10pt}
\setfont\secsf\sfbshape{12}{1000}{OT1}
\let\secbf\secrm
\setfont\secsc\scbshape{10}{\magstep1}{OT1}
-\font\seci=cmmi12
+\font\seci=cmmi12
\font\secsy=cmsy10 scaled \magstep1
\def\sececsize{1200}
% We provide the user-level command
% @fonttextsize 10
% (or 11) to redefine the text font size. pt is assumed.
-%
+%
\def\xword{10}
\def\xiword{11}
%
%
% Set \globaldefs so that documents can use this inside @tex, since
% makeinfo 4.8 does not support it, but we need it nonetheless.
- %
+ %
\begingroup \globaldefs=1
\ifx\textsizearg\xword \definetextfontsizex
\else \ifx\textsizearg\xiword \definetextfontsizexi
% each of the four underscores in __typeof__. This is undesirable in
% some manuals, especially if they don't have long identifiers in
% general. @allowcodebreaks provides a way to control this.
-%
+%
\newif\ifallowcodebreaks \allowcodebreakstrue
\def\keywordtrue{true}
% @acronym for "FBI", "NATO", and the like.
% We print this one point size smaller, since it's intended for
% all-uppercase.
-%
+%
\def\acronym#1{\doacronym #1,,\finish}
\def\doacronym#1,#2,#3\finish{%
{\selectfonts\lsize #1}%
% @abbr for "Comput. J." and the like.
% No font change, but don't do end-of-sentence spacing.
-%
+%
\def\abbr#1{\doabbr #1,,\finish}
\def\doabbr#1,#2,#3\finish{%
{\plainfrenchspacing #1}%
% Theiling, which support regular, slanted, bold and bold slanted (and
% "outlined" (blackboard board, sort of) versions, which we don't need).
% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
-%
+%
% Although only regular is the truly official Euro symbol, we ignore
% that. The Euro is designed to be slightly taller than the regular
% font height.
-%
+%
% feymr - regular
% feymo - slanted
% feybr - bold
% feybo - bold slanted
-%
+%
% There is no good (free) typewriter version, to my knowledge.
% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
% Hmm.
-%
+%
% Also doesn't work in math. Do we need to do math with euro symbols?
% Hope not.
-%
-%
+%
+%
\def\euro{{\eurofont e}}
\def\eurofont{%
% We set the font at each command, rather than predefining it in
% \textfonts and the other font-switching commands, so that
% installations which never need the symbol don't have to have the
% font installed.
- %
+ %
% There is only one designed size (nominal 10pt), so we always scale
% that to the current nominal size.
- %
+ %
% By the way, simply using "at 1em" works for cmr10 and the like, but
% does not work for cmbx10 and other extended/shrunken fonts.
- %
+ %
\def\eurosize{\csname\curfontsize nominalsize\endcsname}%
%
- \ifx\curfontstyle\bfstylename
+ \ifx\curfontstyle\bfstylename
% bold:
\font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
- \else
+ \else
% regular:
\font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
\fi
% Laurent Siebenmann reports \Orb undefined with:
% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
% so we'll define it if necessary.
-%
+%
\ifx\Orb\undefined
\def\Orb{\mathhexbox20D}
\fi
% cause the example and the item to crash together. So we use this
% bizarre value of 10001 as a signal to \aboveenvbreak to insert
% \parskip glue after all. Section titles are handled this way also.
- %
+ %
\penalty 10001
\endgroup
\itemxneedsnegativevskipfalse
% processing continues to some further point. On the other hand, it
% seems \endinput does not hurt in the printed index arg, since that
% is still getting written without apparent harm.
- %
+ %
% Sample source (mac-idx3.tex, reported by Graham Percival to
% help-texinfo, 22may06):
% @macro funindex {WORD}
% @end macro
% ...
% @funindex commtest
- %
+ %
% The above is not enough to reproduce the bug, but it gives the flavor.
- %
+ %
% Sample whatsit resulting:
% .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
- %
+ %
% So:
\let\endinput = \empty
%
% makeinfo does not expand macros in the argument to @deffn, which ends up
% writing an index entry, and texindex isn't prepared for an index sort entry
% that starts with \.
- %
+ %
% Since macro invocations are followed by braces, we can just redefine them
% to take a single TeX argument. The case of a macro invocation that
% goes to end-of-line is not handled.
- %
+ %
\macrolist
}
% to re-insert the same penalty (values >10000 are used for various
% signals); since we just inserted a non-discardable item, any
% following glue (such as a \parskip) would be a breakpoint. For example:
- %
+ %
% @deffn deffn-whatever
% @vindex index-whatever
% Description.
% glue accumulate. (Not a breakpoint because it's preceded by a
% discardable item.)
\vskip-\parskip
- %
+ %
% This is purely so the last item on the list is a known \penalty >
% 10000. This is so \startdefun can avoid allowing breakpoints after
% section headings. Otherwise, it would insert a valid breakpoint between:
- %
+ %
% @section sec-whatever
% @deffn def-whatever
\penalty 10001
% These characters do not print properly in the Computer Modern roman
% fonts, so we must take special care. This is more or less redundant
% with the Texinfo input format setup at the end of this file.
-%
+%
\def\activecatcodes{%
\catcode`\"=\active
\catcode`\$=\active
% redefined for the two-volume lispref. We always output on
% \jobname.toc even if this is redefined.
-%
+%
\def\tocreadfilename{\jobname.toc}
% Normal (long) toc.
% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it
% the default, but it works for pasting with more pdf viewers (at least
% evince), the lilypond developers report. xpdf does work with the
-% regular 0x27.
-%
+% regular 0x27.
+%
\def\codequoteright{%
\expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
\expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
% and a similar option for the left quote char vs. a grave accent.
% Modern fonts display ASCII 0x60 as a grave accent, so some people like
% the code environments to do likewise.
-%
+%
\def\codequoteleft{%
\expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
\expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
% This does \let #1 = #2, with \csnames; that is,
% \let \csname#1\endcsname = \csname#2\endcsname
% (except of course we have to play expansion games).
-%
+%
\def\cslet#1#2{%
\expandafter\let
\csname#1\expandafter\endcsname
%
% If they passed de_DE, and txi-de_DE.tex doesn't exist,
% try txi-de.tex.
-%
+%
\def\documentlanguagetrywithoutunderscore#1_#2\finish{%
\openin 1 txi-#1.tex
\ifeof 1
\setnonasciicharscatcode\active
\lattwochardefs
%
- \else \ifx \declaredencoding \latone
+ \else \ifx \declaredencoding \latone
\setnonasciicharscatcode\active
\latonechardefs
%
\setnonasciicharscatcode\active
\utfeightchardefs
%
- \else
+ \else
\message{Unknown document encoding #1, ignoring.}%
%
\fi % utfeight
% A message to be logged when using a character that isn't available
% the default font encoding (OT1).
-%
+%
\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
% Take account of \c (plain) vs. \, (Texinfo) difference.
%
% Latin1 (ISO-8859-1) character definitions.
\def\latonechardefs{%
- \gdef^^a0{~}
+ \gdef^^a0{~}
\gdef^^a1{\exclamdown}
- \gdef^^a2{\missingcharmsg{CENT SIGN}}
+ \gdef^^a2{\missingcharmsg{CENT SIGN}}
\gdef^^a3{{\pounds}}
\gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
\gdef^^a5{\missingcharmsg{YEN SIGN}}
- \gdef^^a6{\missingcharmsg{BROKEN BAR}}
+ \gdef^^a6{\missingcharmsg{BROKEN BAR}}
\gdef^^a7{\S}
- \gdef^^a8{\"{}}
- \gdef^^a9{\copyright}
+ \gdef^^a8{\"{}}
+ \gdef^^a9{\copyright}
\gdef^^aa{\ordf}
- \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}}
+ \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}}
\gdef^^ac{$\lnot$}
- \gdef^^ad{\-}
- \gdef^^ae{\registeredsymbol}
+ \gdef^^ad{\-}
+ \gdef^^ae{\registeredsymbol}
\gdef^^af{\={}}
%
\gdef^^b0{\textdegree}
\gdef^^c2{\^A}
\gdef^^c3{\~A}
\gdef^^c4{\"A}
- \gdef^^c5{\ringaccent A}
+ \gdef^^c5{\ringaccent A}
\gdef^^c6{\AE}
\gdef^^c7{\cedilla C}
\gdef^^c8{\`E}
\gdef^^d6{\"O}
\gdef^^d7{$\times$}
\gdef^^d8{\v R}
- \gdef^^d9{\ringaccent U}
+ \gdef^^d9{\ringaccent U}
\gdef^^da{\'U}
\gdef^^db{\H U}
\gdef^^dc{\"U}
}
% UTF-8 character definitions.
-%
+%
% This code to support UTF-8 is based on LaTeX's utf8.def, with some
% changes for Texinfo conventions. It is included here under the GPL by
% permission from Frank Mittelbach and the LaTeX team.
-%
+%
\newcount\countUTFx
\newcount\countUTFy
\newcount\countUTFz
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
% the literal character `\'.
-%
+%
@def@normalturnoffactive{%
@let\=@normalbackslash
@let"=@normaldoublequote
@smallexample
@group
- @clnt RESET
- @srvr OK
- @clnt RECIPIENT foo@@example.net
- @srvr OK
- @clnt RECIPIENT bar@@example.com
- @srvr OK
- @clnt PREP_ENCRYPT
- @srvr S PROTOCOL OpenPGP
- @srvr OK
- @clnt INPUT FD=17
- @srvr OK
- @clnt OUTPUT FD=18
- @srvr OK
- @clnt ENCRYPT
- @srvr OK
+ @clnt{RESET}
+ @srvr{OK}
+ @clnt{RECIPIENT foo@@example.net}
+ @srvr{OK}
+ @clnt{RECIPIENT bar@@example.com}
+ @srvr{OK}
+ @clnt{PREP_ENCRYPT}
+ @srvr{S PROTOCOL OpenPGP}
+ @srvr{OK}
+ @clnt{INPUT FD=17}
+ @srvr{OK}
+ @clnt{OUTPUT FD=18}
+ @srvr{OK}
+ @clnt{ENCRYPT}
+ @srvr{OK}
@end group
@end smallexample
@noindent
The decryption is started with the command:
-@deffn Command DECRYPT -@w{}-protocol=@var{name} [-@w{}-no-verify]
+@deffn Command DECRYPT -@w{}-protocol=@var{name} [-@w{}-no-verify] [-@w{}-export-session-key]
@var{name} is the encryption protocol used for the message. For a
description of the allowed protocols see the @code{ENCRYPT} command.
-This argument is mandatory. If the option @option{--no-verify} is given,
-the server should not try to verify a signature, in case the input data
-is an OpenPGP combined message.
+This argument is mandatory. If the option @option{--no-verify} is
+given, the server should not try to verify a signature, in case the
+input data is an OpenPGP combined message. If the option
+@option{--export-session-key} is given and the underlying engine knows
+how to export the session key, it will appear on a status line
@end deffn
# This is a template. The dist target uses it to create the real file.
Summary: GPGME - GnuPG Made Easy
Name: gpgme
-Version: 1.7.1
+Version: 1.8.0
Release: 1
-URL: http://www.gnupg.org/gpgme.html
+URL: https://gnupg.org/gpgme.html
Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
Group: Development/Libraries
Copyright: GPL
Name: gpgme
Version: @pkg_version@
Release: 1
-URL: http://www.gnupg.org/gpgme.html
+URL: https://gnupg.org/gpgme.html
Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
Group: Development/Libraries
Copyright: GPL
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
cl Common Lisp
cpp C++
qt Qt-Framework API
-python Python 2 and 3 (port of PyME 0.9.0)
+python Python 2 and 3 (module name: gpg)
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
(defsystem gpgme
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
- :version "1.7.1"
+ :version "1.8.0"
:licence "GPL"
:depends-on ("cffi" "gpg-error")
:components ((:file "gpgme-package")
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
--- /dev/null
+# CMake Config file for GPGMEPP.
+# Copyright (C) 2016 Intevation GmbH
+#
+# This file is part of GPGMEPP.
+#
+# GPGME-CL is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# GPGME-CL is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA
+
+# based on a generated file from cmake.
+# Generated by CMake 3.0.2
+
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
+ message(FATAL_ERROR "CMake >= 2.6.0 required")
+endif()
+cmake_policy(PUSH)
+cmake_policy(VERSION 2.6)
+#----------------------------------------------------------------
+# Generated CMake target import file.
+#----------------------------------------------------------------
+
+# Commands may need to know the format version.
+set(CMAKE_IMPORT_FILE_VERSION 1)
+
+# Protect against multiple inclusion, which would fail when already imported targets are added once more.
+set(_targetsDefined)
+set(_targetsNotDefined)
+set(_expectedTargets)
+foreach(_expectedTarget Gpgmepp)
+ list(APPEND _expectedTargets ${_expectedTarget})
+ if(NOT TARGET ${_expectedTarget})
+ list(APPEND _targetsNotDefined ${_expectedTarget})
+ endif()
+ if(TARGET ${_expectedTarget})
+ list(APPEND _targetsDefined ${_expectedTarget})
+ endif()
+endforeach()
+if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
+ set(CMAKE_IMPORT_FILE_VERSION)
+ cmake_policy(POP)
+ return()
+endif()
+if(NOT "${_targetsDefined}" STREQUAL "")
+ message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
+endif()
+unset(_targetsDefined)
+unset(_targetsNotDefined)
+unset(_expectedTargets)
+
+# Create imported target Gpgmepp
+add_library(Gpgmepp SHARED IMPORTED)
+
+set_target_properties(Gpgmepp PROPERTIES
+ IMPORTED_IMPLIB "@resolved_libdir@/libgpgmepp.dll.a"
+ INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
+ INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.dll.a;@LIBASSUAN_LIBS@"
+ IMPORTED_LOCATION "@resolved_bindir@/libgpgmepp-6.dll"
+)
+list(APPEND _IMPORT_CHECK_TARGETS Gpgmepp )
+list(APPEND _IMPORT_CHECK_FILES_FOR_Gpgmepp "@resolved_libdir@/libgpgmepp.dll.a" "@resolved_bindir@/libgpgmepp-6.dll" )
+
+
+if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
+endif()
+
+# Loop over all imported files and verify that they actually exist
+foreach(target ${_IMPORT_CHECK_TARGETS} )
+ foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
+ if(NOT EXISTS "${file}" )
+ message(FATAL_ERROR "The imported target \"${target}\" references the file
+ \"${file}\"
+but this file does not exist. Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+ \"${CMAKE_CURRENT_LIST_FILE}\"
+but not all the files it references.
+")
+ endif()
+ endforeach()
+ unset(_IMPORT_CHECK_FILES_FOR_${target})
+endforeach()
+unset(_IMPORT_CHECK_TARGETS)
+
+# Commands beyond this point should not need to know the version.
+set(CMAKE_IMPORT_FILE_VERSION)
+cmake_policy(POP)
+
+get_filename_component(QGpgme_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+# Pull in QGpgme for compatibility with KF5 variant.
+find_package(QGpgme CONFIG)
set_target_properties(Gpgmepp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@"
- IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp@libsuffix@"
+ IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp.so"
)
if(CMAKE_VERSION VERSION_LESS 2.8.12)
# 02111-1307, USA
# based on a generated file from cmake.
-set(PACKAGE_VERSION "@LIBGPGMEPP_LT_CURRENT@.@LIBGPGMEPP_LT_AGE@.@LIBGPGMEPP_LT_REVISION@.@BUILD_REVISION@")
+set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE FALSE)
# 02111-1307, USA
EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in \
- gpgmepp_version.h.in
+ gpgmepp_version.h.in GpgmeppConfig-w32.cmake.in.in
lib_LTLIBRARIES = libgpgmepp.la
gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \
gpgadduserideditinteractor.cpp defaultassuantransaction.cpp \
scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \
- vfsmountresult.cpp configuration.cpp tofuinfo.cpp
+ vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp
gpgmepp_headers = \
configuration.h context.h data.h decryptionresult.h \
importresult.h keygenerationresult.h key.h keylistresult.h \
notation.h result.h scdgetinfoassuantransaction.h signingresult.h \
trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \
- tofuinfo.h
+ tofuinfo.h swdbresult.h
private_gpgmepp_headers = \
result_p.h context_p.h util.h callbacks.h data_p.h
gpgmeppincludedir = $(includedir)/gpgme++
gpgmeppinclude_HEADERS = $(gpgmepp_headers)
nobase_gpgmeppinclude_HEADERS = $(interface_headers)
-nodist_include_HEADERS = gpgmepp_version.h
+nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h
libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \
$(interface_headers) $(private_gpgmepp_headers)
-DBUILDING_GPGMEPP
libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@
-libgpgmepp_la_LDFLAGS = -version-info \
+libgpgmepp_la_LDFLAGS = -no-undefined -version-info \
@LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@
if HAVE_W32_SYSTEM
-libsuffix=.dll.a
+GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in
+ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
else
-libsuffix=.so
-endif
-
GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
-
+endif
install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
$(INSTALL) -m 644 GpgmeppConfig.cmake \
uninstall-local: uninstall-cmake-files
-CLEANFILES = GpgmeppConfig.cmake
+CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \
+ gpgmepp_version.h GpgmeppConfig.cmake.in
subdir = lang/cpp/src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
+ $(srcdir)/GpgmeppConfig-w32.cmake.in.in \
$(srcdir)/GpgmeppConfig.cmake.in.in \
$(srcdir)/GpgmeppConfigVersion.cmake.in \
$(srcdir)/gpgmepp_version.h.in $(top_srcdir)/build-aux/depcomp \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = GpgmeppConfig.cmake.in GpgmeppConfigVersion.cmake \
- gpgmepp_version.h
+CONFIG_CLEAN_FILES = GpgmeppConfig-w32.cmake.in GpgmeppConfig.cmake.in \
+ GpgmeppConfigVersion.cmake gpgmepp_version.h
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
}
am__installdirs = "$(DESTDIR)$(libdir)" \
"$(DESTDIR)$(gpgmeppincludedir)" \
- "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(includedir)"
+ "$(DESTDIR)$(gpgmeppincludedir)" \
+ "$(DESTDIR)$(gpgmeppincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libgpgmepp_la_DEPENDENCIES = ../../../src/libgpgme.la
am__objects_1 = exception.lo context.lo key.lo trustitem.lo data.lo \
gpgadduserideditinteractor.lo defaultassuantransaction.lo \
scdgetinfoassuantransaction.lo \
gpgagentgetinfoassuantransaction.lo vfsmountresult.lo \
- configuration.lo tofuinfo.lo
+ configuration.lo tofuinfo.lo swdbresult.lo
am__objects_2 =
am_libgpgmepp_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
context_vanilla.lo $(am__objects_2) $(am__objects_2)
*) (install-info --version) >/dev/null 2>&1;; \
esac
HEADERS = $(gpgmeppinclude_HEADERS) $(nobase_gpgmeppinclude_HEADERS) \
- $(nodist_include_HEADERS)
+ $(nodist_gpgmeppinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in \
- gpgmepp_version.h.in
+ gpgmepp_version.h.in GpgmeppConfig-w32.cmake.in.in
lib_LTLIBRARIES = libgpgmepp.la
main_sources = \
gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \
gpgadduserideditinteractor.cpp defaultassuantransaction.cpp \
scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \
- vfsmountresult.cpp configuration.cpp tofuinfo.cpp
+ vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp
gpgmepp_headers = \
configuration.h context.h data.h decryptionresult.h \
importresult.h keygenerationresult.h key.h keylistresult.h \
notation.h result.h scdgetinfoassuantransaction.h signingresult.h \
trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \
- tofuinfo.h
+ tofuinfo.h swdbresult.h
private_gpgmepp_headers = \
result_p.h context_p.h util.h callbacks.h data_p.h
gpgmeppincludedir = $(includedir)/gpgme++
gpgmeppinclude_HEADERS = $(gpgmepp_headers)
nobase_gpgmeppinclude_HEADERS = $(interface_headers)
-nodist_include_HEADERS = gpgmepp_version.h
+nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h
libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \
$(interface_headers) $(private_gpgmepp_headers)
-DBUILDING_GPGMEPP
libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@
-libgpgmepp_la_LDFLAGS = -version-info \
+libgpgmepp_la_LDFLAGS = -no-undefined -version-info \
@LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@
-@HAVE_W32_SYSTEM_FALSE@libsuffix = .so
-@HAVE_W32_SYSTEM_TRUE@libsuffix = .dll.a
-CLEANFILES = GpgmeppConfig.cmake
+CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \
+ gpgmepp_version.h GpgmeppConfig.cmake.in
+
all: all-am
.SUFFIXES:
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+GpgmeppConfig-w32.cmake.in: $(top_builddir)/config.status $(srcdir)/GpgmeppConfig-w32.cmake.in.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
GpgmeppConfig.cmake.in: $(top_builddir)/config.status $(srcdir)/GpgmeppConfig.cmake.in.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
GpgmeppConfigVersion.cmake: $(top_builddir)/config.status $(srcdir)/GpgmeppConfigVersion.cmake.in
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keylistresult.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scdgetinfoassuantransaction.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signingresult.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swdbresult.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tofuinfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trustitem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verificationresult.Plo@am__quote@
@list='$(nobase_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \
$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
dir='$(DESTDIR)$(gpgmeppincludedir)'; $(am__uninstall_files_from_dir)
-install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+install-nodist_gpgmeppincludeHEADERS: $(nodist_gpgmeppinclude_HEADERS)
@$(NORMAL_INSTALL)
- @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ @list='$(nodist_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \
if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(gpgmeppincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(gpgmeppincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
- $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(gpgmeppincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(gpgmeppincludedir)" || exit $$?; \
done
-uninstall-nodist_includeHEADERS:
+uninstall-nodist_gpgmeppincludeHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ @list='$(nodist_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+ dir='$(DESTDIR)$(gpgmeppincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(includedir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-data-am: install-data-local install-gpgmeppincludeHEADERS \
install-nobase_gpgmeppincludeHEADERS \
- install-nodist_includeHEADERS
+ install-nodist_gpgmeppincludeHEADERS
install-dvi: install-dvi-am
uninstall-am: uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \
uninstall-local uninstall-nobase_gpgmeppincludeHEADERS \
- uninstall-nodist_includeHEADERS
+ uninstall-nodist_gpgmeppincludeHEADERS
.MAKE: install-am install-strip
install-html install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man \
install-nobase_gpgmeppincludeHEADERS \
- install-nodist_includeHEADERS install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
+ install-nodist_gpgmeppincludeHEADERS install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am \
uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \
uninstall-local uninstall-nobase_gpgmeppincludeHEADERS \
- uninstall-nodist_includeHEADERS
-
+ uninstall-nodist_gpgmeppincludeHEADERS
-GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+@HAVE_W32_SYSTEM_TRUE@GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+@HAVE_W32_SYSTEM_FALSE@GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
+@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
$(INSTALL) -m 644 GpgmeppConfig.cmake \
return Error(gpgme_ctx_set_engine_info(d->ctx, gpgme_get_protocol(d->ctx), filename, home_dir));
}
+Error Context::setSender (const char *sender)
+{
+ return Error(gpgme_set_sender(d->ctx, sender));
+}
+
+const char *Context::getSender ()
+{
+ return gpgme_get_sender(d->ctx);
+}
+
//
//
// Key Management
GpgME::Error startSigning(const Data &plainText, Data &signature, SignatureMode mode);
SigningResult signingResult() const;
+ // wrapper for gpgme_set_sender
+ const char *getSender();
+ GpgME::Error setSender(const char *sender);
+
//
// Encryption
//
struct Version
{
int major, minor, patch;
+ Version()
+ {
+ major = 0;
+ minor = 0;
+ patch = 0;
+ }
Version(const std::string& version)
{
}
}
+ Version(const char *version)
+ {
+ if (!version ||
+ std::sscanf(version, "%d.%d.%d", &major, &minor, &patch) != 3) {
+ major = 0;
+ minor = 0;
+ patch = 0;
+ }
+ }
+
bool operator < (const Version& other)
{
if (major < other.major)
struct gpgme_conf_arg;
typedef struct gpgme_conf_arg *gpgme_conf_arg_t;
+struct _gpgme_tofu_info;
+typedef struct _gpgme_tofu_info *gpgme_tofu_info_t;
+
+struct _gpgme_op_query_swdb_result;
+typedef struct _gpgme_op_query_swdb_result *gpgme_query_swdb_result_t;
+
#endif // __GPGMEPP_GPGMEFW_H__
#ifndef GPGMEPP_VERSION_H
#define GPGMEPP_VERSION_H
-#define GPGMEPP_VERSION_STRING "@LIBGPGMEPP_LT_CURRENT@.@LIBGPGMEPP_LT_AGE@.@LIBGPGMEPP_LT_REVISION@"
-#define GPGMEPP_VERSION_MAJOR @LIBGPGMEPP_LT_CURRENT@
-#define GPGMEPP_VERSION_MINOR @LIBGPGMEPP_LT_AGE@
-#define GPGMEPP_VERSION_PATCH @LIBGPGMEPP_LT_REVISION@
-#define GPGMEPP_VERSION ((@LIBGPGMEPP_LT_CURRENT@<<16)|(@LIBGPGMEPP_LT_AGE@<<8)|(@LIBGPGMEPP_LT_REVISION@))
-
+#define GPGMEPP_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@"
+#define GPGMEPP_VERSION_MAJOR @VERSION_MAJOR@
+#define GPGMEPP_VERSION_MINOR @VERSION_MINOR@
+#define GPGMEPP_VERSION_PATCH @VERSION_MICRO@
+#define GPGMEPP_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@))
#endif
--- /dev/null
+/* swdbresult.cpp - wraps gpgme swdb result / query
+ Copyright (C) 2016 Intevation GmbH
+
+ This file is part of GPGME++.
+
+ GPGME++ is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ GPGME++ is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with GPGME++; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include "swdbresult.h"
+
+#include <istream>
+
+#include "error.h"
+
+#include "gpgme.h"
+
+class GpgME::SwdbResult::Private
+{
+public:
+ Private() {}
+ Private(gpgme_query_swdb_result_t result)
+ : mResult(result ? new _gpgme_op_query_swdb_result (*result) : nullptr)
+ {
+ if (!result) {
+ mResult->name = nullptr;
+ return;
+ }
+ if (result->name) {
+ mResult->name = strdup(result->name);
+ }
+ if (result->version) {
+ mVersion = result->version;
+ }
+ if (result->iversion) {
+ mIVersion = result->iversion;
+ }
+ }
+
+ Private(const Private &other)
+ : mResult(other.mResult)
+ {
+ if (mResult && mResult->name) {
+ mResult->name = strdup(mResult->name);
+ }
+ mVersion = other.mVersion;
+ mIVersion = other.mIVersion;
+ }
+
+ ~Private()
+ {
+ if (mResult) {
+ std::free(mResult->name);
+ delete mResult;
+ }
+ }
+
+ GpgME::EngineInfo::Version mVersion;
+ GpgME::EngineInfo::Version mIVersion;
+ gpgme_query_swdb_result_t mResult;
+};
+
+GpgME::SwdbResult::SwdbResult(gpgme_query_swdb_result_t result)
+ : d(new Private(result))
+{
+}
+
+GpgME::SwdbResult::SwdbResult() : d()
+{
+}
+
+bool GpgME::SwdbResult::isNull() const
+{
+ return !d || !d->mResult;
+}
+
+std::string GpgME::SwdbResult::name() const
+{
+ if (isNull() || !d->mResult->name) {
+ return std::string();
+ }
+ return d->mResult->name;
+}
+
+GpgME::EngineInfo::Version GpgME::SwdbResult::version() const
+{
+ if (isNull()) {
+ return GpgME::EngineInfo::Version();
+ }
+ return d->mVersion;
+}
+
+GpgME::EngineInfo::Version GpgME::SwdbResult::installedVersion() const
+{
+ if (isNull()) {
+ return GpgME::EngineInfo::Version();
+ }
+ return d->mIVersion;
+}
+
+unsigned long GpgME::SwdbResult::created() const
+{
+ return isNull() ? 0 : d->mResult->created;
+}
+
+unsigned long GpgME::SwdbResult::retrieved() const
+{
+ return isNull() ? 0 : d->mResult->retrieved;
+}
+
+unsigned long GpgME::SwdbResult::releaseDate() const
+{
+ return isNull() ? 0 : d->mResult->reldate;
+}
+
+bool GpgME::SwdbResult::warning() const
+{
+ return isNull() ? 0 : d->mResult->warning;
+}
+
+bool GpgME::SwdbResult::update() const
+{
+ return isNull() ? 0 : d->mResult->update;
+}
+
+bool GpgME::SwdbResult::noinfo() const
+{
+ return isNull() ? 0 : d->mResult->noinfo;
+}
+
+bool GpgME::SwdbResult::unknown() const
+{
+ return isNull() ? 0 : d->mResult->unknown;
+}
+
+bool GpgME::SwdbResult::error() const
+{
+ return isNull() ? 0 : d->mResult->error;
+}
+
+bool GpgME::SwdbResult::tooOld() const
+{
+ return isNull() ? 0 : d->mResult->tooold;
+}
+
+bool GpgME::SwdbResult::urgent() const
+{
+ return isNull() ? 0 : d->mResult->urgent;
+}
+
+std::vector<GpgME::SwdbResult> GpgME::SwdbResult::query(const char *name,
+ const char *iversion,
+ Error *err)
+{
+ std::vector <GpgME::SwdbResult> ret;
+ gpgme_ctx_t ctx;
+ gpgme_error_t gpgerr = gpgme_new(&ctx);
+
+ if (gpgerr) {
+ if (err) {
+ *err = Error (gpgerr);
+ }
+ return ret;
+ }
+
+ gpgerr = gpgme_set_protocol(ctx, GPGME_PROTOCOL_GPGCONF);
+
+ if (gpgerr) {
+ if (err) {
+ *err = Error(gpgerr);
+ }
+ gpgme_release(ctx);
+ return ret;
+ }
+
+ gpgerr = gpgme_op_query_swdb(ctx, name, iversion, 0);
+
+ if (gpgerr) {
+ if (err) {
+ *err = Error(gpgerr);
+ }
+ gpgme_release(ctx);
+ return ret;
+ }
+ gpgme_query_swdb_result_t result = gpgme_op_query_swdb_result(ctx);
+ while (result) {
+ ret.push_back(SwdbResult(result));
+ result = result->next;
+ }
+
+ gpgme_release(ctx);
+ return ret;
+}
+
+std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::SwdbResult &result)
+{
+ os << "GpgME::SwdbResult(";
+ if (!result.isNull()) {
+ os << "\n name: " << result.name()
+ << "\n version: " << result.version()
+ << "\n installed: "<< result.installedVersion()
+ << "\n created: " << result.created()
+ << "\n retrieved: "<< result.retrieved()
+ << "\n warning: " << result.warning()
+ << "\n update: " << result.update()
+ << "\n urgent: " << result.urgent()
+ << "\n noinfo: " << result.noinfo()
+ << "\n unknown: " << result.unknown()
+ << "\n tooOld: " << result.tooOld()
+ << "\n error: " << result.error()
+ << "\n reldate: " << result.releaseDate()
+ << '\n';
+ }
+ return os << ")\n";
+}
--- /dev/null
+/*
+ swdbresult.h - wraps a gpgme swdb query / rsult
+ Copyright (C) 2016 Intevation GmbH
+
+ This file is part of GPGME++.
+
+ GPGME++ is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ GPGME++ is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with GPGME++; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#ifndef __GPGMEPP_SWDB_H__
+#define __GPGMEPP_SWDB_H__
+
+#include "gpgmepp_export.h"
+
+#include "global.h"
+#include "engineinfo.h"
+
+#include <vector>
+#include <string>
+#include <iostream>
+#include <ostream>
+
+namespace GpgME
+{
+
+class GPGMEPP_EXPORT SwdbResult
+{
+public:
+ /* Obtain swdb results through query() */
+ SwdbResult();
+ explicit SwdbResult(gpgme_query_swdb_result_t result);
+
+ /** Query the swdb to get information about updates.
+ *
+ * Runs gpgconf --query-swdb through gpgme and
+ * returns a list of results.
+ * If iversion is given as NULL a check is only done if GPGME
+ * can figure out the version by itself (for example when using
+ * "gpgme" or "gnupg").
+ *
+ * If NULL is used for name the current gpgme version is
+ * checked.
+ *
+ * @param name: Name of the component to query.
+ * @param iversion: Optionally the installed version.
+ * @param err: Optional error.
+ */
+ static std::vector<SwdbResult> query(const char *name,
+ const char *iversion = NULL,
+ Error *err = NULL);
+
+ const SwdbResult &operator=(SwdbResult other)
+ {
+ swap(other);
+ return *this;
+ }
+
+ void swap(SwdbResult &other)
+ {
+ using std::swap;
+ swap(this->d, other.d);
+ }
+ bool isNull() const;
+
+ /* The name of the package (e.g. "gpgme", "gnupg") */
+ std::string name() const;
+
+ /* The version of the installed version. */
+ EngineInfo::Version installedVersion() const;
+
+ /* The time the online info was created. */
+ unsigned long created() const;
+
+ /* The time the online info was retrieved. */
+ unsigned long retrieved() const;
+
+ /* This bit is set if an error occured or some of the information
+ * in this structure may not be set. */
+ bool warning() const;
+
+ /* An update is available. */
+ bool update() const;
+
+ /* The update is important. */
+ bool urgent() const;
+
+ /* No information at all available. */
+ bool noinfo() const;
+
+ /* The package name is not known. */
+ bool unknown() const;
+
+ /* The information here is too old. */
+ bool tooOld() const;
+
+ /* Other error. */
+ bool error() const;
+
+ /* The version of the latest released version. */
+ EngineInfo::Version version() const;
+
+ /* The release date of that version. */
+ unsigned long releaseDate() const;
+
+private:
+ class Private;
+ std::shared_ptr<Private> d;
+};
+
+GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const SwdbResult &info);
+
+} // namespace GpgME
+
+GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(SwdbResult)
+
+#endif
#include "gpgmepp_export.h"
-#include "gpgme.h"
-
#include "global.h"
#include <memory>
recursive-include examples *.py
include gpgme-h-clean.py gpgme.i
include helpers.c helpers.h private.h
-recursive-include pyme *.py
+recursive-include gpg *.py
helpers.c helpers.h private.h \
gpgme-h-clean.py \
examples \
- pyme
+ gpg
SUBDIRS = . tests
$(srcdir)/examples \
$(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h
-COPY_FILES_PYME = \
- $(srcdir)/pyme/callbacks.py \
- $(srcdir)/pyme/constants \
- $(srcdir)/pyme/core.py \
- $(srcdir)/pyme/errors.py \
- $(srcdir)/pyme/__init__.py \
- $(srcdir)/pyme/results.py \
- $(srcdir)/pyme/util.py
+COPY_FILES_GPG = \
+ $(srcdir)/gpg/callbacks.py \
+ $(srcdir)/gpg/constants \
+ $(srcdir)/gpg/core.py \
+ $(srcdir)/gpg/errors.py \
+ $(srcdir)/gpg/__init__.py \
+ $(srcdir)/gpg/results.py \
+ $(srcdir)/gpg/util.py
# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
+copystamp: $(COPY_FILES) $(COPY_FILES_GPG) data.h config.h
if test "$(srcdir)" != "$(builddir)" ; then \
cp -R $(COPY_FILES) . ; \
- cp -R $(COPY_FILES_PYME) pyme ; \
+ cp -R $(COPY_FILES_GPG) gpg ; \
fi
touch $@
$$PYTHON setup.py build --verbose ; \
done
-dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
+dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp
CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose
- gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
+ gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz
.PHONY: prepare
prepare: copystamp
.PHONY: sdist
-sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
+sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
.PHONY: upload
-upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
+upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
twine upload $^
-CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
+CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \
data.h config.h copystamp
# Remove the rest.
if test "$(srcdir)" != "$(builddir)" ; then \
find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \
for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \
- for F in $(COPY_FILES_PYME); do \
- rm -rf -- pyme/`basename $$F` ; \
+ for F in $(COPY_FILES_GPG); do \
+ rm -rf -- gpg/`basename $$F` ; \
done ; \
fi
cat files.txt >> install_files.txt ; \
rm files.txt ; \
done
- $(MKDIR_P) $(DESTDIR)$(pythondir)/pyme
- mv install_files.txt $(DESTDIR)$(pythondir)/pyme
+ $(MKDIR_P) $(DESTDIR)$(pythondir)/gpg
+ mv install_files.txt $(DESTDIR)$(pythondir)/gpg
uninstall-local:
- xargs <$(DESTDIR)$(pythondir)/pyme/install_files.txt -- rm -rf --
- rm -rf -- $(DESTDIR)$(pythondir)/pyme
+ xargs <$(DESTDIR)$(pythondir)/gpg/install_files.txt -- rm -rf --
+ rm -rf -- $(DESTDIR)$(pythondir)/gpg
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
helpers.c helpers.h private.h \
gpgme-h-clean.py \
examples \
- pyme
+ gpg
SUBDIRS = . tests
COPY_FILES = \
$(srcdir)/examples \
$(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h
-COPY_FILES_PYME = \
- $(srcdir)/pyme/callbacks.py \
- $(srcdir)/pyme/constants \
- $(srcdir)/pyme/core.py \
- $(srcdir)/pyme/errors.py \
- $(srcdir)/pyme/__init__.py \
- $(srcdir)/pyme/results.py \
- $(srcdir)/pyme/util.py
+COPY_FILES_GPG = \
+ $(srcdir)/gpg/callbacks.py \
+ $(srcdir)/gpg/constants \
+ $(srcdir)/gpg/core.py \
+ $(srcdir)/gpg/errors.py \
+ $(srcdir)/gpg/__init__.py \
+ $(srcdir)/gpg/results.py \
+ $(srcdir)/gpg/util.py
-CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
+CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \
data.h config.h copystamp
all: all-recursive
# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
+copystamp: $(COPY_FILES) $(COPY_FILES_GPG) data.h config.h
if test "$(srcdir)" != "$(builddir)" ; then \
cp -R $(COPY_FILES) . ; \
- cp -R $(COPY_FILES_PYME) pyme ; \
+ cp -R $(COPY_FILES_GPG) gpg ; \
fi
touch $@
$$PYTHON setup.py build --verbose ; \
done
-dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
+dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp
CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose
- gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
+ gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz
.PHONY: prepare
prepare: copystamp
.PHONY: sdist
-sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
+sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
.PHONY: upload
-upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
+upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
twine upload $^
# Remove the rest.
if test "$(srcdir)" != "$(builddir)" ; then \
find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \
for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \
- for F in $(COPY_FILES_PYME); do \
- rm -rf -- pyme/`basename $$F` ; \
+ for F in $(COPY_FILES_GPG); do \
+ rm -rf -- gpg/`basename $$F` ; \
done ; \
fi
cat files.txt >> install_files.txt ; \
rm files.txt ; \
done
- $(MKDIR_P) $(DESTDIR)$(pythondir)/pyme
- mv install_files.txt $(DESTDIR)$(pythondir)/pyme
+ $(MKDIR_P) $(DESTDIR)$(pythondir)/gpg
+ mv install_files.txt $(DESTDIR)$(pythondir)/gpg
uninstall-local:
- xargs <$(DESTDIR)$(pythondir)/pyme/install_files.txt -- rm -rf --
- rm -rf -- $(DESTDIR)$(pythondir)/pyme
+ xargs <$(DESTDIR)$(pythondir)/gpg/install_files.txt -- rm -rf --
+ rm -rf -- $(DESTDIR)$(pythondir)/gpg
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
-PyME - GPGME for Python -*- org -*-
+gpg - GPGME bindings for Python -*- org -*-
=======================
-PyME is a python interface to the GPGME library:
+The "gpg" module is a python interface to the GPGME library:
https://www.gnupg.org/related_software/gpgme/
-PyME offers two interfaces, one is a high-level, curated, and
+"gpg" offers two interfaces, one is a high-level, curated, and
idiomatic interface that is implemented as a shim on top of the
low-level interface automatically created using SWIG.
* Authors
-PyME has been created by John Goerzen, and maintained, developed, and
+PyME was created by John Goerzen, and maintained, developed, and
cherished by Igor Belyi, Martin Albrecht, Ben McGinnes, and everyone
who contributed to it in any way.
In 2016 we merged a port of PyME to into the GPGME repository, and
development will continue there. Please see the VCS history for the
list of contributors, and if you do find bugs, or want to contribute,
-please get in touch and help maintain PyME.
+please get in touch and help maintain the python gpg bindings.
Please see the section 'History' further down this document for
references to previous versions.
* History
+ - The python bindings were renamed from PyME to "gpg" in 2016.
+
- The bindings have been merged into the GPGME repository in 2016.
- The latest version of PyME for Python 3.2 and above (as of
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
-with pyme.Context(protocol=pyme.constants.PROTOCOL_ASSUAN) as c:
+with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c:
# Invoke the pinentry to get a confirmation.
err = c.assuan_transact(['GET_CONFIRMATION', 'Hello there'])
print("You chose {}.".format("cancel" if err else "ok"))
"""A decryption filter
-This demonstrates decryption using pyme3 in three lines of code. To
+This demonstrates decryption using gpg3 in three lines of code. To
be used like this:
./decryption-filter.py <message.gpg >message.plain
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-pyme.Context().decrypt(sys.stdin, sink=sys.stdout)
+import gpg
+gpg.Context().decrypt(sys.stdin, sink=sys.stdout)
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
-with pyme.Context() as c:
+with gpg.Context() as c:
# Note: We must not modify the key store during iteration,
# therefore, we explicitly make a list.
- keys = list(c.keylist("joe+pyme@example.org"))
+ keys = list(c.keylist("joe+gpg@example.org"))
for k in keys:
c.op_delete(k, True)
del absolute_import, print_function, unicode_literals
import sys
-import pyme
+import gpg
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
recipients = list()
for key in c.keylist():
valid = 0
try:
ciphertext, _, _ = c.encrypt(b'This is my message.',
recipients=recipients)
- except pyme.errors.InvalidRecipients as e:
+ except gpg.errors.InvalidRecipients as e:
print("Encryption failed for these keys:\n{0!s}".format(e))
# filter out the bad keys
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# Sample of export and import of keys
-# It uses keys for joe+pyme@example.org generated by genkey.py script
+# It uses keys for joe+gpg@example.org generated by genkey.py script
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
import os
-import pyme
+import gpg
-user = "joe+pyme@example.org"
+user = "joe+gpg@example.org"
-with pyme.Context(armor=True) as c, pyme.Data() as expkey:
+with gpg.Context(armor=True) as c, gpg.Data() as expkey:
print(" - Export %s's public keys - " % user)
c.op_export(user, 0, expkey)
# delete keys to ensure that they came from our imported data. Note
# that if joe's key has private part as well we can only delete both
# of them.
-with pyme.Context() as c:
+with gpg.Context() as c:
# Note: We must not modify the key store during iteration,
# therfore, we explicitly make a list.
keys = list(c.keylist(user))
for k in keys:
c.op_delete(k, True)
-with pyme.Context() as c:
+with gpg.Context() as c:
print(" - Import exported keys - ")
c.op_import(expstring)
result = c.op_import_result()
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
# This is the example from the GPGME manual.
Subkey-Length: 2048
Name-Real: Joe Tester
Name-Comment: with stupid passphrase
-Name-Email: joe+pyme@example.org
+Name-Email: joe+gpg@example.org
Passphrase: Crypt0R0cks
Expire-Date: 2020-12-31
</GnupgKeyParms>
"""
-with pyme.Context() as c:
- c.set_progress_cb(pyme.callbacks.progress_stdout)
+with gpg.Context() as c:
+ c.set_progress_cb(gpg.callbacks.progress_stdout)
c.op_genkey(parms, None, None)
print("Generated key with fingerprint {0}.".format(
c.op_genkey_result().fpr))
del absolute_import, print_function, unicode_literals
import sys
-import pyme
+import gpg
if len(sys.argv) != 2:
sys.exit("Usage: %s <Gpg key pattern>\n" % sys.argv[0])
name = sys.argv[1]
-with pyme.Context() as c:
+with gpg.Context() as c:
keys = list(c.keylist(name))
if len(keys) == 0:
sys.exit("No key matching {}.".format(name))
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-from pyme.constants.sig import mode
+import gpg
+from gpg.constants.sig import mode
-with pyme.Context() as c:
+with gpg.Context() as c:
signed, _ = c.sign(b"Test message", mode=mode.CLEAR)
sys.stdout.buffer.write(signed)
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# Sample of unattended signing/verifying of a message.
-# It uses keys for joe+pyme@example.org generated by genkey.py script
+# It uses keys for joe+gpg@example.org generated by genkey.py script
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-from pyme.constants.sig import mode
+import gpg
+from gpg.constants.sig import mode
-user = "joe+pyme"
+user = "joe+gpg"
-with pyme.Context(pinentry_mode=pyme.constants.PINENTRY_MODE_LOOPBACK) as c:
+with gpg.Context(pinentry_mode=gpg.constants.PINENTRY_MODE_LOOPBACK) as c:
keys = list(c.keylist(user))
if len(keys) == 0:
sys.exit("No key matching {}.".format(user))
del absolute_import, print_function, unicode_literals
import sys
-import pyme
+import gpg
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
recipients = []
print("Enter name of your recipient(s), end with a blank line.")
while True:
del absolute_import, print_function, unicode_literals
import sys
-import pyme
+import gpg
if len(sys.argv) != 2:
sys.exit("fingerprint or unique key ID for gpgme_get_key()")
-with pyme.Context(protocol=pyme.constants.PROTOCOL_CMS) as c:
+with gpg.Context(protocol=gpg.constants.protocol.CMS) as c:
key = c.get_key(sys.argv[1])
print("got key: ", key.subkeys[0].fpr)
del absolute_import, print_function, unicode_literals
import sys
-from pyme import core
-from pyme.constants import protocol
+import gpg
def print_engine_infos():
- print("gpgme version:", core.check_version(None))
+ print("gpgme version:", gpg.core.check_version(None))
print("engines:")
- for engine in core.get_engine_info():
+ for engine in gpg.core.get_engine_info():
print(engine.file_name, engine.version)
- for proto in [protocol.OpenPGP, protocol.CMS]:
- print("Have {}? {}".format(core.get_protocol_name(proto),
- core.engine_check_version(proto)))
+ for proto in [gpg.constants.protocol.OpenPGP, gpg.constants.protocol.CMS]:
+ print("Have {}? {}".format(gpg.core.get_protocol_name(proto),
+ gpg.core.engine_check_version(proto)))
def verifyprintdetails(filename, detached_sig_filename=None):
"""Verify a signature, print a lot of details."""
- with core.Context() as c:
+ with gpg.Context() as c:
# Verify.
data, result = c.verify(open(filename),
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""Pyme: GPGME Interface for Python
+"""gpg: GnuPG Interface for Python (GPGME bindings)
-Welcome to PyME, the GPGME Interface for Python. "Pyme", when prounced,
-rhymes with "Pine".
+Welcome to gpg, the GnuPG Interface for Python.
The latest release of this package may be obtained from
https://www.gnupg.org
-Previous releases of this package for Python 2 can be obtained from
-http://pyme.sourceforge.net
-
FEATURES
--------
QUICK EXAMPLE
-------------
- >>> import pyme
- >>> with pyme.Context() as c:
- >>> with pyme.Context() as c:
+ >>> import gpg
+ >>> with gpg.Context() as c:
+ >>> with gpg.Context() as c:
... cipher, _, _ = c.encrypt("Hello world :)".encode(),
... passphrase="abc")
... c.decrypt(cipher, passphrase="abc")
...
(b'Hello world :)',
- <pyme.results.DecryptResult object at 0x7f5ab8121080>,
- <pyme.results.VerifyResult object at 0x7f5ab81219b0>)
+ <gpg.results.DecryptResult object at 0x7f5ab8121080>,
+ <gpg.results.VerifyResult object at 0x7f5ab81219b0>)
GENERAL OVERVIEW
----------------
For those of you familiar with GPGME, you will be right at home here.
-Pyme is, for the most part, a direct interface to the C GPGME
+The python gpg module is, for the most part, a direct interface to the C GPGME
library. However, it is re-packaged in a more Pythonic way --
object-oriented with classes and modules. Take a look at the classes
defined here -- they correspond directly to certain object types in GPGME
context.op_encrypt(recp, 1, plain, cipher)
The Python module automatically does error-checking and raises Python
-exception pyme.errors.GPGMEError when GPGME signals an error. getcode()
+exception gpg.errors.GPGMEError when GPGME signals an error. getcode()
and getsource() of this exception return code and source of the error.
IMPORTANT NOTE
FOR MORE INFORMATION
--------------------
-PYME3 homepage: https://www.gnupg.org/
+GnuPG homepage: https://www.gnupg.org/
GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/
"""
+# Constants.
+#
+# Copyright (C) 2016 g10 Code GmbH
+#
+# This file is part of GPGME.
+#
+# GPGME is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# GPGME is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_', globals())
+del util
+
+# For convenience, we import the modules here.
+from . import data, event, keylist, md, pk
+from . import protocol, sig, sigsum, status, validity
+
+# A complication arises because 'import' is a reserved keyword.
+# Import it as 'Import' instead.
+globals()['Import'] = getattr(__import__('', globals(), locals(),
+ [str('import')], 1), "import")
__all__ = ['data', 'event', 'import', 'keylist', 'md', 'pk',
'protocol', 'sig', 'sigsum', 'status', 'validity']
# GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We
-# implement pyme.Context.op_edit using gpgme_op_interact, so the
+# implement gpg.Context.op_edit using gpgme_op_interact, so the
# callbacks will be called with string keywords instead of numeric
# status messages. Code that is using these constants will continue
# to work.
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_DATA_ENCODING_', globals())
+del util
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_EVENT_', globals())
+del util
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_IMPORT_', globals())
+del util
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_KEYLIST_MODE_', globals())
+del util
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_MD_', globals())
+del util
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_PK_', globals())
+del util
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_PROTOCOL_', globals())
+del util
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from . import mode
-__all__ = ['mode']
+from . import mode, notation
+__all__ = ['mode', 'notation']
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_SIG_MODE_', globals())
+del util
--- /dev/null
+# Constants for signature notation data.
+#
+# Copyright (C) 2016 g10 Code GmbH
+#
+# This file is part of GPGME.
+#
+# GPGME is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# GPGME is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import absolute_import, print_function, unicode_literals
+del absolute_import, print_function, unicode_literals
+
+from gpg import util
+util.process_constants('GPGME_SIG_NOTATION_', globals())
+del util
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_SIGSUM_', globals())
+del util
del absolute_import, print_function, unicode_literals
# GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We
-# implement pyme.Context.op_edit using gpgme_op_interact, so the
+# implement gpg.Context.op_edit using gpgme_op_interact, so the
# callbacks will be called with string keywords instead of numeric
# status messages. Code that is using these constants will continue
# to work.
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_VALIDITY_', globals())
+del util
def _funcwrap(slf, *args):
result = func(slf.wrapped, *args)
if slf._callback_excinfo:
- gpgme.pyme_raise_callback_exception(slf)
+ gpgme.gpg_raise_callback_exception(slf)
return errorcheck(result, "Invocation of " + name)
else:
def _funcwrap(slf, *args):
result = func(slf.wrapped, *args)
if slf._callback_excinfo:
- gpgme.pyme_raise_callback_exception(slf)
+ gpgme.gpg_raise_callback_exception(slf)
return result
doc = self._munge_docstring.sub(r'\2.\1(\3', getattr(func, "__doc__"))
errptr)
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
errorcheck(err)
result = gpgme.gpgme_op_interact(self.wrapped, key, flags,
opaquedata, sink)
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
errorcheck(result)
@property
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
- gpgme.pyme_set_passphrase_cb(self, hookdata)
+ gpgme.gpg_set_passphrase_cb(self, hookdata)
def _free_passcb(self):
- if gpgme.pyme_set_passphrase_cb:
+ if gpgme.gpg_set_passphrase_cb:
self.set_passphrase_cb(None)
def set_progress_cb(self, func, hook=None):
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
- gpgme.pyme_set_progress_cb(self, hookdata)
+ gpgme.gpg_set_progress_cb(self, hookdata)
def _free_progresscb(self):
- if gpgme.pyme_set_progress_cb:
+ if gpgme.gpg_set_progress_cb:
self.set_progress_cb(None)
def set_status_cb(self, func, hook=None):
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
- gpgme.pyme_set_status_cb(self, hookdata)
+ gpgme.gpg_set_status_cb(self, hookdata)
def _free_statuscb(self):
- if gpgme.pyme_set_status_cb:
+ if gpgme.gpg_set_status_cb:
self.set_status_cb(None)
@property
if self.wrapped != None and gpgme.gpgme_data_release:
gpgme.gpgme_data_release(self.wrapped)
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
self.wrapped = None
self._free_datacbs()
else:
hookdata = (weakref.ref(self),
read_cb, write_cb, seek_cb, release_cb)
- gpgme.pyme_data_new_from_cbs(self, hookdata, tmp)
+ gpgme.gpg_data_new_from_cbs(self, hookdata, tmp)
self.wrapped = gpgme.gpgme_data_t_p_value(tmp)
gpgme.delete_gpgme_data_t_p(tmp)
written = gpgme.gpgme_data_write(self.wrapped, buffer)
if written < 0:
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
else:
raise GPGMEError.fromSyserror()
return written
result = gpgme.gpgme_data_read(self.wrapped, size)
except:
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
else:
raise
return result
result = gpgme.gpgme_data_read(self.wrapped, 4096)
except:
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
else:
raise
if len(result) == 0:
EOF = None
util.process_constants('GPG_ERR_', globals())
+del util
-class PymeError(Exception):
+class GpgError(Exception):
pass
-class GPGMEError(PymeError):
+class GPGMEError(GpgError):
def __init__(self, error = None, message = None):
self.error = error
self.message = message
# These errors are raised in the idiomatic interface code.
-class EncryptionError(PymeError):
+class EncryptionError(GpgError):
pass
class InvalidRecipients(EncryptionError):
gpgme.gpgme_strerror(r.reason))
for r in self.recipients)
-class DeryptionError(PymeError):
+class DeryptionError(GpgError):
pass
class UnsupportedAlgorithm(DeryptionError):
def __str__(self):
return self.algorithm
-class SigningError(PymeError):
+class SigningError(GpgError):
pass
class InvalidSigners(SigningError):
gpgme.gpgme_strerror(s.reason))
for s in self.signers)
-class VerificationError(PymeError):
+class VerificationError(GpgError):
pass
class BadSignatures(VerificationError):
+
# This file is compatible with both classic and new-style classes.
from . import gpgme
-productname = 'pyme'
-versionstr = "1.7.1"
+productname = 'gpg'
+versionstr = "1.8.0"
gpgme_versionstr = gpgme.GPGME_VERSION
-in_tree_build = bool(gpgme.cvar.pyme_in_tree_build)
+in_tree_build = bool(gpgme.cvar.gpg_in_tree_build)
versionlist = versionstr.split(".")
major = versionlist[0]
from . import gpgme
-productname = 'pyme'
+productname = 'gpg'
versionstr = "@VERSION@"
gpgme_versionstr = gpgme.GPGME_VERSION
-in_tree_build = bool(gpgme.cvar.pyme_in_tree_build)
+in_tree_build = bool(gpgme.cvar.gpg_in_tree_build)
versionlist = versionstr.split(".")
major = versionlist[0]
$1 = NULL;
else {
PyObject *pypointer;
- pypointer = _pyme_obj2gpgme_data_t($input, $argnum, &wrapper,
+ pypointer = _gpg_obj2gpgme_data_t($input, $argnum, &wrapper,
&bytesio, &view);
if (pypointer == NULL)
return NULL;
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "EncryptResult");
+ $result = _gpg_wrap_result(fragile, "EncryptResult");
Py_DECREF(fragile);
}
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "DecryptResult");
+ $result = _gpg_wrap_result(fragile, "DecryptResult");
Py_DECREF(fragile);
}
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "SignResult");
+ $result = _gpg_wrap_result(fragile, "SignResult");
Py_DECREF(fragile);
}
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "VerifyResult");
+ $result = _gpg_wrap_result(fragile, "VerifyResult");
Py_DECREF(fragile);
}
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "ImportResult");
+ $result = _gpg_wrap_result(fragile, "ImportResult");
Py_DECREF(fragile);
}
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "GenkeyResult");
+ $result = _gpg_wrap_result(fragile, "GenkeyResult");
Py_DECREF(fragile);
}
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "KeylistResult");
+ $result = _gpg_wrap_result(fragile, "KeylistResult");
Py_DECREF(fragile);
}
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "VFSMountResult");
+ $result = _gpg_wrap_result(fragile, "VFSMountResult");
Py_DECREF(fragile);
}
Py_DECREF($result);
return NULL; /* raise */
}
- o = _pyme_wrap_result(fragile, "EngineInfo");
+ o = _gpg_wrap_result(fragile, "EngineInfo");
Py_DECREF(fragile);
if (o == NULL)
{
return PyErr_Format(PyExc_TypeError,
"interact callback must be a tuple of size 2 or 3");
- $1 = (gpgme_interact_cb_t) _pyme_interact_cb;
+ $1 = (gpgme_interact_cb_t) _gpg_interact_cb;
$2 = $input;
}
"callback must be a tuple of size 2");
if (! PyCallable_Check(PyTuple_GetItem($input, 1)))
return PyErr_Format(PyExc_TypeError, "second item must be callable");
- $1 = _pyme_assuan_data_cb;
+ $1 = _gpg_assuan_data_cb;
$2 = $input;
}
}
"callback must be a tuple of size 2");
if (! PyCallable_Check(PyTuple_GetItem($input, 1)))
return PyErr_Format(PyExc_TypeError, "second item must be callable");
- $1 = _pyme_assuan_inquire_cb;
+ $1 = _gpg_assuan_inquire_cb;
$2 = $input;
}
}
"callback must be a tuple of size 2");
if (! PyCallable_Check(PyTuple_GetItem($input, 1)))
return PyErr_Format(PyExc_TypeError, "second item must be callable");
- $1 = _pyme_assuan_status_cb;
+ $1 = _gpg_assuan_status_cb;
$2 = $input;
}
}
/* SWIG runtime support for helpers.c */
PyObject *
-_pyme_wrap_gpgme_data_t(gpgme_data_t data)
+_gpg_wrap_gpgme_data_t(gpgme_data_t data)
{
return SWIG_Python_NewPointerObj(NULL, data, SWIGTYPE_p_gpgme_data, 0);
}
gpgme_ctx_t
-_pyme_unwrap_gpgme_ctx_t(PyObject *wrapped)
+_gpg_unwrap_gpgme_ctx_t(PyObject *wrapped)
{
gpgme_ctx_t result;
if (SWIG_ConvertPtr(wrapped,
#include "private.h"
/* Flag specifying whether this is an in-tree build. */
-int pyme_in_tree_build =
+int gpg_in_tree_build =
#if IN_TREE_BUILD
1
#else
static PyObject *GPGMEError = NULL;
-void _pyme_exception_init(void) {
+void _gpg_exception_init(void) {
if (GPGMEError == NULL) {
PyObject *errors;
PyObject *from_list = PyList_New(0);
}
static PyObject *
-_pyme_raise_exception(gpgme_error_t err)
+_gpg_raise_exception(gpgme_error_t err)
{
PyObject *e;
- _pyme_exception_init();
+ _gpg_exception_init();
if (GPGMEError == NULL)
return PyErr_Format(PyExc_RuntimeError, "Got gpgme_error_t %d", err);
return NULL; /* raise */
}
-gpgme_error_t _pyme_exception2code(void) {
+gpgme_error_t _gpg_exception2code(void) {
gpgme_error_t err_status = gpg_error(GPG_ERR_GENERAL);
if (GPGMEError && PyErr_ExceptionMatches(GPGMEError)) {
PyObject *type = 0, *value = 0, *traceback = 0;
/* Exception support for callbacks. */
#define EXCINFO "_callback_excinfo"
-static void _pyme_stash_callback_exception(PyObject *weak_self)
+static void _gpg_stash_callback_exception(PyObject *weak_self)
{
PyObject *self, *ptype, *pvalue, *ptraceback, *excinfo;
Py_DECREF(excinfo);
}
-PyObject *pyme_raise_callback_exception(PyObject *self)
+PyObject *gpg_raise_callback_exception(PyObject *self)
{
PyGILState_STATE state = PyGILState_Ensure();
PyObject *ptype, *pvalue, *ptraceback, *excinfo;
/* Convert object to a pointer to gpgme type, generic version. */
PyObject *
-_pyme_obj2gpgme_t(PyObject *input, const char *objtype, int argnum)
+_gpg_obj2gpgme_t(PyObject *input, const char *objtype, int argnum)
{
PyObject *pyname = NULL, *pypointer = NULL;
pyname = PyObject_GetAttrString(input, "_ctype");
objects with a fileno method, returning it in WRAPPER. This object
must be de-referenced when no longer needed. */
PyObject *
-_pyme_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper,
+_gpg_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper,
PyObject **bytesio, Py_buffer *view)
{
gpgme_error_t err;
err = gpgme_data_new_from_fd(wrapper, (int) PyLong_AsLong(fd));
Py_DECREF(fd);
if (err)
- return _pyme_raise_exception (err);
+ return _gpg_raise_exception (err);
- return _pyme_wrap_gpgme_data_t(*wrapper);
+ return _gpg_wrap_gpgme_data_t(*wrapper);
}
else
PyErr_Clear();
err = gpgme_data_new_from_mem(wrapper, view->buf, (size_t) view->len, 0);
if (err)
- return _pyme_raise_exception (err);
+ return _gpg_raise_exception (err);
- return _pyme_wrap_gpgme_data_t(*wrapper);
+ return _gpg_wrap_gpgme_data_t(*wrapper);
}
/* As last resort we assume it is a wrapped data object. */
if (PyObject_HasAttrString(data, "_ctype"))
- return _pyme_obj2gpgme_t(data, "gpgme_data_t", argnum);
+ return _gpg_obj2gpgme_t(data, "gpgme_data_t", argnum);
return PyErr_Format(PyExc_TypeError,
- "arg %d: expected pyme.Data, file, or an object "
+ "arg %d: expected gpg.Data, file, or an object "
"implementing the buffer protocol, got %s",
argnum, data->ob_type->tp_name);
}
\f
PyObject *
-_pyme_wrap_result(PyObject *fragile, const char *classname)
+_gpg_wrap_result(PyObject *fragile, const char *classname)
{
static PyObject *results;
PyObject *class;
PyObject *encoded = NULL;
gpgme_error_t err_status = 0;
- _pyme_exception_init();
+ _gpg_exception_init();
assert (PyTuple_Check(pyhook));
assert (PyTuple_Size(pyhook) == 2 || PyTuple_Size(pyhook) == 3);
retval = PyObject_CallObject(func, args);
Py_DECREF(args);
if (PyErr_Occurred()) {
- err_status = _pyme_exception2code();
+ err_status = _gpg_exception2code();
} else {
if (!retval) {
if (write(fd, "\n", 1) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
} else {
char *buf;
if (write(fd, buf, len) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
if (! err_status && write(fd, "\n", 1) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
Py_DECREF(retval);
leave:
if (err_status)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
Py_XDECREF(encoded);
PyGILState_Release(state);
}
PyObject *
-pyme_set_passphrase_cb(PyObject *self, PyObject *cb) {
+gpg_set_passphrase_cb(PyObject *self, PyObject *cb) {
PyGILState_STATE state = PyGILState_Ensure();
PyObject *wrapped;
gpgme_ctx_t ctx;
return NULL;
}
- ctx = _pyme_unwrap_gpgme_ctx_t(wrapped);
+ ctx = _gpg_unwrap_gpgme_ctx_t(wrapped);
Py_DECREF(wrapped);
if (ctx == NULL)
{
PyTuple_SetItem(args, 0, PyUnicode_DecodeUTF8(what, strlen (what),
"strict"));
if (PyErr_Occurred()) {
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
Py_DECREF(args);
PyGILState_Release(state);
return;
retval = PyObject_CallObject(func, args);
if (PyErr_Occurred())
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
Py_DECREF(args);
Py_XDECREF(retval);
PyGILState_Release(state);
}
PyObject *
-pyme_set_progress_cb(PyObject *self, PyObject *cb) {
+gpg_set_progress_cb(PyObject *self, PyObject *cb) {
PyGILState_STATE state = PyGILState_Ensure();
PyObject *wrapped;
gpgme_ctx_t ctx;
return NULL;
}
- ctx = _pyme_unwrap_gpgme_ctx_t(wrapped);
+ ctx = _gpg_unwrap_gpgme_ctx_t(wrapped);
Py_DECREF(wrapped);
if (ctx == NULL)
{
retval = PyObject_CallObject(func, pyargs);
if (PyErr_Occurred())
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
Py_DECREF(pyargs);
Py_XDECREF(retval);
leave:
if (err)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
return err;
}
PyObject *
-pyme_set_status_cb(PyObject *self, PyObject *cb) {
+gpg_set_status_cb(PyObject *self, PyObject *cb) {
PyGILState_STATE state = PyGILState_Ensure();
PyObject *wrapped;
gpgme_ctx_t ctx;
return NULL;
}
- ctx = _pyme_unwrap_gpgme_ctx_t(wrapped);
+ ctx = _gpg_unwrap_gpgme_ctx_t(wrapped);
Py_DECREF(wrapped);
if (ctx == NULL)
{
/* Interact callbacks. */
gpgme_error_t
-_pyme_interact_cb(void *opaque, const char *keyword,
+_gpg_interact_cb(void *opaque, const char *keyword,
const char *args, int fd)
{
PyGILState_STATE state = PyGILState_Ensure();
gpgme_error_t err_status = 0;
PyObject *self = NULL;
- _pyme_exception_init();
+ _gpg_exception_init();
assert (PyTuple_Check(pyopaque));
assert (PyTuple_Size(pyopaque) == 2 || PyTuple_Size(pyopaque) == 3);
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {
- err_status = _pyme_exception2code();
+ err_status = _gpg_exception2code();
} else {
if (fd>=0 && retval && PyUnicode_Check(retval)) {
PyObject *encoded = NULL;
if (write(fd, buffer, size) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
if (! err_status && write(fd, "\n", 1) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
Py_DECREF(encoded);
}
}
leave:
if (err_status)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
Py_XDECREF(retval);
PyGILState_Release(state);
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
PyErr_Format(PyExc_TypeError,
"expected bytes from read callback, got %s",
retval->ob_type->tp_name);
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
PyErr_Format(PyExc_TypeError,
"expected %zu bytes from read callback, got %zu",
size, PyBytes_Size(retval));
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
PyErr_Format(PyExc_TypeError,
"expected int from write callback, got %s",
retval->ob_type->tp_name);
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
}
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
PyErr_Format(PyExc_TypeError,
"expected int from seek callback, got %s",
retval->ob_type->tp_name);
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
}
Py_XDECREF(retval);
Py_DECREF(pyargs);
if (PyErr_Occurred())
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
}
PyObject *
-pyme_data_new_from_cbs(PyObject *self,
+gpg_data_new_from_cbs(PyObject *self,
PyObject *pycbs,
gpgme_data_t *r_data)
{
err = gpgme_data_new_from_cbs(r_data, &cbs, (void *) pycbs);
if (err)
- return _pyme_raise_exception(err);
+ return _gpg_raise_exception(err);
PyObject_SetAttrString(self, "_data_cbs", pycbs);
/* The assuan callbacks. */
gpgme_error_t
-_pyme_assuan_data_cb (void *hook, const void *data, size_t datalen)
+_gpg_assuan_data_cb (void *hook, const void *data, size_t datalen)
{
PyGILState_STATE state = PyGILState_Ensure();
gpgme_error_t err = 0;
py_data = PyBytes_FromStringAndSize(data, datalen);
if (py_data == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
retval = PyObject_CallFunctionObjArgs(func, py_data, NULL);
if (PyErr_Occurred())
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
Py_DECREF(py_data);
Py_XDECREF(retval);
leave:
if (err)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
return err;
}
gpgme_error_t
-_pyme_assuan_inquire_cb (void *hook, const char *name, const char *args,
+_gpg_assuan_inquire_cb (void *hook, const char *name, const char *args,
gpgme_data_t *r_data)
{
PyGILState_STATE state = PyGILState_Ensure();
py_name = PyUnicode_FromString(name);
if (py_name == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
py_args = PyUnicode_FromString(args);
if (py_args == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
retval = PyObject_CallFunctionObjArgs(func, py_name, py_args, NULL);
if (PyErr_Occurred())
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
Py_XDECREF(retval);
/* FIXME: Returning data is not yet implemented. */
Py_XDECREF(py_name);
Py_XDECREF(py_args);
if (err)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
return err;
}
gpgme_error_t
-_pyme_assuan_status_cb (void *hook, const char *status, const char *args)
+_gpg_assuan_status_cb (void *hook, const char *status, const char *args)
{
PyGILState_STATE state = PyGILState_Ensure();
gpgme_error_t err = 0;
py_status = PyUnicode_FromString(status);
if (py_status == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
py_args = PyUnicode_FromString(args);
if (py_args == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
retval = PyObject_CallFunctionObjArgs(func, py_status, py_args, NULL);
if (PyErr_Occurred())
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
Py_XDECREF(retval);
leave:
Py_XDECREF(py_status);
Py_XDECREF(py_args);
if (err)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
return err;
}
#endif
/* Flag specifying whether this is an in-tree build. */
-extern int pyme_in_tree_build;
+extern int gpg_in_tree_build;
-PyObject *pyme_raise_callback_exception(PyObject *self);
+PyObject *gpg_raise_callback_exception(PyObject *self);
-PyObject *pyme_set_passphrase_cb(PyObject *self, PyObject *cb);
-PyObject *pyme_set_progress_cb(PyObject *self, PyObject *cb);
-PyObject *pyme_set_status_cb(PyObject *self, PyObject *cb);
+PyObject *gpg_set_passphrase_cb(PyObject *self, PyObject *cb);
+PyObject *gpg_set_progress_cb(PyObject *self, PyObject *cb);
+PyObject *gpg_set_status_cb(PyObject *self, PyObject *cb);
-PyObject *pyme_data_new_from_cbs(PyObject *self, PyObject *pycbs,
+PyObject *gpg_data_new_from_cbs(PyObject *self, PyObject *pycbs,
gpgme_data_t *r_data);
#include <gpgme.h>
-#ifndef _PYME_PRIVATE_H_
-#define _PYME_PRIVATE_H_
+#ifndef _GPG_PRIVATE_H_
+#define _GPG_PRIVATE_H_
/* GPGME glue. Implemented in helpers.c. */
-void _pyme_exception_init(void);
-gpgme_error_t _pyme_exception2code(void);
+void _gpg_exception_init(void);
+gpgme_error_t _gpg_exception2code(void);
-PyObject *_pyme_obj2gpgme_t(PyObject *input, const char *objtype, int argnum);
-PyObject *_pyme_obj2gpgme_data_t(PyObject *input, int argnum,
+PyObject *_gpg_obj2gpgme_t(PyObject *input, const char *objtype, int argnum);
+PyObject *_gpg_obj2gpgme_data_t(PyObject *input, int argnum,
gpgme_data_t *wrapper,
PyObject **bytesio, Py_buffer *view);
-PyObject *_pyme_wrap_result(PyObject *fragile, const char *classname);
+PyObject *_gpg_wrap_result(PyObject *fragile, const char *classname);
-gpgme_error_t _pyme_interact_cb(void *opaque, const char *keyword,
+gpgme_error_t _gpg_interact_cb(void *opaque, const char *keyword,
const char *args, int fd);
-gpgme_error_t _pyme_assuan_data_cb (void *hook,
+gpgme_error_t _gpg_assuan_data_cb (void *hook,
const void *data, size_t datalen);
-gpgme_error_t _pyme_assuan_inquire_cb (void *hook,
+gpgme_error_t _gpg_assuan_inquire_cb (void *hook,
const char *name, const char *args,
gpgme_data_t *r_data);
-gpgme_error_t _pyme_assuan_status_cb (void *hook,
+gpgme_error_t _gpg_assuan_status_cb (void *hook,
const char *status, const char *args);
\f
/* SWIG runtime support. Implemented in gpgme.i. */
-PyObject *_pyme_wrap_gpgme_data_t(gpgme_data_t data);
-gpgme_ctx_t _pyme_unwrap_gpgme_ctx_t(PyObject *wrapped);
+PyObject *_gpg_wrap_gpgme_data_t(gpgme_data_t data);
+gpgme_ctx_t _gpg_unwrap_gpgme_ctx_t(PyObject *wrapped);
-#endif /* _PYME_PRIVATE_H_ */
+#endif /* _GPG_PRIVATE_H_ */
import glob
import subprocess
-# Out-of-tree build of the pyme3 bindings.
+# Out-of-tree build of the gpg bindings.
gpg_error_config = ["gpg-error-config"]
gpgme_config_flags = ["--thread=pthread"]
gpgme_config = ["gpgme-config"] + gpgme_config_flags
version = version.split('-')[0]
major, minor, patch = map(int, version.split('.'))
-if not (major > 1 or (major == 1 and minor >= 6)):
- sys.exit('Need at least GPGME version 1.6, found {}.'.format(version_raw))
+if not (major > 1 or (major == 1 and minor >= 7)):
+ sys.exit('Need at least GPGME version 1.7, found {}.'.format(version_raw))
if not gpgme_h:
gpgme_h = os.path.join(getconfig("prefix")[0], "include", "gpgme.h")
glob.glob(os.path.join(gpg_error_prefix, "include",
"*", "gpg-error.h"))[0]
-print("Building pyme3 using {} and {}.".format(gpgme_h, gpg_error_h))
+print("Building python gpg module using {} and {}.".format(gpgme_h, gpg_error_h))
# Cleanup gpgme.h from deprecated functions and typedefs.
subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpgme_h],
self.run_command('build_ext')
build.run(self)
-swige = Extension("pyme._gpgme", ["gpgme.i", "helpers.c"],
+swige = Extension("gpg._gpgme", ["gpgme.i", "helpers.c"],
swig_opts = ['-py3', '-builtin', '-threads',
- '-outdir', 'pyme'] + extra_swig_opts,
+ '-outdir', 'gpg'] + extra_swig_opts,
include_dirs = include_dirs,
define_macros = define_macros,
library_dirs = library_dirs,
extra_link_args = libs)
-setup(name="pyme3",
+setup(name="gpg",
cmdclass={'build': BuildExtFirstHack},
version="@VERSION@",
description='Python bindings for GPGME GnuPG cryptography library',
author_email='gnupg-devel@gnupg.org',
url='https://www.gnupg.org',
ext_modules=[swige],
- packages = ['pyme', 'pyme.constants', 'pyme.constants.data',
- 'pyme.constants.keylist', 'pyme.constants.sig'],
+ packages = ['gpg', 'gpg.constants', 'gpg.constants.data',
+ 'gpg.constants.keylist', 'gpg.constants.sig'],
license="LGPL2.1+ (the library), GPL2+ (tests and examples)",
classifiers=[
'Development Status :: 4 - Beta',
./private-keys-v1.d/gpg-sample.stamp: $(private_keys)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
for k in $(private_keys); do \
cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \
done
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
-rm -fR -- private-keys-v1.d openpgp-revocs.d S.gpg-agent sshcontrol
./private-keys-v1.d/gpg-sample.stamp: $(private_keys)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
for k in $(private_keys); do \
cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \
done
import os
import subprocess
-import pyme
+import gpg
import support
-support.init_gpgme(pyme.constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
subprocess.check_call([os.path.join(os.getenv('top_srcdir'),
"tests", "start-stop-agent"), "--start"])
-with pyme.Context() as c:
+with gpg.Context() as c:
alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)
import sys
import os
-from pyme import core
+import gpg
# known keys
alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734"
return os.path.join(os.environ['srcdir'], name)
def init_gpgme(proto):
- core.engine_check_version(proto)
+ gpg.core.engine_check_version(proto)
verbose = int(os.environ.get('verbose', 0)) > 1
def print_data(data):
else:
result = None
return result
- with core.Data() as sink:
+ with gpg.Data() as sink:
ctx.op_edit(key, Editor().edit, sink, sink)
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
-c = core.Context()
-c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+c = gpg.Context()
+c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
# Valid passphrases, both as string and bytes.
for passphrase in ('foo', b'foo'):
Key-Length: 1024
Name-Real: Joe Tester
Name-Comment: with stupid passphrase
-Name-Email: joe+pyme@example.org
+Name-Email: joe+gpg@example.org
Passphrase: Crypt0R0cks
Expire-Date: 2020-12-31
</GnupgKeyParms>
"PROGRESS UPDATE: what = {}, type = {}, current = {}, total = {}"
.format(what, typ, current, total))
-c = core.Context()
+c = gpg.Context()
c.set_progress_cb(progress_cb, messages)
c.op_genkey(parms, None, None)
assert len(messages) > 0
def progress_cb(what, typ, current, total, hook=None):
raise myException
-c = core.Context()
+c = gpg.Context()
c.set_progress_cb(progress_cb, None)
try:
c.op_genkey(parms, None, None)
# Test the edit callback.
-c = core.Context()
-c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+c = gpg.Context()
+c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
c.set_passphrase_cb(lambda *args: "abc")
-sink = core.Data()
+sink = gpg.Data()
alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
cookie = object()
assert edit_cb_called
# Test exceptions.
-c = core.Context()
-c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+c = gpg.Context()
+c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
c.set_passphrase_cb(lambda *args: "abc")
-sink = core.Data()
+sink = gpg.Data()
def edit_cb(status, args):
raise myException
# Test the status callback.
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
status_cb_called = False
def status_cb(keyword, args, hook=None):
status_cb_called = True
assert hook == cookie
-c = core.Context()
+c = gpg.Context()
c.set_status_cb(status_cb, cookie)
c.set_ctx_flag("full-status", "1")
-c.op_encrypt([alpha], constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+c.op_encrypt([alpha], gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
assert status_cb_called
# Test exceptions.
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
def status_cb(keyword, args):
raise myException
-c = core.Context()
+c = gpg.Context()
c.set_status_cb(status_cb, None)
c.set_ctx_flag("full-status", "1")
try:
- c.op_encrypt([alpha], constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+ c.op_encrypt([alpha], gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
except Exception as e:
assert e == myException
else:
return 0
def release_cb(hook=None):
assert hook == cookie
-data = core.Data(cbs=(read_cb, None, None, release_cb, cookie))
+data = gpg.Data(cbs=(read_cb, None, None, release_cb, cookie))
try:
data.read()
except Exception as e:
def read_cb(amount):
raise myException
-data = core.Data(cbs=(read_cb, None, None, lambda: None))
+data = gpg.Data(cbs=(read_cb, None, None, lambda: None))
try:
data.read()
except Exception as e:
def write_cb(what, hook=None):
assert hook == cookie
return "wrong type"
-data = core.Data(cbs=(None, write_cb, None, release_cb, cookie))
+data = gpg.Data(cbs=(None, write_cb, None, release_cb, cookie))
try:
data.write(b'stuff')
except Exception as e:
def write_cb(what):
raise myException
-data = core.Data(cbs=(None, write_cb, None, lambda: None))
+data = gpg.Data(cbs=(None, write_cb, None, lambda: None))
try:
data.write(b'stuff')
except Exception as e:
def seek_cb(offset, whence, hook=None):
assert hook == cookie
return "wrong type"
-data = core.Data(cbs=(None, None, seek_cb, release_cb, cookie))
+data = gpg.Data(cbs=(None, None, seek_cb, release_cb, cookie))
try:
data.seek(0, os.SEEK_SET)
except Exception as e:
def seek_cb(offset, whence):
raise myException
-data = core.Data(cbs=(None, None, seek_cb, lambda: None))
+data = gpg.Data(cbs=(None, None, seek_cb, lambda: None))
try:
data.seek(0, os.SEEK_SET)
except Exception as e:
import io
import os
import tempfile
-from pyme import core
+import gpg
-data = core.Data('Hello world!')
+data = gpg.Data('Hello world!')
assert data.read() == b'Hello world!'
assert data.read() == b''
assert data.read() == b'Hello world!'
assert data.read() == b''
-data = core.Data(b'Hello world!')
+data = gpg.Data(b'Hello world!')
assert data.read() == b'Hello world!'
-data = core.Data(b'Hello world!', copy=False)
+data = gpg.Data(b'Hello world!', copy=False)
assert data.read() == b'Hello world!'
-data = core.Data()
+data = gpg.Data()
data.write('Hello world!')
data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
-data = core.Data()
+data = gpg.Data()
data.write(b'Hello world!')
data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
binjunk = bytes(range(256))
-data = core.Data()
+data = gpg.Data()
data.write(binjunk)
data.seek(0, os.SEEK_SET)
assert data.read() == binjunk
-data = core.Data()
+data = gpg.Data()
data.set_file_name("foobar")
assert data.get_file_name() == "foobar"
tmp.seek(0)
# Open using name.
- data = core.Data(file=tmp.name)
+ data = gpg.Data(file=tmp.name)
assert data.read() == binjunk
# Open using name, without copying.
if False:
# delayed reads are not yet supported
- data = core.Data(file=tmp.name, copy=False)
+ data = gpg.Data(file=tmp.name, copy=False)
assert data.read() == binjunk
# Open using stream.
tmp.seek(0)
- data = core.Data(file=tmp)
+ data = gpg.Data(file=tmp)
assert data.read() == binjunk
# Open using stream, offset, and length.
- data = core.Data(file=tmp, offset=0, length=42)
+ data = gpg.Data(file=tmp, offset=0, length=42)
assert data.read() == binjunk[:42]
# Open using name, offset, and length.
- data = core.Data(file=tmp.name, offset=23, length=42)
+ data = gpg.Data(file=tmp.name, offset=23, length=42)
assert data.read() == binjunk[23:23+42]
# Test callbacks.
do = DataObject()
cookie = object()
-data = core.Data(cbs=(do.read, do.write, do.seek, do.release, cookie))
+data = gpg.Data(cbs=(do.read, do.write, do.seek, do.release, cookie))
data.write('Hello world!')
data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
# Again, without the cookie.
do = DataObject()
-data = core.Data(cbs=(do.read, do.write, do.seek, do.release))
+data = gpg.Data(cbs=(do.read, do.write, do.seek, do.release))
data.write('Hello world!')
data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants, errors
+import gpg
import support
def check_verify_result(result, summary, fpr, status):
sig = result.signatures[0]
assert sig.summary == summary, "Unexpected signature summary"
assert sig.fpr == fpr
- assert errors.GPGMEError(sig.status).getcode() == status
+ assert gpg.errors.GPGMEError(sig.status).getcode() == status
assert len(sig.notations) == 0
assert not sig.wrong_key_usage
- assert sig.validity == constants.VALIDITY_FULL
- assert errors.GPGMEError(sig.validity_reason).getcode() == errors.NO_ERROR
+ assert sig.validity == gpg.constants.validity.FULL
+ assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
-source = core.Data(file=support.make_filename("cipher-2.asc"))
-sink = core.Data()
+source = gpg.Data(file=support.make_filename("cipher-2.asc"))
+sink = gpg.Data()
c.op_decrypt_verify(source, sink)
result = c.op_decrypt_result()
verify_result = c.op_verify_result()
check_verify_result(verify_result,
- constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
+ gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR)
+ gpg.errors.NO_ERROR)
# Idiomatic interface.
-with pyme.Context() as c:
+with gpg.Context() as c:
alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)
plaintext, _, verify_result = \
assert plaintext.find(b'Wenn Sie dies lesen k') >= 0, \
'Plaintext not found'
check_verify_result(verify_result,
- constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
+ gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR)
+ gpg.errors.NO_ERROR)
try:
c.decrypt(open(support.make_filename("cipher-2.asc")),
verify=[alpha, bob])
- except errors.MissingSignatures as e:
+ except gpg.errors.MissingSignatures as e:
assert len(e.missing) == 1
assert e.missing[0] == bob
else:
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
-source = core.Data(file=support.make_filename("cipher-1.asc"))
-sink = core.Data()
+source = gpg.Data(file=support.make_filename("cipher-1.asc"))
+sink = gpg.Data()
c.op_decrypt(source, sink)
result = c.op_decrypt_result()
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context() as c:
+with gpg.Context() as c:
plaintext, _, _ = c.decrypt(open(support.make_filename("cipher-1.asc")))
assert len(plaintext) > 0
assert plaintext.find(b'Wenn Sie dies lesen k') >= 0, \
import sys
import os
-from pyme import core, constants
+import gpg
import support
class KeyEditor(object):
return result
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
-c = core.Context()
-c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+c = gpg.Context()
+c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
c.set_passphrase_cb(lambda *args: "abc")
c.set_armor(True)
assert editor.done
# The deprecated interface.
-sink = core.Data()
+sink = gpg.Data()
editor = KeyEditor()
c.op_edit(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False),
editor.edit_fnc, sink, sink)
import sys
import random
-from pyme import core, constants
+import gpg
import support
if len(sys.argv) == 2:
else:
nbytes = 100000
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
ntoread = nbytes
def read_cb(amount):
nwritten += len(data)
return len(data)
-source = core.Data(cbs=(read_cb, None, None, lambda: None))
-sink = core.Data(cbs=(None, write_cb, None, lambda: None))
+source = gpg.Data(cbs=(read_cb, None, None, lambda: None))
+sink = gpg.Data(cbs=(None, write_cb, None, lambda: None))
keys = []
keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False))
keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False))
-c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
result = c.op_encrypt_result()
assert not result.invalid_recipients, \
"Invalid recipient encountered: {}".format(result.invalid_recipients.fpr)
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
def check_result(r, typ):
if signature.type != typ:
sys.exit("Wrong type of signature created")
- if signature.pubkey_algo != constants.PK_DSA:
+ if signature.pubkey_algo != gpg.constants.pk.DSA:
sys.exit("Wrong pubkey algorithm reported: {}".format(
signature.pubkey_algo))
- if signature.hash_algo not in (constants.MD_SHA1, constants.MD_RMD160):
+ if signature.hash_algo not in (gpg.constants.md.SHA1, gpg.constants.md.RMD160):
sys.exit("Wrong hash algorithm reported: {}".format(
signature.hash_algo))
keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False))
for recipients in (keys, []):
- source = core.Data("Hallo Leute\n")
- sink = core.Data()
+ source = gpg.Data("Hallo Leute\n")
+ sink = gpg.Data()
- c.op_encrypt_sign(recipients, constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+ c.op_encrypt_sign(recipients, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
result = c.op_encrypt_result()
assert not result.invalid_recipients, \
"Invalid recipient encountered: {}".format(
result.invalid_recipients.fpr)
result = c.op_sign_result()
- check_result(result, constants.SIG_MODE_NORMAL)
+ check_result(result, gpg.constants.sig.mode.NORMAL)
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
message = "Hallo Leute\n".encode()
ciphertext, _, sig_result = c.encrypt(message,
recipients=keys,
always_trust=True)
assert len(ciphertext) > 0
assert ciphertext.find(b'BEGIN PGP MESSAGE') > 0, 'Marker not found'
- check_result(sig_result, constants.SIG_MODE_NORMAL)
+ check_result(sig_result, gpg.constants.sig.mode.NORMAL)
c.signers = [c.get_key(support.sign_only, True)]
c.encrypt(message, recipients=keys, always_trust=True)
c.signers = [c.get_key(support.encrypt_only, True)]
try:
c.encrypt(message, recipients=keys, always_trust=True)
- except pyme.errors.InvalidSigners as e:
+ except gpg.errors.InvalidSigners as e:
assert len(e.signers) == 1
assert support.encrypt_only.endswith(e.signers[0].fpr)
else:
del absolute_import, print_function, unicode_literals
import os
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
for passphrase in ("abc", b"abc"):
- c = core.Context()
+ c = gpg.Context()
c.set_armor(True)
- c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+ c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
- source = core.Data("Hallo Leute\n")
- cipher = core.Data()
+ source = gpg.Data("Hallo Leute\n")
+ cipher = gpg.Data()
passphrase_cb_called = 0
def passphrase_cb(hint, desc, prev_bad, hook=None):
"Callback called {} times".format(passphrase_cb_called)
support.print_data(cipher)
- c = core.Context()
+ c = gpg.Context()
c.set_armor(True)
- c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+ c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
c.set_passphrase_cb(passphrase_cb, None)
- plain = core.Data()
+ plain = gpg.Data()
cipher.seek(0, os.SEEK_SET)
c.op_decrypt(cipher, plain)
# Idiomatic interface.
for passphrase in ("abc", b"abc"):
- with pyme.Context(armor=True) as c:
+ with gpg.Context(armor=True) as c:
# Check that the passphrase callback is not altered.
def f(*args):
assert False
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
keys = []
keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False))
keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False))
-c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
result = c.op_encrypt_result()
assert not result.invalid_recipients, \
"Invalid recipients: {}".format(", ".join(r.fpr for r in result.recipients))
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
ciphertext, _, _ = c.encrypt("Hallo Leute\n".encode(),
recipients=keys,
sign=False,
c.encrypt("Hallo Leute\n".encode(),
recipients=[c.get_key(support.sign_only, False)],
sign=False, always_trust=True)
- except pyme.errors.InvalidRecipients as e:
+ except gpg.errors.InvalidRecipients as e:
assert len(e.recipients) == 1
assert support.sign_only.endswith(e.recipients[0].fpr)
else:
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
-sink = core.Data()
+sink = gpg.Data()
c.op_export_ext(['Alpha', 'Bob'], 0, sink)
support.print_data(sink)
keys = []
keys.append(c.get_key("0x68697734", False)) # Alpha
keys.append(c.get_key("0xA9E3B0B2", False)) # Bob
-sink = core.Data()
+sink = gpg.Data()
c.op_export_keys(keys, 0, sink)
support.print_data(sink)
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+import gpg
import support
testname = "abcde12345"
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
-source = core.Data("Hallo Leute\n")
+source = gpg.Data("Hallo Leute\n")
source.set_file_name(testname)
-cipher = core.Data()
-plain = core.Data()
+cipher = gpg.Data()
+plain = gpg.Data()
keys = []
keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False))
-c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, cipher)
+c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, cipher)
cipher.seek(0, os.SEEK_SET)
c.op_decrypt(cipher, plain)
result = c.op_decrypt_result()
import io
import os
import tempfile
-import pyme
+import gpg
import support
-support.init_gpgme(pyme.constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
# Both Context and Data can be used as context manager:
-with pyme.Context() as c, pyme.Data() as d:
+with gpg.Context() as c, gpg.Data() as d:
c.get_engine_info()
d.write(b"Halloechen")
leak_c = c
assert leak_d.wrapped == None
def sign_and_verify(source, signed, sink):
- with pyme.Context() as c:
- c.op_sign(source, signed, pyme.constants.SIG_MODE_NORMAL)
+ with gpg.Context() as c:
+ c.op_sign(source, signed, gpg.constants.sig.mode.NORMAL)
signed.seek(0, os.SEEK_SET)
c.op_verify(signed, None, sink)
result = c.op_verify_result()
assert len(result.signatures) == 1, "Unexpected number of signatures"
sig = result.signatures[0]
- assert sig.summary == (pyme.constants.SIGSUM_VALID |
- pyme.constants.SIGSUM_GREEN)
- assert pyme.errors.GPGMEError(sig.status).getcode() == pyme.errors.NO_ERROR
+ assert sig.summary == (gpg.constants.sigsum.VALID |
+ gpg.constants.sigsum.GREEN)
+ assert gpg.errors.GPGMEError(sig.status).getcode() == gpg.errors.NO_ERROR
sink.seek(0, os.SEEK_SET)
assert sink.read() == b"Hallo Leute\n"
# Demonstrate automatic wrapping of objects implementing the buffer
# interface, and the use of data objects with the 'with' statement.
- with io.BytesIO(preallocate) as signed, pyme.Data() as sink:
+ with io.BytesIO(preallocate) as signed, gpg.Data() as sink:
sign_and_verify(b"Hallo Leute\n", signed, sink)
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+import gpg
import support
def check_result(result, fpr, secret):
assert len(result.imports) == 1 or fpr == result.imports[1].fpr
assert result.imports[0].result == 0
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
-c.op_import(core.Data(file=support.make_filename("pubkey-1.asc")))
+c.op_import(gpg.Data(file=support.make_filename("pubkey-1.asc")))
result = c.op_import_result()
check_result(result, "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", False)
-c.op_import(core.Data(file=support.make_filename("seckey-1.asc")))
+c.op_import(gpg.Data(file=support.make_filename("seckey-1.asc")))
result = c.op_import_result()
check_result(result, "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", True)
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
# Check expration of keys. This test assumes three subkeys of which
# 2 are expired; it is used with the "Whisky" test key. It has
assert key.can_sign, "Key unexpectedly unusable for signing"
assert key.can_certify, "Key unexpectedly unusable for certifications"
assert not key.secret, "Key unexpectedly secret"
- assert not key.protocol != constants.PROTOCOL_OpenPGP, \
+ assert not key.protocol != gpg.constants.protocol.OpenPGP, \
"Key has unexpected protocol: {}".format(key.protocol)
assert not key.issuer_serial, \
"Key unexpectedly carries issuer serial: {}".format(key.issuer_serial)
# Only key Alfa is trusted
assert key.uids[0].name == 'Alfa Test' \
- or key.owner_trust == constants.VALIDITY_UNKNOWN, \
+ or key.owner_trust == gpg.constants.validity.UNKNOWN, \
"Key has unexpected owner trust: {}".format(key.owner_trust)
assert key.uids[0].name != 'Alfa Test' \
- or key.owner_trust == constants.VALIDITY_ULTIMATE, \
+ or key.owner_trust == gpg.constants.validity.ULTIMATE, \
"Key has unexpected owner trust: {}".format(key.owner_trust)
assert len(key.subkeys) - 1 == n_subkeys, \
assert not subkey.secret, which + " key unexpectedly secret"
assert not subkey.is_cardkey, "Public key marked as card key"
assert not subkey.card_number, "Public key with card number set"
- assert not subkey.pubkey_algo != (constants.PK_DSA if which == "Primary"
- else constants.PK_ELG_E), \
+ assert not subkey.pubkey_algo != (gpg.constants.pk.DSA if which == "Primary"
+ else gpg.constants.pk.ELG_E), \
which + " key has unexpected public key algo: {}".\
format(subkey.pubkey_algo)
assert subkey.length == 1024, \
def check_uid(which, ref, uid):
assert not uid.revoked, which + " user ID unexpectedly revoked"
assert not uid.invalid, which + " user ID unexpectedly invalid"
- assert uid.validity == (constants.VALIDITY_UNKNOWN
+ assert uid.validity == (gpg.constants.validity.UNKNOWN
if uid.name.split()[0]
not in {'Alfa', 'Alpha', 'Alice'} else
- constants.VALIDITY_ULTIMATE), \
+ gpg.constants.validity.ULTIMATE), \
which + " user ID has unexpectedly validity: {}".format(uid.validity)
assert not uid.signatures, which + " user ID unexpectedly signed"
assert uid.name == ref[0], \
# check get_key()
-with pyme.Context() as c:
+with gpg.Context() as c:
c.get_key(support.alpha)
c.get_key(support.alpha, secret=True)
# Legacy error
try:
c.get_key(support.no_such_key)
- except pyme.errors.GPGMEError:
+ except gpg.errors.GPGMEError:
pass
else:
assert False, "Expected GPGMEError"
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
-with pyme.Context(protocol=pyme.constants.PROTOCOL_ASSUAN) as c:
+with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c:
# Do nothing.
c.assuan_transact('nop')
c.assuan_transact('NOP')
c.assuan_transact(['NOP'])
err = c.assuan_transact('idontexist')
- assert err.getsource() == pyme.errors.SOURCE_GPGAGENT
- assert err.getcode() == pyme.errors.ASS_UNKNOWN_CMD
+ assert err.getsource() == gpg.errors.SOURCE_GPGAGENT
+ assert err.getcode() == gpg.errors.ASS_UNKNOWN_CMD
# Invoke the pinentry to get a confirmation.
c.assuan_transact(['GET_CONFIRMATION', 'Hello there'])
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+import gpg
import support
expected_notations = {
- "laughing@me": ("Just Squeeze Me", constants.SIG_NOTATION_HUMAN_READABLE),
+ "laughing@me": ("Just Squeeze Me", gpg.constants.sig.notation.HUMAN_READABLE),
"preferred-email-encoding@pgp.com": ("pgpmime",
- constants.SIG_NOTATION_HUMAN_READABLE
- | constants.SIG_NOTATION_CRITICAL),
+ gpg.constants.sig.notation.HUMAN_READABLE
+ | gpg.constants.sig.notation.CRITICAL),
None: ("http://www.gnu.org/policy/", 0),
}
# GnuPG prior to 2.1.13 did not report the critical flag correctly.
-with core.Context() as c:
+with gpg.Context() as c:
version = c.engine_info.version
have_correct_sig_data = not (version.startswith("1.")
or version.startswith("2.0.")
assert r.value == value, \
"Expected {!r}, got {!r}".format(value, r.value)
assert r.human_readable \
- == bool(flags&constants.SIG_NOTATION_HUMAN_READABLE)
+ == bool(flags & gpg.constants.sig.notation.HUMAN_READABLE)
assert r.critical \
- == (bool(flags&constants.SIG_NOTATION_CRITICAL)
+ == (bool(flags & gpg.constants.sig.notation.CRITICAL)
if have_correct_sig_data else False)
assert len(expected_notations) == 0
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
-source = core.Data("Hallo Leute\n")
-signed = core.Data()
+source = gpg.Data("Hallo Leute\n")
+signed = gpg.Data()
-c = core.Context()
+c = gpg.Context()
for name, (value, flags) in expected_notations.items():
c.sig_notation_add(name, value, flags)
-c.op_sign(source, signed, constants.SIG_MODE_NORMAL)
+c.op_sign(source, signed, gpg.constants.sig.mode.NORMAL)
signed.seek(0, os.SEEK_SET)
-sink = core.Data()
+sink = gpg.Data()
c.op_verify(signed, None, sink)
result = c.op_verify_result()
check_result(result)
del absolute_import, print_function, unicode_literals
import os
-import pyme
-from pyme import core, constants
+import gpg
import support
def fail(msg):
if signature.type != typ:
fail("Wrong type of signature created")
- if signature.pubkey_algo != constants.PK_DSA:
+ if signature.pubkey_algo != gpg.constants.pk.DSA:
fail("Wrong pubkey algorithm reported: {}".format(
signature.pubkey_algo))
- if signature.hash_algo != constants.MD_SHA1:
+ if signature.hash_algo != gpg.constants.md.SHA1:
fail("Wrong hash algorithm reported: {}".format(
signature.hash_algo))
fail("Wrong fingerprint reported: {}".format(signature.fpr))
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_textmode(True)
c.set_armor(True)
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
-c.op_sign(source, sink, constants.SIG_MODE_NORMAL)
+c.op_sign(source, sink, gpg.constants.sig.mode.NORMAL)
result = c.op_sign_result()
-check_result(result, constants.SIG_MODE_NORMAL)
+check_result(result, gpg.constants.sig.mode.NORMAL)
support.print_data(sink)
# Now a detached signature.
source.seek(0, os.SEEK_SET)
-sink = core.Data()
+sink = gpg.Data()
-c.op_sign(source, sink, constants.SIG_MODE_DETACH)
+c.op_sign(source, sink, gpg.constants.sig.mode.DETACH)
result = c.op_sign_result()
-check_result(result, constants.SIG_MODE_DETACH)
+check_result(result, gpg.constants.sig.mode.DETACH)
support.print_data(sink)
# And finally a cleartext signature. */
source.seek(0, os.SEEK_SET)
-sink = core.Data()
+sink = gpg.Data()
-c.op_sign(source, sink, constants.SIG_MODE_CLEAR)
+c.op_sign(source, sink, gpg.constants.sig.mode.CLEAR)
result = c.op_sign_result()
-check_result(result, constants.SIG_MODE_CLEAR)
+check_result(result, gpg.constants.sig.mode.CLEAR)
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True, textmode=True) as c:
+with gpg.Context(armor=True, textmode=True) as c:
message = "Hallo Leute\n".encode()
signed, _ = c.sign(message)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP MESSAGE') > 0, 'Message not found'
- signed, _ = c.sign(message, mode=pyme.constants.SIG_MODE_DETACH)
+ signed, _ = c.sign(message, mode=gpg.constants.sig.mode.DETACH)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
- signed, _ = c.sign(message, mode=pyme.constants.SIG_MODE_CLEAR)
+ signed, _ = c.sign(message, mode=gpg.constants.sig.mode.CLEAR)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP SIGNED MESSAGE') > 0, 'Message not found'
assert signed.find(message) > 0, 'Message content not found'
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
-with pyme.Context() as c:
+with gpg.Context() as c:
message = "Hallo Leute\n".encode()
c.signers = [c.get_key(support.sign_only, True)]
c.signers = [c.get_key(support.encrypt_only, True)]
try:
c.sign(message)
- except pyme.errors.InvalidSigners as e:
+ except gpg.errors.InvalidSigners as e:
assert len(e.signers) == 1
assert support.encrypt_only.endswith(e.signers[0].fpr)
else:
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants
+import gpg
import support
def fail(msg):
if signature.type != typ:
fail("Wrong type of signature created")
- if signature.pubkey_algo != constants.PK_DSA:
+ if signature.pubkey_algo != gpg.constants.pk.DSA:
fail("Wrong pubkey algorithm reported: {}".format(
signature.pubkey_algo))
- if signature.hash_algo != constants.MD_SHA1:
+ if signature.hash_algo != gpg.constants.md.SHA1:
fail("Wrong hash algorithm reported: {}".format(
signature.hash_algo))
fail("Wrong fingerprint reported: {}".format(signature.fpr))
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_textmode(True)
c.set_armor(True)
c.signers_add(keys[0])
c.signers_add(keys[1])
-for mode in (constants.SIG_MODE_NORMAL, constants.SIG_MODE_DETACH,
- constants.SIG_MODE_CLEAR):
- source = core.Data("Hallo Leute\n")
- sink = core.Data()
+for mode in (gpg.constants.sig.mode.NORMAL, gpg.constants.sig.mode.DETACH,
+ gpg.constants.sig.mode.CLEAR):
+ source = gpg.Data("Hallo Leute\n")
+ sink = gpg.Data()
c.op_sign(source, sink, mode)
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True, textmode=True, signers=keys) as c:
+with gpg.Context(armor=True, textmode=True, signers=keys) as c:
message = "Hallo Leute\n".encode()
signed, result = c.sign(message)
- check_result(result, constants.SIG_MODE_NORMAL)
+ check_result(result, gpg.constants.sig.mode.NORMAL)
assert signed.find(b'BEGIN PGP MESSAGE') > 0, 'Message not found'
- signed, result = c.sign(message, mode=constants.SIG_MODE_DETACH)
- check_result(result, constants.SIG_MODE_DETACH)
+ signed, result = c.sign(message, mode=gpg.constants.sig.mode.DETACH)
+ check_result(result, gpg.constants.sig.mode.DETACH)
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
- signed, result = c.sign(message, mode=constants.SIG_MODE_CLEAR)
- check_result(result, constants.SIG_MODE_CLEAR)
+ signed, result = c.sign(message, mode=gpg.constants.sig.mode.CLEAR)
+ check_result(result, gpg.constants.sig.mode.CLEAR)
assert signed.find(b'BEGIN PGP SIGNED MESSAGE') > 0, 'Message not found'
assert signed.find(message) > 0, 'Message content not found'
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
def dump_item(item):
print("l={} k={} t={} o={} v={} u={}".format(
import sys
import os
-import pyme
-from pyme import core, constants, errors
+import gpg
import support
test_text1 = b"Just GNU it!\n"
"Unexpected signature summary: {}, want: {}".format(sig.summary,
summary)
assert sig.fpr == fpr
- assert errors.GPGMEError(sig.status).getcode() == status
+ assert gpg.errors.GPGMEError(sig.status).getcode() == status
if notation:
expected_notations = {
assert sig.validity == validity, \
"Unexpected signature validity: {}, want: {}".format(
sig.validity, validity)
- assert errors.GPGMEError(sig.validity_reason).getcode() == errors.NO_ERROR
+ assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
# Checking a valid message.
-text = core.Data(test_text1)
-sig = core.Data(test_sig1)
+text = gpg.Data(test_text1)
+sig = gpg.Data(test_sig1)
c.op_verify(sig, text, None)
result = c.op_verify_result()
-check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
- constants.VALIDITY_FULL,
+check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
+ gpg.constants.validity.FULL,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR, True)
+ gpg.errors.NO_ERROR, True)
# Checking a manipulated message.
-text = core.Data(test_text1f)
+text = gpg.Data(test_text1f)
sig.seek(0, os.SEEK_SET)
c.op_verify(sig, text, None)
result = c.op_verify_result()
-check_result(result, constants.SIGSUM_RED, constants.VALIDITY_UNKNOWN,
- "2D727CC768697734", errors.BAD_SIGNATURE, False)
+check_result(result, gpg.constants.sigsum.RED, gpg.constants.validity.UNKNOWN,
+ "2D727CC768697734", gpg.errors.BAD_SIGNATURE, False)
# Checking a normal signature.
-text = core.Data()
-sig = core.Data(test_sig2)
+text = gpg.Data()
+sig = gpg.Data(test_sig2)
c.op_verify(sig, None, text)
result = c.op_verify_result()
-check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
- constants.VALIDITY_FULL,
+check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
+ gpg.constants.validity.FULL,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR, False)
+ gpg.errors.NO_ERROR, False)
# Checking an invalid message.
-text = core.Data()
-sig = core.Data(double_plaintext_sig)
+text = gpg.Data()
+sig = gpg.Data(double_plaintext_sig)
try:
c.op_verify(sig, None, text)
except Exception as e:
- assert type(e) == errors.GPGMEError
- assert e.getcode() == errors.BAD_DATA
+ assert type(e) == gpg.errors.GPGMEError
+ assert e.getcode() == gpg.errors.BAD_DATA
else:
assert False, "Expected an error but got none."
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
# Checking a valid message.
_, result = c.verify(test_text1, test_sig1)
- check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
- constants.VALIDITY_FULL,
+ check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
+ gpg.constants.validity.FULL,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR, True)
+ gpg.errors.NO_ERROR, True)
# Checking a manipulated message.
try:
c.verify(test_text1f, test_sig1)
- except errors.BadSignatures as e:
- check_result(e.result, constants.SIGSUM_RED,
- constants.VALIDITY_UNKNOWN,
- "2D727CC768697734", errors.BAD_SIGNATURE, False)
+ except gpg.errors.BadSignatures as e:
+ check_result(e.result, gpg.constants.sigsum.RED,
+ gpg.constants.validity.UNKNOWN,
+ "2D727CC768697734", gpg.errors.BAD_SIGNATURE, False)
else:
assert False, "Expected an error but got none."
# Checking a normal signature.
- sig = core.Data(test_sig2)
+ sig = gpg.Data(test_sig2)
data, result = c.verify(test_sig2)
- check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
- constants.VALIDITY_FULL,
+ check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
+ gpg.constants.validity.FULL,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR, False)
+ gpg.errors.NO_ERROR, False)
assert data == test_text1
# Checking an invalid message.
try:
c.verify(double_plaintext_sig)
- except errors.GPGMEError as e:
- assert e.getcode() == errors.BAD_DATA
+ except gpg.errors.GPGMEError as e:
+ assert e.getcode() == gpg.errors.BAD_DATA
else:
assert False, "Expected an error but got none."
try:
c.verify(test_text1, test_sig1, verify=[alpha, bob])
- except errors.MissingSignatures as e:
+ except gpg.errors.MissingSignatures as e:
assert len(e.missing) == 1
assert e.missing[0] == bob
else:
del absolute_import, print_function, unicode_literals
import time
-from pyme import core, constants, errors
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
# Checking a message without a signature.
-sig = core.Data("foo\n")
-text = core.Data()
+sig = gpg.Data("foo\n")
+text = gpg.Data()
c.op_verify_start(sig, None, text)
try:
break
time.sleep(0.1)
except Exception as e:
- assert e.getcode() == errors.NO_DATA
+ assert e.getcode() == gpg.errors.NO_DATA
else:
assert False, "Expected an error, got none"
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <http://www.gnu.org/licenses/>.
-from pyme import core
+import gpg
-d0 = core.Data()
+d0 = gpg.Data()
d0.seek # trigger on-demand-wrapping
assert d0.seek == d0.seek, "Generated wrapper functions are not cached"
-assert hasattr(core.Data, 'seek'), "Generated wrapper functions are not shared"
+assert hasattr(gpg.Data, 'seek'), "Generated wrapper functions are not shared"
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
--- /dev/null
+#include "qgpgme/dn.h"
# 02111-1307, USA
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
- gpgme_backend_debug.h qgpgme_version.h.in
+ gpgme_backend_debug.h qgpgme_version.h.in \
+ QGpgmeConfig.cmake.in.in
qgpgme_sources = \
dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
qgpgmeverifyopaquejob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \
qgpgmetofupolicyjob.cpp \
- defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp
+ defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
+ dn.cpp
# If you add one here make sure that you also add one in camelcase
qgpgme_headers= \
verifydetachedjob.h \
defaultkeygenerationjob.h \
tofupolicyjob.h \
- wkspublishjob.h
+ wkspublishjob.h \
+ dn.h
camelcase_headers= \
AddUserIDJob \
DataProvider \
DecryptJob \
DecryptVerifyJob \
+ DN \
DownloadJob \
EncryptJob \
ExportJob \
qgpgmeinclude_HEADERS = $(qgpgme_headers)
camelcaseincludedir = $(includedir)/QGpgME
camelcaseinclude_HEADERS = $(camelcase_headers)
-nodist_include_HEADERS = qgpgme_version.h
+nodist_qgpgmeinclude_HEADERS = qgpgme_version.h
libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
@LIBASSUAN_LIBS@ @GPGME_QT_LIBS@
-libqgpgme_la_LDFLAGS = -version-info \
+libqgpgme_la_LDFLAGS = -no-undefined -version-info \
@LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
if HAVE_W32_SYSTEM
-libsuffix=.dll.a
+QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in
+ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
else
-libsuffix=.so
-endif
-
QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+endif
$(camelcase_headers): Makefile.am
echo -n "#include \"qgpgme/" > "$@"
echo ".h\"" >> "$@"
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
- -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
+ -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme
$(INSTALL) -m 644 QGpgmeConfig.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
+ $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
$(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
+ $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
uninstall-cmake-files:
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/Gpgmepp/
+ -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
+ -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
+ -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/
install-data-local: install-cmake-files
BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers)
-CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake
+CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \
+ qgpgme_version.h QGpgmeConfig.cmake.in \
+ QGpgmeConfigVersion.cmake
nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources)
subdir = lang/qt/src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
+ $(srcdir)/QGpgmeConfig-w32.cmake.in.in \
$(srcdir)/QGpgmeConfig.cmake.in.in \
$(srcdir)/QGpgmeConfigVersion.cmake.in \
$(srcdir)/qgpgme_version.h.in $(top_srcdir)/build-aux/depcomp \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = QGpgmeConfig.cmake.in QGpgmeConfigVersion.cmake \
- qgpgme_version.h
+CONFIG_CLEAN_FILES = QGpgmeConfig-w32.cmake.in QGpgmeConfig.cmake.in \
+ QGpgmeConfigVersion.cmake qgpgme_version.h
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)" \
- "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(includedir)" \
+ "$(DESTDIR)$(camelcaseincludedir)" \
+ "$(DESTDIR)$(qgpgmeincludedir)" \
"$(DESTDIR)$(qgpgmeincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libqgpgme_la_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
qgpgmeverifydetachedjob.lo qgpgmeverifyopaquejob.lo \
threadedjobmixin.lo qgpgmekeyformailboxjob.lo \
gpgme_backend_debug.lo qgpgmetofupolicyjob.lo \
- defaultkeygenerationjob.lo qgpgmewkspublishjob.lo
+ defaultkeygenerationjob.lo qgpgmewkspublishjob.lo dn.lo
am__objects_2 =
am_libqgpgme_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_2)
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-HEADERS = $(camelcaseinclude_HEADERS) $(nodist_include_HEADERS) \
+HEADERS = $(camelcaseinclude_HEADERS) $(nodist_qgpgmeinclude_HEADERS) \
$(qgpgmeinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
# 02111-1307, USA
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
- gpgme_backend_debug.h qgpgme_version.h.in
+ gpgme_backend_debug.h qgpgme_version.h.in \
+ QGpgmeConfig.cmake.in.in
qgpgme_sources = \
dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
qgpgmeverifyopaquejob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \
qgpgmetofupolicyjob.cpp \
- defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp
+ defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
+ dn.cpp
# If you add one here make sure that you also add one in camelcase
verifydetachedjob.h \
defaultkeygenerationjob.h \
tofupolicyjob.h \
- wkspublishjob.h
+ wkspublishjob.h \
+ dn.h
camelcase_headers = \
AddUserIDJob \
DataProvider \
DecryptJob \
DecryptVerifyJob \
+ DN \
DownloadJob \
EncryptJob \
ExportJob \
qgpgmeinclude_HEADERS = $(qgpgme_headers)
camelcaseincludedir = $(includedir)/QGpgME
camelcaseinclude_HEADERS = $(camelcase_headers)
-nodist_include_HEADERS = qgpgme_version.h
+nodist_qgpgmeinclude_HEADERS = qgpgme_version.h
libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
@GPGME_QT_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
@LIBASSUAN_LIBS@ @GPGME_QT_LIBS@
-libqgpgme_la_LDFLAGS = -version-info \
+libqgpgme_la_LDFLAGS = -no-undefined -version-info \
@LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
-@HAVE_W32_SYSTEM_FALSE@libsuffix = .so
-@HAVE_W32_SYSTEM_TRUE@libsuffix = .dll.a
BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers)
-CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake
+CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \
+ qgpgme_version.h QGpgmeConfig.cmake.in \
+ QGpgmeConfigVersion.cmake
+
nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources)
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+QGpgmeConfig-w32.cmake.in: $(top_builddir)/config.status $(srcdir)/QGpgmeConfig-w32.cmake.in.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
QGpgmeConfig.cmake.in: $(top_builddir)/config.status $(srcdir)/QGpgmeConfig.cmake.in.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
QGpgmeConfigVersion.cmake: $(top_builddir)/config.status $(srcdir)/QGpgmeConfigVersion.cmake.in
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dataprovider.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultkeygenerationjob.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dn.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgme_backend_debug.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multideletejob.Plo@am__quote@
@list='$(camelcaseinclude_HEADERS)'; test -n "$(camelcaseincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(camelcaseincludedir)'; $(am__uninstall_files_from_dir)
-install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+install-nodist_qgpgmeincludeHEADERS: $(nodist_qgpgmeinclude_HEADERS)
@$(NORMAL_INSTALL)
- @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ @list='$(nodist_qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \
if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(qgpgmeincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(qgpgmeincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
- $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(qgpgmeincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(qgpgmeincludedir)" || exit $$?; \
done
-uninstall-nodist_includeHEADERS:
+uninstall-nodist_qgpgmeincludeHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ @list='$(nodist_qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+ dir='$(DESTDIR)$(qgpgmeincludedir)'; $(am__uninstall_files_from_dir)
install-qgpgmeincludeHEADERS: $(qgpgmeinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(qgpgmeincludedir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(qgpgmeincludedir)" "$(DESTDIR)$(qgpgmeincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
info-am:
install-data-am: install-camelcaseincludeHEADERS install-data-local \
- install-nodist_includeHEADERS install-qgpgmeincludeHEADERS
+ install-nodist_qgpgmeincludeHEADERS \
+ install-qgpgmeincludeHEADERS
install-dvi: install-dvi-am
uninstall-am: uninstall-camelcaseincludeHEADERS \
uninstall-libLTLIBRARIES uninstall-local \
- uninstall-nodist_includeHEADERS uninstall-qgpgmeincludeHEADERS
+ uninstall-nodist_qgpgmeincludeHEADERS \
+ uninstall-qgpgmeincludeHEADERS
.MAKE: all check install install-am install-strip
install-data-local install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libLTLIBRARIES install-man \
- install-nodist_includeHEADERS install-pdf install-pdf-am \
+ install-nodist_qgpgmeincludeHEADERS install-pdf install-pdf-am \
install-ps install-ps-am install-qgpgmeincludeHEADERS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-camelcaseincludeHEADERS uninstall-libLTLIBRARIES \
- uninstall-local uninstall-nodist_includeHEADERS \
+ uninstall-local uninstall-nodist_qgpgmeincludeHEADERS \
uninstall-qgpgmeincludeHEADERS
-QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+@HAVE_W32_SYSTEM_TRUE@QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+@HAVE_W32_SYSTEM_FALSE@QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
+@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
$(camelcase_headers): Makefile.am
echo -n "#include \"qgpgme/" > "$@"
echo ".h\"" >> "$@"
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
- -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
+ -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme
$(INSTALL) -m 644 QGpgmeConfig.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
+ $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
$(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
+ $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
uninstall-cmake-files:
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/Gpgmepp/
+ -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
+ -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
+ -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/
install-data-local: install-cmake-files
--- /dev/null
+# CMake Config file for QGPGME.
+# Copyright (C) 2016 Intevation GmbH
+#
+# This file is part of GPGME.
+#
+# GPGME-CL is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# GPGME-CL is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA
+
+# based on a generated file from cmake.
+# Generated by CMake 3.0.2
+
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
+ message(FATAL_ERROR "CMake >= 2.6.0 required")
+endif()
+cmake_policy(PUSH)
+cmake_policy(VERSION 2.6)
+#----------------------------------------------------------------
+# Generated CMake target import file.
+#----------------------------------------------------------------
+
+# Commands may need to know the format version.
+set(CMAKE_IMPORT_FILE_VERSION 1)
+
+# Protect against multiple inclusion, which would fail when already imported targets are added once more.
+set(_targetsDefined)
+set(_targetsNotDefined)
+set(_expectedTargets)
+foreach(_expectedTarget QGpgme)
+ list(APPEND _expectedTargets ${_expectedTarget})
+ if(NOT TARGET ${_expectedTarget})
+ list(APPEND _targetsNotDefined ${_expectedTarget})
+ endif()
+ if(TARGET ${_expectedTarget})
+ list(APPEND _targetsDefined ${_expectedTarget})
+ endif()
+endforeach()
+if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
+ set(CMAKE_IMPORT_FILE_VERSION)
+ cmake_policy(POP)
+ return()
+endif()
+if(NOT "${_targetsDefined}" STREQUAL "")
+ message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
+endif()
+unset(_targetsDefined)
+unset(_targetsNotDefined)
+unset(_expectedTargets)
+
+# Create imported target QGpgme
+add_library(QGpgme SHARED IMPORTED)
+
+set_target_properties(QGpgme PROPERTIES
+ IMPORTED_IMPLIB_RELEASE "@resolved_libdir@/libqgpgme.dll.a"
+ INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
+ INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
+ IMPORTED_LOCATION "@resolved_libdir@/libqgpgme-7.dll"
+)
+
+list(APPEND _IMPORT_CHECK_TARGETS QGgpme )
+list(APPEND _IMPORT_CHECK_FILES_FOR_Qgpgme "@resolved_libdir@/libqgpgme.dll.a" "@resolved_bindir@/libqgpgme-7.dll" )
+
+if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
+endif()
+
+# Loop over all imported files and verify that they actually exist
+foreach(target ${_IMPORT_CHECK_TARGETS} )
+ foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
+ if(NOT EXISTS "${file}" )
+ message(FATAL_ERROR "The imported target \"${target}\" references the file
+ \"${file}\"
+but this file does not exist. Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+ \"${CMAKE_CURRENT_LIST_FILE}\"
+but not all the files it references.
+")
+ endif()
+ endforeach()
+ unset(_IMPORT_CHECK_FILES_FOR_${target})
+endforeach()
+unset(_IMPORT_CHECK_TARGETS)
+
+# This file does not depend on other imported targets which have
+# been exported from the same project but in a separate export set.
+
+# Commands beyond this point should not need to know the version.
+set(CMAKE_IMPORT_FILE_VERSION)
+cmake_policy(POP)
+
+# Gpgmepp is a requirement for qgpgme
+find_package(Gpgmepp CONFIG REQUIRED)
set_target_properties(QGpgme PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
- IMPORTED_LOCATION "@resolved_libdir@/libqgpgme@libsuffix@"
+ IMPORTED_LOCATION "@resolved_libdir@/libqgpgme.so"
)
if(CMAKE_VERSION VERSION_LESS 2.8.12)
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
+
+# Gpgmepp is a requirement for qgpgme
+find_package(Gpgmepp CONFIG REQUIRED)
# 02111-1307, USA
# based on a generated file from cmake.
-set(PACKAGE_VERSION "@LIBQGPGME_LT_CURRENT@.@LIBQGPGME_LT_AGE@.@LIBQGPGME_LT_REVISION@.@BUILD_REVISION@")
+set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE FALSE)
d->job = openpgp()->keyGenerationJob();
d->job->installEventFilter(this);
- connect(d->job, &KeyGenerationJob::result,
+ connect(d->job.data(), &KeyGenerationJob::result,
this, &DefaultKeyGenerationJob::result);
- connect(d->job, &KeyGenerationJob::done,
+ connect(d->job.data(), &KeyGenerationJob::done,
this, &DefaultKeyGenerationJob::done);
- connect(d->job, &KeyGenerationJob::done,
+ connect(d->job.data(), &KeyGenerationJob::done,
this, &QObject::deleteLater);
return d->job->start(args);
}
--- /dev/null
+/*
+ dn.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ Copyright (c) 2016 Intevation GmbH
+
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ QGpgME is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include "dn.h"
+
+static const struct {
+ const char *name;
+ const char *oid;
+} oidmap[] = {
+ // keep them ordered by oid:
+ { "SP", "ST" }, // hack to show the Sphinx-required/desired SP for
+ // StateOrProvince, otherwise known as ST or even S
+ { "NameDistinguisher", "0.2.262.1.10.7.20" },
+ { "EMAIL", "1.2.840.113549.1.9.1" },
+ { "SN", "2.5.4.4" },
+ { "SerialNumber", "2.5.4.5" },
+ { "T", "2.5.4.12" },
+ { "D", "2.5.4.13" },
+ { "BC", "2.5.4.15" },
+ { "ADDR", "2.5.4.16" },
+ { "PC", "2.5.4.17" },
+ { "GN", "2.5.4.42" },
+ { "Pseudo", "2.5.4.65" },
+};
+static const unsigned int numOidMaps = sizeof oidmap / sizeof * oidmap;
+
+class QGpgME::DN::Private
+{
+public:
+ Private() : mRefCount(0) {}
+ Private(const Private &other)
+ : attributes(other.attributes),
+ reorderedAttributes(other.reorderedAttributes),
+ order{"CN", "L", "_X_", "OU", "O", "C"},
+ mRefCount(0)
+ {
+ }
+
+ int ref()
+ {
+ return ++mRefCount;
+ }
+
+ int unref()
+ {
+ if (--mRefCount <= 0) {
+ delete this;
+ return 0;
+ } else {
+ return mRefCount;
+ }
+ }
+
+ int refCount() const
+ {
+ return mRefCount;
+ }
+
+ DN::Attribute::List attributes;
+ DN::Attribute::List reorderedAttributes;
+ QStringList order;
+private:
+ int mRefCount;
+};
+
+namespace
+{
+struct DnPair {
+ char *key;
+ char *value;
+};
+}
+
+// copied from CryptPlug and adapted to work on DN::Attribute::List:
+
+#define digitp(p) (*(p) >= '0' && *(p) <= '9')
+#define hexdigitp(a) (digitp (a) \
+ || (*(a) >= 'A' && *(a) <= 'F') \
+ || (*(a) >= 'a' && *(a) <= 'f'))
+#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \
+ *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
+#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1))
+
+static char *
+trim_trailing_spaces(char *string)
+{
+ char *p, *mark;
+
+ for (mark = NULL, p = string; *p; p++) {
+ if (isspace(*p)) {
+ if (!mark) {
+ mark = p;
+ }
+ } else {
+ mark = NULL;
+ }
+ }
+ if (mark) {
+ *mark = '\0';
+ }
+
+ return string;
+}
+
+/* Parse a DN and return an array-ized one. This is not a validating
+ parser and it does not support any old-stylish syntax; gpgme is
+ expected to return only rfc2253 compatible strings. */
+static const unsigned char *
+parse_dn_part(DnPair *array, const unsigned char *string)
+{
+ const unsigned char *s, *s1;
+ size_t n;
+ char *p;
+
+ /* parse attributeType */
+ for (s = string + 1; *s && *s != '='; s++)
+ ;
+ if (!*s) {
+ return NULL; /* error */
+ }
+ n = s - string;
+ if (!n) {
+ return NULL; /* empty key */
+ }
+ p = (char *)malloc(n + 1);
+
+ memcpy(p, string, n);
+ p[n] = 0;
+ trim_trailing_spaces((char *)p);
+ // map OIDs to their names:
+ for (unsigned int i = 0; i < numOidMaps; ++i)
+ if (!strcasecmp((char *)p, oidmap[i].oid)) {
+ free(p);
+ p = strdup(oidmap[i].name);
+ break;
+ }
+ array->key = p;
+ string = s + 1;
+
+ if (*string == '#') {
+ /* hexstring */
+ string++;
+ for (s = string; hexdigitp(s); s++) {
+ s++;
+ }
+ n = s - string;
+ if (!n || (n & 1)) {
+ return NULL; /* empty or odd number of digits */
+ }
+ n /= 2;
+ array->value = p = (char *)malloc(n + 1);
+
+ for (s1 = string; n; s1 += 2, n--) {
+ *p++ = xtoi_2(s1);
+ }
+ *p = 0;
+ } else {
+ /* regular v3 quoted string */
+ for (n = 0, s = string; *s; s++) {
+ if (*s == '\\') {
+ /* pair */
+ s++;
+ if (*s == ',' || *s == '=' || *s == '+'
+ || *s == '<' || *s == '>' || *s == '#' || *s == ';'
+ || *s == '\\' || *s == '\"' || *s == ' ') {
+ n++;
+ } else if (hexdigitp(s) && hexdigitp(s + 1)) {
+ s++;
+ n++;
+ } else {
+ return NULL; /* invalid escape sequence */
+ }
+ } else if (*s == '\"') {
+ return NULL; /* invalid encoding */
+ } else if (*s == ',' || *s == '=' || *s == '+'
+ || *s == '<' || *s == '>' || *s == '#' || *s == ';') {
+ break;
+ } else {
+ n++;
+ }
+ }
+
+ array->value = p = (char *)malloc(n + 1);
+
+ for (s = string; n; s++, n--) {
+ if (*s == '\\') {
+ s++;
+ if (hexdigitp(s)) {
+ *p++ = xtoi_2(s);
+ s++;
+ } else {
+ *p++ = *s;
+ }
+ } else {
+ *p++ = *s;
+ }
+ }
+ *p = 0;
+ }
+ return s;
+}
+
+/* Parse a DN and return an array-ized one. This is not a validating
+ parser and it does not support any old-stylish syntax; gpgme is
+ expected to return only rfc2253 compatible strings. */
+static QGpgME::DN::Attribute::List
+parse_dn(const unsigned char *string)
+{
+ if (!string) {
+ return QVector<QGpgME::DN::Attribute>();
+ }
+
+ QVector<QGpgME::DN::Attribute> result;
+ while (*string) {
+ while (*string == ' ') {
+ string++;
+ }
+ if (!*string) {
+ break; /* ready */
+ }
+
+ DnPair pair = { 0, 0 };
+ string = parse_dn_part(&pair, string);
+ if (!string) {
+ goto failure;
+ }
+ if (pair.key && pair.value)
+ result.push_back(QGpgME::DN::Attribute(QString::fromUtf8(pair.key),
+ QString::fromUtf8(pair.value)));
+ free(pair.key);
+ free(pair.value);
+
+ while (*string == ' ') {
+ string++;
+ }
+ if (*string && *string != ',' && *string != ';' && *string != '+') {
+ goto failure; /* invalid delimiter */
+ }
+ if (*string) {
+ string++;
+ }
+ }
+ return result;
+
+failure:
+ return QVector<QGpgME::DN::Attribute>();
+}
+
+static QVector<QGpgME::DN::Attribute>
+parse_dn(const QString &dn)
+{
+ return parse_dn((const unsigned char *)dn.toUtf8().data());
+}
+
+static QString dn_escape(const QString &s)
+{
+ QString result;
+ for (unsigned int i = 0, end = s.length(); i != end; ++i) {
+ const QChar ch = s[i];
+ switch (ch.unicode()) {
+ case ',':
+ case '+':
+ case '"':
+ case '\\':
+ case '<':
+ case '>':
+ case ';':
+ result += QLatin1Char('\\');
+ // fall through
+ default:
+ result += ch;
+ }
+ }
+ return result;
+}
+
+static QString
+serialise(const QVector<QGpgME::DN::Attribute> &dn, const QString &sep)
+{
+ QStringList result;
+ for (QVector<QGpgME::DN::Attribute>::const_iterator it = dn.begin(); it != dn.end(); ++it)
+ if (!(*it).name().isEmpty() && !(*it).value().isEmpty()) {
+ result.push_back((*it).name().trimmed() + QLatin1Char('=') + dn_escape((*it).value().trimmed()));
+ }
+ return result.join(sep);
+}
+
+static QGpgME::DN::Attribute::List
+reorder_dn(const QGpgME::DN::Attribute::List &dn, const QStringList &attrOrder)
+{
+ QGpgME::DN::Attribute::List unknownEntries;
+ QGpgME::DN::Attribute::List result;
+ unknownEntries.reserve(dn.size());
+ result.reserve(dn.size());
+
+ // find all unknown entries in their order of appearance
+ for (QGpgME::DN::const_iterator it = dn.begin(); it != dn.end(); ++it)
+ if (!attrOrder.contains((*it).name())) {
+ unknownEntries.push_back(*it);
+ }
+
+ // process the known attrs in the desired order
+ for (QStringList::const_iterator oit = attrOrder.begin(); oit != attrOrder.end(); ++oit)
+ if (*oit == QLatin1String("_X_")) {
+ // insert the unknown attrs
+ std::copy(unknownEntries.begin(), unknownEntries.end(),
+ std::back_inserter(result));
+ unknownEntries.clear(); // don't produce dup's
+ } else {
+ for (QGpgME::DN::const_iterator dnit = dn.begin(); dnit != dn.end(); ++dnit)
+ if ((*dnit).name() == *oit) {
+ result.push_back(*dnit);
+ }
+ }
+
+ return result;
+}
+
+//
+//
+// class DN
+//
+//
+
+QGpgME::DN::DN()
+{
+ d = new Private();
+ d->ref();
+}
+
+QGpgME::DN::DN(const QString &dn)
+{
+ d = new Private();
+ d->ref();
+ d->attributes = parse_dn(dn);
+}
+
+QGpgME::DN::DN(const char *utf8DN)
+{
+ d = new Private();
+ d->ref();
+ if (utf8DN) {
+ d->attributes = parse_dn((const unsigned char *)utf8DN);
+ }
+}
+
+QGpgME::DN::DN(const DN &other)
+ : d(other.d)
+{
+ if (d) {
+ d->ref();
+ }
+}
+
+QGpgME::DN::~DN()
+{
+ if (d) {
+ d->unref();
+ }
+}
+
+const QGpgME::DN &QGpgME::DN::operator=(const DN &that)
+{
+ if (this->d == that.d) {
+ return *this;
+ }
+
+ if (that.d) {
+ that.d->ref();
+ }
+ if (this->d) {
+ this->d->unref();
+ }
+
+ this->d = that.d;
+
+ return *this;
+}
+
+QString QGpgME::DN::prettyDN() const
+{
+ if (!d) {
+ return QString();
+ }
+ if (d->reorderedAttributes.empty()) {
+ d->reorderedAttributes = reorder_dn(d->attributes, d->order);
+ }
+ return serialise(d->reorderedAttributes, QStringLiteral(","));
+}
+
+QString QGpgME::DN::dn() const
+{
+ return d ? serialise(d->attributes, QStringLiteral(",")) : QString();
+}
+
+QString QGpgME::DN::dn(const QString &sep) const
+{
+ return d ? serialise(d->attributes, sep) : QString();
+}
+
+// static
+QString QGpgME::DN::escape(const QString &value)
+{
+ return dn_escape(value);
+}
+
+void QGpgME::DN::detach()
+{
+ if (!d) {
+ d = new QGpgME::DN::Private();
+ d->ref();
+ } else if (d->refCount() > 1) {
+ QGpgME::DN::Private *d_save = d;
+ d = new QGpgME::DN::Private(*d);
+ d->ref();
+ d_save->unref();
+ }
+}
+
+void QGpgME::DN::append(const Attribute &attr)
+{
+ detach();
+ d->attributes.push_back(attr);
+ d->reorderedAttributes.clear();
+}
+
+QString QGpgME::DN::operator[](const QString &attr) const
+{
+ if (!d) {
+ return QString();
+ }
+ const QString attrUpper = attr.toUpper();
+ for (QVector<Attribute>::const_iterator it = d->attributes.constBegin();
+ it != d->attributes.constEnd(); ++it)
+ if ((*it).name() == attrUpper) {
+ return (*it).value();
+ }
+ return QString();
+}
+
+static QVector<QGpgME::DN::Attribute> empty;
+
+QGpgME::DN::const_iterator QGpgME::DN::begin() const
+{
+ return d ? d->attributes.constBegin() : empty.constBegin();
+}
+
+QGpgME::DN::const_iterator QGpgME::DN::end() const
+{
+ return d ? d->attributes.constEnd() : empty.constEnd();
+}
+
+void QGpgME::DN::setAttributeOrder (const QStringList &order) const
+{
+ d->order = order;
+}
+
+const QStringList & QGpgME::DN::attributeOrder () const
+{
+ return d->order;
+}
--- /dev/null
+/*
+ dn.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ Copyright (c) 2016 Intevation GmbH
+
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ QGpgME is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+#ifndef QGPGME_DN_H
+#define QGPGME_DN_H
+
+#include "qgpgme_export.h"
+
+#include <QString>
+#include <QStringList>
+
+#include <QVector>
+
+namespace QGpgME
+{
+
+/**
+ @short DN parser and reorderer
+*/
+class QGPGME_EXPORT DN
+{
+public:
+ class Attribute;
+ typedef QVector<Attribute> AttributeList;
+ typedef AttributeList::const_iterator const_iterator;
+
+ DN();
+ explicit DN(const QString &dn);
+ explicit DN(const char *utf8DN);
+ DN(const DN &other);
+ ~DN();
+
+ const DN &operator=(const DN &other);
+
+ /** @return the value in rfc-2253-escaped form */
+ static QString escape(const QString &value);
+
+ /** @return the DN in a reordered form, according to the settings in
+ the [DN] group of the application's config file */
+ QString prettyDN() const;
+ /** @return the DN in the original form */
+ QString dn() const;
+ /**
+ \overload
+ Uses \a sep as separator (default: ,)
+ */
+ QString dn(const QString &sep) const;
+
+ QString operator[](const QString &attr) const;
+
+ void append(const Attribute &attr);
+
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ /** Set the order in which prettyDN will reorder the Attirbutes. */
+ void setAttributeOrder(const QStringList &order) const;
+
+ /** Get the used attribute order. */
+ const QStringList & attributeOrder() const;
+
+private:
+ void detach();
+private:
+ class Private;
+ Private *d;
+};
+
+class QGPGME_EXPORT DN::Attribute
+{
+public:
+ typedef DN::AttributeList List;
+
+ explicit Attribute(const QString &name = QString(), const QString &value = QString())
+ : mName(name.toUpper()), mValue(value) {}
+ Attribute(const Attribute &other)
+ : mName(other.name()), mValue(other.value()) {}
+
+ const Attribute &operator=(const Attribute &other)
+ {
+ if (this != &other) {
+ mName = other.name();
+ mValue = other.value();
+ }
+ return *this;
+ }
+
+ const QString &name() const
+ {
+ return mName;
+ }
+ const QString &value() const
+ {
+ return mValue;
+ }
+
+ void setValue(const QString &value)
+ {
+ mValue = value;
+ }
+
+private:
+ QString mName;
+ QString mValue;
+};
+} // namespace QGpgME
+#endif // QGPGME_DN_H
#include "keyformailboxjob.h"
#include "wkspublishjob.h"
#include "tofupolicyjob.h"
+#include "threadedjobmixin.h"
#include <QCoreApplication>
#include <QDebug>
QGpgME::Job::~Job()
{
-
}
QString QGpgME::Job::auditLogAsHtml() const
return auditLogError().code() != GPG_ERR_NOT_IMPLEMENTED;
}
+QMap <QGpgME::Job *, GpgME::Context *> QGpgME::g_context_map;
+
+/* static */
+GpgME::Context *QGpgME::Job::context(QGpgME::Job *job)
+{
+ return QGpgME::g_context_map.value (job, nullptr);
+}
+
#define make_job_subclass_ext(x,y) \
QGpgME::x::x( QObject * parent ) : y( parent ) {} \
QGpgME::x::~x() {}
#include <QObject>
#include <QString>
+#include <QMap>
#ifdef BUILDING_QGPGME
# include "error.h"
virtual GpgME::Error auditLogError() const;
bool isAuditLogSupported() const;
+ /** Get the underlying context to set some additional options for a job.
+ *
+ * This is intended to provide more flexibility on configuring jobs before
+ * they are started.
+ * The context is still owned by the thread, do not delete it.
+ *
+ * This is a static method that takes the job as argument.
+ *
+ * This function may not be called for running jobs.
+ *
+ * @returns the context used by the job job or null.
+ */
+ static GpgME::Context *context(Job *job);
+
public Q_SLOTS:
virtual void slotCancel() = 0;
void done();
};
+extern QMap <Job *, GpgME::Context *> g_context_map;
}
#endif // __KLEO_JOB_H__
-/*qgpgme_export.h - Export macros for qgpgme
- Copyright (C) 2016, Intevation GmbH
+/* qgpgme_export.h - Export macros for qgpgme
- This file is part of GPGME++.
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2016 Intevation GmbH
- GPGME++ is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
- GPGME++ is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Library General Public License for more details.
+ QGpgME is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
- You should have received a copy of the GNU Library General Public License
- along with GPGME++; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
*/
#ifndef QGPGME_EXPORT_H
-/*qgpgme_version.h - Version macros for qgpgme
- Copyright (C) 2016, Intevation GmbH
-
- This file is part of GPGME++.
-
- GPGME++ is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- GPGME++ is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with GPGME++; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+/* qgpgme_version.h - Version macros for qgpgme
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2016 Intevation GmbH
+
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ QGpgME is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
*/
#ifndef QGPGME_VERSION_H
#define QGPGME_VERSION_H
-#define QGPGME_VERSION_STRING "@LIBQGPGME_LT_CURRENT@.@LIBQGPGME_LT_AGE@.@LIBQGPGME_LT_REVISION@"
-#define QGPGME_VERSION_MAJOR @LIBQGPGME_LT_CURRENT@
-#define QGPGME_VERSION_MINOR @LIBQGPGME_LT_AGE@
-#define QGPGME_VERSION_PATCH @LIBQGPGME_LT_REVISION@
-#define QGPGME_VERSION ((@LIBQGPGME_LT_CURRENT@<<16)|(@LIBQGPGME_LT_AGE@<<8)|(@LIBQGPGME_LT_REVISION@))
+#define QGPGME_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@"
+#define QGPGME_VERSION_MAJOR @VERSION_MAJOR@
+#define QGPGME_VERSION_MINOR @VERSION_MINOR@
+#define QGPGME_VERSION_PATCH @VERSION_MICRO@
+#define QGPGME_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@))
#endif
# include <gpgme++/interfaces/progressprovider.h>
#endif
+#include "job.h"
#include <cassert>
explicit ThreadedJobMixin(GpgME::Context *ctx)
: T_base(0), m_ctx(ctx), m_thread(), m_auditLog(), m_auditLogError()
{
-
}
void lateInitialization()
{
assert(m_ctx);
- QObject::connect(&m_thread, SIGNAL(finished()), this, SLOT(slotFinished()));
+ QObject::connect(&m_thread, &QThread::finished, this,
+ &mixin_type::slotFinished);
m_ctx->setProgressProvider(this);
+ QGpgME::g_context_map.insert(this, m_ctx.get());
+ }
+
+ ~ThreadedJobMixin()
+ {
+ QGpgME::g_context_map.remove(this);
}
template <typename T_binder>
*
* Remember that after a result is emitted the job is auto deleted
* so you can only use it for a single action.
+ *
+ * The workflow is to call startCreate, check for errors and then
+ * send the RFC822 mail returned in returnedData.
+ *
+ * When the response is received start a startRecieve with the
+ * RFC822 mail received as paramater response. Check for errors
+ * and then send again send the result from returnedData back to
+ * the server.
+ *
*/
class QGPGME_EXPORT WKSPublishJob: public Job
{
virtual void startCheck(const QString &mailbox) = 0;
/** Create a publish request.
- * The returned Data from the result will contain
- * the full Mail as returned by gpg-wks-client --create
+ * The returnedData from the result signal will contain
+ * the full Request as returned by gpg-wks-client --create
*
* @param fpr the fingerprint of the key to create the request for.
* @param mailbox A simple mail address without a Name.
*/
virtual void startCreate(const char *fpr, const QString &mailbox) = 0;
- /** Handle a submisson response. The returned Data will contain
- * the full Mail as returned by gpg-wks-client --create
+ /** Handle a submisson response. The returnedData in the result singnal
+ * will contain the confirmation response as returned by gpg-wks-client --receive
*
* @param response The response of the server.
**/
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
const QByteArray data1(testMsg1);
QByteArray plaintext;
+ auto ctx = Job::context(job);
+ Q_ASSERT(ctx);
+ ctx->setSender("alfa@example.net");
+
auto result = job->exec(data1, plaintext);
delete job;
# Owen Taylor 1997-2001
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
dnl gthread is specified in MODULES, pass to pkg-config
dnl
AC_DEFUN([AM_PATH_GLIB_2_0],
-[dnl
+[dnl
dnl Get the cflags and libraries from pkg-config
dnl
AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
for module in . $4
do
case "$module" in
- gmodule)
+ gmodule)
pkg_config_args="$pkg_config_args gmodule-2.0"
;;
- gmodule-no-export)
+ gmodule-no-export)
pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
;;
- gobject)
+ gobject)
pkg_config_args="$pkg_config_args gobject-2.0"
;;
- gthread)
+ gthread)
pkg_config_args="$pkg_config_args gthread-2.0"
;;
esac
#include <stdio.h>
#include <stdlib.h>
-int
+int
main ()
{
int major, minor, micro;
(glib_minor_version != $glib_config_minor_version) ||
(glib_micro_version != $glib_config_micro_version))
{
- printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
+ printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
glib_major_version, glib_minor_version, glib_micro_version);
printf ("*** was found! If pkg-config was correct, then it is best\n");
printf("*** required on your system.\n");
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
printf("*** to point to the correct configuration files\n");
- }
+ }
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
(glib_minor_version != GLIB_MINOR_VERSION) ||
(glib_micro_version != GLIB_MICRO_VERSION))
fi
if test "x$no_glib" = x ; then
AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
- ifelse([$2], , :, [$2])
+ ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$PKG_CONFIG" = "no" ; then
echo "*** A new enough version of pkg-config was not found."
- echo "*** See http://www.freedesktop.org/software/pkgconfig/"
+ echo "*** See https://www.freedesktop.org/software/pkgconfig/"
else
if test -f conf.glibtest ; then
:
#
# You should have received a copy of the GNU General Public License
# along with GNU Libtool; see the file COPYING. If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# can be downloaded from https://www.gnu.org/licenses/gpl.html, or
# obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-#
+#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
# This program is free software; you can redistribute it and/or modify
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
-
+
fi[]dnl
])# PKG_PROG_PKG_CONFIG
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
- else
+ else
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
fi
# Put the nasty error message in config.log where it belongs
_PKG_TEXT
-To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
+To get pkg-config, see <https://www.freedesktop.org/software/pkgconfig>.])],
[$4])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+# License along with this program; if not, see <https://www.gnu.org/licenses/>.
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = gpgme-tool
-if HAVE_PTHREAD
-ltlib_gpgme_pthread = libgpgme-pthread.la
-else
-ltlib_gpgme_pthread =
-endif
-
if BUILD_W32_GLIB
ltlib_gpgme_glib = libgpgme-glib.la
else
ltlib_gpgme_glib =
endif
-lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) $(ltlib_gpgme_qt) \
- $(ltlib_gpgme_pthread)
+lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib)
if HAVE_LD_VERSION_SCRIPT
libgpgme_version_script_cmd = -Wl,--version-script=$(srcdir)/libgpgme.vers
endif
if HAVE_DOSISH_SYSTEM
-system_components = w32-util.c w32-sema.c
+system_components = w32-util.c
system_components_not_extra = w32-io.c
else
-system_components = ath.h posix-util.c posix-sema.c posix-io.c
+system_components = ath.h posix-util.c posix-io.c
system_components_not_extra =
endif
$(uiserver_components) \
engine-g13.c vfs-mount.c vfs-create.c \
engine-spawn.c \
- gpgconf.c \
+ gpgconf.c queryswdb.c \
sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \
- debug.c debug.h gpgme.c version.c error.c
+ debug.c debug.h gpgme.c version.c error.c \
+ ath.h ath.c
-libgpgme_la_SOURCES = $(main_sources) \
- ath.h ath.c $(system_components_not_extra)
-libgpgme_pthread_la_SOURCES = $(main_sources) \
- ath.h ath-pthread.c $(system_components_not_extra)
+libgpgme_la_SOURCES = $(main_sources) $(system_components_not_extra)
if BUILD_W32_GLIB
-libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c
+libgpgme_glib_la_SOURCES = $(main_sources) w32-glib-io.c
endif
# We use a global CFLAGS setting for all library
libgpgme_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \
@GPG_ERROR_LIBS@
-libgpgme_pthread_la_LDFLAGS = \
- $(no_undefined) $(export_symbols) $(extra_ltoptions) \
- $(libgpgme_version_script_cmd) -version-info \
- @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
-libgpgme_pthread_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers
-libgpgme_pthread_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \
- -lpthread @GPG_ERROR_LIBS@
-
if BUILD_W32_GLIB
libgpgme_glib_la_LDFLAGS = \
$(no_undefined) $(export_symbols) $(extra_ltoptions) \
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+# License along with this program; if not, see <https://www.gnu.org/licenses/>.
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
$(srcdir)/versioninfo.rc.in $(srcdir)/gpgme.h.in \
- $(srcdir)/gpgme-config.in vasprintf.c funopen.c stpcpy.c \
- setenv.c ttyname_r.c $(top_srcdir)/build-aux/depcomp
+ $(srcdir)/gpgme-config.in stpcpy.c funopen.c ttyname_r.c \
+ vasprintf.c setenv.c $(top_srcdir)/build-aux/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
engine-backend.h engine.c engine-gpg.c status-table.c \
engine-gpgsm.c engine-assuan.c engine-gpgconf.c \
engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
- engine-spawn.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \
- posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
- w32-sema.c sys-util.h dirinfo.c debug.c debug.h gpgme.c \
- version.c error.c ath.c w32-glib-io.c
+ engine-spawn.c gpgconf.c queryswdb.c sema.h priv-io.h ath.h \
+ posix-util.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
+ sys-util.h dirinfo.c debug.c debug.h gpgme.c version.c error.c \
+ ath.c w32-glib-io.c
@HAVE_UISERVER_TRUE@am__objects_1 = engine-uiserver.lo
@HAVE_W32CE_SYSTEM_TRUE@am__objects_2 = w32-ce.lo
-@HAVE_DOSISH_SYSTEM_FALSE@am__objects_3 = posix-util.lo posix-sema.lo \
-@HAVE_DOSISH_SYSTEM_FALSE@ posix-io.lo $(am__objects_2)
-@HAVE_DOSISH_SYSTEM_TRUE@am__objects_3 = w32-util.lo w32-sema.lo \
-@HAVE_DOSISH_SYSTEM_TRUE@ $(am__objects_2)
+@HAVE_DOSISH_SYSTEM_FALSE@am__objects_3 = posix-util.lo posix-io.lo \
+@HAVE_DOSISH_SYSTEM_FALSE@ $(am__objects_2)
+@HAVE_DOSISH_SYSTEM_TRUE@am__objects_3 = w32-util.lo $(am__objects_2)
am__objects_4 = conversion.lo b64dec.lo get-env.lo parsetlv.lo \
mbox-util.lo data.lo data-fd.lo data-stream.lo data-mem.lo \
data-user.lo data-compat.lo data-identify.lo signers.lo \
spawn.lo assuan-support.lo engine.lo engine-gpg.lo \
status-table.lo engine-gpgsm.lo engine-assuan.lo \
engine-gpgconf.lo $(am__objects_1) engine-g13.lo vfs-mount.lo \
- vfs-create.lo engine-spawn.lo gpgconf.lo $(am__objects_3) \
- dirinfo.lo debug.lo gpgme.lo version.lo error.lo
+ vfs-create.lo engine-spawn.lo gpgconf.lo queryswdb.lo \
+ $(am__objects_3) dirinfo.lo debug.lo gpgme.lo version.lo \
+ error.lo ath.lo
@BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_OBJECTS = $(am__objects_4) \
-@BUILD_W32_GLIB_TRUE@ ath.lo w32-glib-io.lo
+@BUILD_W32_GLIB_TRUE@ w32-glib-io.lo
libgpgme_glib_la_OBJECTS = $(am_libgpgme_glib_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
$(AM_CFLAGS) $(CFLAGS) $(libgpgme_glib_la_LDFLAGS) $(LDFLAGS) \
-o $@
@BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_rpath = -rpath $(libdir)
-am__libgpgme_pthread_la_SOURCES_DIST = util.h conversion.c b64dec.c \
- get-env.c context.h ops.h parsetlv.c parsetlv.h mbox-util.c \
- mbox-util.h data.h data.c data-fd.c data-stream.c data-mem.c \
- data-user.c data-compat.c data-identify.c signers.c \
- sig-notation.c wait.c wait-global.c wait-private.c wait-user.c \
- wait.h op-support.c encrypt.c encrypt-sign.c decrypt.c \
- decrypt-verify.c verify.c sign.c passphrase.c progress.c key.c \
- keylist.c keysign.c trust-item.c trustlist.c tofupolicy.c \
- import.c export.c genkey.c delete.c edit.c getauditlog.c \
- opassuan.c passwd.c spawn.c assuan-support.c engine.h \
- engine-backend.h engine.c engine-gpg.c status-table.c \
- engine-gpgsm.c engine-assuan.c engine-gpgconf.c \
- engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.c \
- engine-spawn.c gpgconf.c sema.h priv-io.h ath.h posix-util.c \
- posix-sema.c posix-io.c w32-ce.h w32-ce.c w32-util.c \
- w32-sema.c sys-util.h dirinfo.c debug.c debug.h gpgme.c \
- version.c error.c ath-pthread.c w32-io.c
-@HAVE_DOSISH_SYSTEM_TRUE@am__objects_5 = w32-io.lo
-am_libgpgme_pthread_la_OBJECTS = $(am__objects_4) ath-pthread.lo \
- $(am__objects_5)
-libgpgme_pthread_la_OBJECTS = $(am_libgpgme_pthread_la_OBJECTS)
-libgpgme_pthread_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
- $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
- $(AM_CFLAGS) $(CFLAGS) $(libgpgme_pthread_la_LDFLAGS) \
- $(LDFLAGS) -o $@
-@HAVE_PTHREAD_TRUE@am_libgpgme_pthread_la_rpath = -rpath $(libdir)
am__libgpgme_la_SOURCES_DIST = util.h conversion.c b64dec.c get-env.c \
context.h ops.h parsetlv.c parsetlv.h mbox-util.c mbox-util.h \
data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
spawn.c assuan-support.c engine.h engine-backend.h engine.c \
engine-gpg.c status-table.c engine-gpgsm.c engine-assuan.c \
engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
- vfs-create.c engine-spawn.c gpgconf.c sema.h priv-io.h ath.h \
- posix-util.c posix-sema.c posix-io.c w32-ce.h w32-ce.c \
- w32-util.c w32-sema.c sys-util.h dirinfo.c debug.c debug.h \
- gpgme.c version.c error.c ath.c w32-io.c
-am_libgpgme_la_OBJECTS = $(am__objects_4) ath.lo $(am__objects_5)
+ vfs-create.c engine-spawn.c gpgconf.c queryswdb.c sema.h \
+ priv-io.h ath.h posix-util.c posix-io.c w32-ce.h w32-ce.c \
+ w32-util.c sys-util.h dirinfo.c debug.c debug.h gpgme.c \
+ version.c error.c ath.c w32-io.c
+@HAVE_DOSISH_SYSTEM_TRUE@am__objects_5 = w32-io.lo
+am_libgpgme_la_OBJECTS = $(am__objects_4) $(am__objects_5)
libgpgme_la_OBJECTS = $(am_libgpgme_la_OBJECTS)
libgpgme_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = $(libgpgme_glib_la_SOURCES) $(libgpgme_pthread_la_SOURCES) \
- $(libgpgme_la_SOURCES) $(gpgme_tool_SOURCES) gpgme-w32spawn.c
+SOURCES = $(libgpgme_glib_la_SOURCES) $(libgpgme_la_SOURCES) \
+ $(gpgme_tool_SOURCES) gpgme-w32spawn.c
DIST_SOURCES = $(am__libgpgme_glib_la_SOURCES_DIST) \
- $(am__libgpgme_pthread_la_SOURCES_DIST) \
$(am__libgpgme_la_SOURCES_DIST) $(gpgme_tool_SOURCES) \
gpgme-w32spawn.c
am__can_run_installinfo = \
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
m4datadir = $(datadir)/aclocal
m4data_DATA = gpgme.m4
nodist_include_HEADERS = gpgme.h
-@HAVE_PTHREAD_FALSE@ltlib_gpgme_pthread =
-@HAVE_PTHREAD_TRUE@ltlib_gpgme_pthread = libgpgme-pthread.la
@BUILD_W32_GLIB_FALSE@ltlib_gpgme_glib =
@BUILD_W32_GLIB_TRUE@ltlib_gpgme_glib = libgpgme-glib.la
-lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) $(ltlib_gpgme_qt) \
- $(ltlib_gpgme_pthread)
-
+lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib)
@HAVE_LD_VERSION_SCRIPT_FALSE@libgpgme_version_script_cmd =
@HAVE_LD_VERSION_SCRIPT_TRUE@libgpgme_version_script_cmd = -Wl,--version-script=$(srcdir)/libgpgme.vers
@HAVE_DOSISH_SYSTEM_FALSE@system_components = ath.h posix-util.c \
-@HAVE_DOSISH_SYSTEM_FALSE@ posix-sema.c posix-io.c \
-@HAVE_DOSISH_SYSTEM_FALSE@ $(am__append_1)
-@HAVE_DOSISH_SYSTEM_TRUE@system_components = w32-util.c w32-sema.c \
+@HAVE_DOSISH_SYSTEM_FALSE@ posix-io.c $(am__append_1)
+@HAVE_DOSISH_SYSTEM_TRUE@system_components = w32-util.c \
@HAVE_DOSISH_SYSTEM_TRUE@ $(am__append_1)
@HAVE_DOSISH_SYSTEM_FALSE@system_components_not_extra =
@HAVE_DOSISH_SYSTEM_TRUE@system_components_not_extra = w32-io.c
$(uiserver_components) \
engine-g13.c vfs-mount.c vfs-create.c \
engine-spawn.c \
- gpgconf.c \
+ gpgconf.c queryswdb.c \
sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \
- debug.c debug.h gpgme.c version.c error.c
-
-libgpgme_la_SOURCES = $(main_sources) \
- ath.h ath.c $(system_components_not_extra)
-
-libgpgme_pthread_la_SOURCES = $(main_sources) \
- ath.h ath-pthread.c $(system_components_not_extra)
+ debug.c debug.h gpgme.c version.c error.c \
+ ath.h ath.c
-@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c
+libgpgme_la_SOURCES = $(main_sources) $(system_components_not_extra)
+@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_SOURCES = $(main_sources) w32-glib-io.c
# We use a global CFLAGS setting for all library
# versions, because then every object file is only compiled once.
libgpgme_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \
@GPG_ERROR_LIBS@
-libgpgme_pthread_la_LDFLAGS = \
- $(no_undefined) $(export_symbols) $(extra_ltoptions) \
- $(libgpgme_version_script_cmd) -version-info \
- @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@
-
-libgpgme_pthread_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers
-libgpgme_pthread_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \
- -lpthread @GPG_ERROR_LIBS@
-
@BUILD_W32_GLIB_TRUE@libgpgme_glib_la_LDFLAGS = \
@BUILD_W32_GLIB_TRUE@ $(no_undefined) $(export_symbols) $(extra_ltoptions) \
@BUILD_W32_GLIB_TRUE@ $(libgpgme_version_script_cmd) -version-info \
libgpgme-glib.la: $(libgpgme_glib_la_OBJECTS) $(libgpgme_glib_la_DEPENDENCIES) $(EXTRA_libgpgme_glib_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgpgme_glib_la_LINK) $(am_libgpgme_glib_la_rpath) $(libgpgme_glib_la_OBJECTS) $(libgpgme_glib_la_LIBADD) $(LIBS)
-libgpgme-pthread.la: $(libgpgme_pthread_la_OBJECTS) $(libgpgme_pthread_la_DEPENDENCIES) $(EXTRA_libgpgme_pthread_la_DEPENDENCIES)
- $(AM_V_CCLD)$(libgpgme_pthread_la_LINK) $(am_libgpgme_pthread_la_rpath) $(libgpgme_pthread_la_OBJECTS) $(libgpgme_pthread_la_LIBADD) $(LIBS)
-
libgpgme.la: $(libgpgme_la_OBJECTS) $(libgpgme_la_DEPENDENCIES) $(EXTRA_libgpgme_la_DEPENDENCIES)
$(AM_V_CCLD)$(libgpgme_la_LINK) -rpath $(libdir) $(libgpgme_la_OBJECTS) $(libgpgme_la_LIBADD) $(LIBS)
install-binPROGRAMS: $(bin_PROGRAMS)
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/vasprintf.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argparse.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assuan-support.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ath-pthread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ath.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/b64dec.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversion.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passphrase.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwd.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-io.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-sema.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix-util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/progress.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queryswdb.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig-notation.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sign.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-ce.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-glib-io.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-io.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-sema.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/w32-util.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wait-global.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wait-private.Plo@am__quote@
*
* You should have received a copies of the GNU General Public License
* and the GNU Lesser General Public License along with this program;
- * if not, see <http://www.gnu.org/licenses/>.
+ * if not, see <https://www.gnu.org/licenses/>.
*/
/* This file may be used as part of GnuPG or standalone. A GnuPG
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n\n"
"You should have received a copy of the GNU General Public License\n"
-"along with this software. If not, see <http://www.gnu.org/licenses/>.\n";
+"along with this software. If not, see <https://www.gnu.org/licenses/>.\n";
break;
case 40: /* short and long usage */
case 41: p = ""; break;
*
* You should have received a copies of the GNU General Public License
* and the GNU Lesser General Public License along with this program;
- * if not, see <http://www.gnu.org/licenses/>.
+ * if not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GNUPG_COMMON_ARGPARSE_H
+++ /dev/null
-/* ath-pthread.c - pthread module for self-adapting thread-safeness library
- Copyright (C) 2002, 2003, 2004 g10 Code GmbH
-
- This file is part of GPGME.
-
- GPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- GPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#else
-# ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-# endif
-#endif
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <pthread.h>
-
-#include "gpgme.h"
-
-#include "ath.h"
-
-
-/* The lock we take while checking for lazy lock initialization. */
-static pthread_mutex_t check_init_lock = PTHREAD_MUTEX_INITIALIZER;
-
-/* Initialize the mutex *PRIV. If JUST_CHECK is true, only do this if
- it is not already initialized. */
-static int
-mutex_pthread_init (ath_mutex_t *priv, int just_check)
-{
- int err = 0;
-
- if (just_check)
- pthread_mutex_lock (&check_init_lock);
- if (!*priv || !just_check)
- {
- pthread_mutex_t *lock = malloc (sizeof (pthread_mutex_t));
- if (!lock)
- err = ENOMEM;
- if (!err)
- {
- err = pthread_mutex_init (lock, NULL);
- if (err)
- free (lock);
- else
- *priv = (ath_mutex_t) lock;
- }
- }
- if (just_check)
- pthread_mutex_unlock (&check_init_lock);
- return err;
-}
-
-
-void
-ath_init (void)
-{
- /* Nothing to do. */
-}
-
-
-uintptr_t
-ath_self (void)
-{
- return (uintptr_t) pthread_self ();
-}
-
-
-int
-ath_mutex_init (ath_mutex_t *lock)
-{
- return mutex_pthread_init (lock, 0);
-}
-
-
-int
-ath_mutex_destroy (ath_mutex_t *lock)
-{
- int err = mutex_pthread_init (lock, 1);
- if (!err)
- {
- err = pthread_mutex_destroy ((pthread_mutex_t *) *lock);
- free (*lock);
- }
- return err;
-}
-
-
-int
-ath_mutex_lock (ath_mutex_t *lock)
-{
- int ret = mutex_pthread_init (lock, 1);
- if (ret)
- return ret;
-
- return pthread_mutex_lock ((pthread_mutex_t *) *lock);
-}
-
-
-int
-ath_mutex_unlock (ath_mutex_t *lock)
-{
- int ret = mutex_pthread_init (lock, 1);
- if (ret)
- return ret;
-
- return pthread_mutex_unlock ((pthread_mutex_t *) *lock);
-}
-
-
-gpgme_ssize_t
-ath_read (int fd, void *buf, size_t nbytes)
-{
- return read (fd, buf, nbytes);
-}
-
-
-gpgme_ssize_t
-ath_write (int fd, const void *buf, size_t nbytes)
-{
- return write (fd, buf, nbytes);
-}
-
-
-gpgme_ssize_t
-ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
- struct timeval *timeout)
-{
- return select (nfd, rset, wset, eset, timeout);
-}
-
-
-gpgme_ssize_t
-ath_waitpid (pid_t pid, int *status, int options)
-{
- return waitpid (pid, status, options);
-}
-
-
-int
-ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr)
-{
- return accept (s, addr, length_ptr);
-}
-
-
-int
-ath_connect (int s, const struct sockaddr *addr, socklen_t length)
-{
- return connect (s, addr, length);
-}
-
-int
-ath_sendmsg (int s, const struct msghdr *msg, int flags)
-{
- return sendmsg (s, msg, flags);
-}
-
-
-int
-ath_recvmsg (int s, struct msghdr *msg, int flags)
-{
- return recvmsg (s, msg, flags);
-}
#include "ath.h"
-#define MUTEX_UNLOCKED ((ath_mutex_t) 0)
-#define MUTEX_LOCKED ((ath_mutex_t) 1)
-#define MUTEX_DESTROYED ((ath_mutex_t) 2)
-
-
#ifdef HAVE_W32_SYSTEM
#include <windows.h>
uintptr_t
#endif
-int
-ath_mutex_init (ath_mutex_t *lock)
-{
-#ifndef NDEBUG
- *lock = MUTEX_UNLOCKED;
-#endif
- return 0;
-}
-
-
-int
-ath_mutex_destroy (ath_mutex_t *lock)
-{
-#ifndef NDEBUG
- assert (*lock == MUTEX_UNLOCKED);
-
- *lock = MUTEX_DESTROYED;
-#endif
- return 0;
-}
-
-
-int
-ath_mutex_lock (ath_mutex_t *lock)
-{
-#ifndef NDEBUG
- assert (*lock == MUTEX_UNLOCKED);
-
- *lock = MUTEX_LOCKED;
-#endif
- return 0;
-}
-
-
-int
-ath_mutex_unlock (ath_mutex_t *lock)
-{
-#ifndef NDEBUG
- assert (*lock == MUTEX_LOCKED);
-
- *lock = MUTEX_UNLOCKED;
-#endif
- return 0;
-}
-
-
gpgme_ssize_t
ath_read (int fd, void *buf, size_t nbytes)
{
#define _ATH_PREFIX1(x,y) x ## y
#define _ATH_PREFIX2(x,y) _ATH_PREFIX1(x,y)
#define _ATH_PREFIX(x) _ATH_PREFIX2(_ATH_EXT_SYM_PREFIX,x)
-#define ath_mutex_init _ATH_PREFIX(ath_mutex_init)
-#define ath_mutex_destroy _ATH_PREFIX(ath_mutex_destroy)
-#define ath_mutex_lock _ATH_PREFIX(ath_mutex_lock)
-#define ath_mutex_unlock _ATH_PREFIX(ath_mutex_unlock)
#define ath_read _ATH_PREFIX(ath_read)
#define ath_write _ATH_PREFIX(ath_write)
#define ath_select _ATH_PREFIX(ath_select)
#endif
\f
-typedef void *ath_mutex_t;
-#define ATH_MUTEX_INITIALIZER 0;
-
uintptr_t ath_self (void);
-/* Functions for mutual exclusion. */
-int ath_mutex_init (ath_mutex_t *mutex);
-int ath_mutex_destroy (ath_mutex_t *mutex);
-int ath_mutex_lock (ath_mutex_t *mutex);
-int ath_mutex_unlock (ath_mutex_t *mutex);
-
/* Replacement for the POSIX functions, which can be used to allow
other (user-level) threads to run. */
gpgme_ssize_t ath_read (int fd, void *buf, size_t nbytes);
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#include <config.h>
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CONTEXT_H
OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE,
OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT,
OPDATA_VERIFY, OPDATA_TRUSTLIST, OPDATA_ASSUAN, OPDATA_VFS_MOUNT,
- OPDATA_PASSWD, OPDATA_EXPORT, OPDATA_KEYSIGN, OPDATA_TOFU_POLICY
+ OPDATA_PASSWD, OPDATA_EXPORT, OPDATA_KEYSIGN, OPDATA_TOFU_POLICY,
+ OPDATA_QUERY_SWDB
} ctx_op_data_id_t;
* unmodified string, as received form gpg, will be returned. */
unsigned int raw_description : 1;
+ /* True if session keys should be exported upon decryption. */
+ unsigned int export_session_keys : 1;
+
/* Flags for keylist mode. */
gpgme_keylist_mode_t keylist_mode;
/* Number of certs to be included. */
unsigned int include_certs;
- /* The number of keys in signers. */
+ /* The actual number of keys in SIGNERS, the allocated size of the
+ * array, and the array with the signing keys. */
unsigned int signers_len;
-
- /* Size of the following array. */
unsigned int signers_size;
gpgme_key_t *signers;
/* The signature notations for this context. */
gpgme_sig_notation_t sig_notations;
+ /* The sender's addr-spec or NULL. */
+ char *sender;
+
+ /* The gpg specific override session key or NULL. */
+ char *override_session_key;
+
/* The locale for the pinentry. */
char *lc_ctype;
char *lc_messages;
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
_gpgme_engine_set_status_handler (ctx->engine,
decrypt_verify_status_handler, ctx);
- return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain);
+ return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain,
+ ctx->export_session_keys,
+ ctx->override_session_key);
}
if (opd->result.file_name)
free (opd->result.file_name);
+ if (opd->result.session_key)
+ free (opd->result.session_key);
+
while (recipient)
{
gpgme_recipient_t next = recipient->next;
opd->last_recipient_p = &(*opd->last_recipient_p)->next;
break;
+ case GPGME_STATUS_SESSION_KEY:
+ if (opd->result.session_key)
+ free (opd->result.session_key);
+ opd->result.session_key = strdup(args);
+ break;
+
case GPGME_STATUS_NO_SECKEY:
{
gpgme_recipient_t rec = opd->result.recipients;
static gpgme_error_t
decrypt_start (gpgme_ctx_t ctx, int synchronous,
- gpgme_data_t cipher, gpgme_data_t plain)
+ gpgme_data_t cipher, gpgme_data_t plain)
{
gpgme_error_t err;
_gpgme_engine_set_status_handler (ctx->engine, decrypt_status_handler, ctx);
- return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain);
+ return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain,
+ ctx->export_session_keys,
+ ctx->override_session_key);
}
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/*
llass_transact, /* opassuan_transact */
NULL, /* conf_load */
NULL, /* conf_save */
+ NULL, /* query_swdb */
llass_set_io_cbs,
llass_io_event,
llass_cancel,
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifndef ENGINE_BACKEND_H
gpgme_error_t (*set_locale) (void *engine, int category, const char *value);
gpgme_error_t (*set_protocol) (void *engine, gpgme_protocol_t protocol);
gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph,
- gpgme_data_t plain);
+ gpgme_data_t plain, int export_session_key,
+ const char *override_session_key);
gpgme_error_t (*decrypt_verify) (void *engine, gpgme_data_t ciph,
- gpgme_data_t plain);
+ gpgme_data_t plain, int export_session_key,
+ const char *override_session_key);
gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret);
gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key,
gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */);
gpgme_ctx_t ctx /* FIXME */);
gpgme_error_t (*trustlist) (void *engine, const char *pattern);
gpgme_error_t (*verify) (void *engine, gpgme_data_t sig,
- gpgme_data_t signed_text, gpgme_data_t plaintext);
+ gpgme_data_t signed_text, gpgme_data_t plaintext,
+ gpgme_ctx_t ctx);
gpgme_error_t (*getauditlog) (void *engine, gpgme_data_t output,
unsigned int flags);
gpgme_error_t (*opassuan_transact) (void *engine,
gpgme_error_t (*conf_load) (void *engine, gpgme_conf_comp_t *conf_p);
gpgme_error_t (*conf_save) (void *engine, gpgme_conf_comp_t conf);
+ gpgme_error_t (*query_swdb) (void *engine,
+ const char *name, const char *iversion,
+ gpgme_query_swdb_result_t result);
+
void (*set_io_cbs) (void *engine, gpgme_io_cbs_t io_cbs);
void (*io_event) (void *engine, gpgme_event_io_t type, void *type_data);
g13_transact,
NULL, /* conf_load */
NULL, /* conf_save */
+ NULL, /* query_swdb */
g13_set_io_cbs,
g13_io_event,
g13_cancel,
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
struct gpgme_io_cbs io_cbs;
gpgme_pinentry_mode_t pinentry_mode;
+
+ /* NULL or the data object fed to --override_session_key-fd. */
+ gpgme_data_t override_session_key;
};
typedef struct engine_gpg *engine_gpg_t;
if (gpg->cmd.keyword)
free (gpg->cmd.keyword);
+ gpgme_data_release (gpg->override_session_key);
+
free (gpg);
}
static gpgme_error_t
-gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain)
+gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain,
+ int export_session_key, const char *override_session_key)
{
engine_gpg_t gpg = engine;
gpgme_error_t err;
err = add_arg (gpg, "--decrypt");
+ if (!err && export_session_key)
+ err = add_arg (gpg, "--show-session-key");
+
+ if (!err && override_session_key && *override_session_key)
+ {
+ if (have_gpg_version (gpg, "2.1.16"))
+ {
+ gpgme_data_release (gpg->override_session_key);
+ TRACE2 (DEBUG_ENGINE, "override", gpg, "seskey='%s' len=%zu\n",
+ override_session_key,
+ strlen (override_session_key));
+
+ err = gpgme_data_new_from_mem (&gpg->override_session_key,
+ override_session_key,
+ strlen (override_session_key), 1);
+ if (!err)
+ {
+ err = add_arg (gpg, "--override-session-key-fd");
+ if (!err)
+ err = add_data (gpg, gpg->override_session_key, -2, 0);
+ }
+ }
+ else
+ {
+ /* Using that option may leak the session key via ps(1). */
+ err = add_arg (gpg, "--override-session-key");
+ if (!err)
+ err = add_arg (gpg, override_session_key);
+ }
+ }
+
/* Tell the gpg object about the data. */
if (!err)
err = add_arg (gpg, "--output");
static gpgme_error_t
+append_args_from_sender (engine_gpg_t gpg, gpgme_ctx_t ctx)
+{
+ gpgme_error_t err;
+
+ if (ctx->sender && have_gpg_version (gpg, "2.1.15"))
+ {
+ err = add_arg (gpg, "--sender");
+ if (!err)
+ err = add_arg (gpg, ctx->sender);
+ }
+ else
+ err = 0;
+ return err;
+}
+
+
+static gpgme_error_t
append_args_from_sig_notations (engine_gpg_t gpg, gpgme_ctx_t ctx /* FIXME */)
{
gpgme_error_t err = 0;
err = append_args_from_signers (gpg, ctx);
if (!err)
+ err = append_args_from_sender (gpg, ctx);
+
+ if (!err)
err = append_args_from_sig_notations (gpg, ctx);
/* Tell the gpg object about the data. */
if (!err)
err = append_args_from_signers (gpg, ctx);
if (!err)
+ err = append_args_from_sender (gpg, ctx);
+ if (!err)
err = append_args_from_sig_notations (gpg, ctx);
if (gpgme_data_get_file_name (in))
static gpgme_error_t
gpg_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text,
- gpgme_data_t plaintext)
+ gpgme_data_t plaintext, gpgme_ctx_t ctx)
{
engine_gpg_t gpg = engine;
- gpgme_error_t err = 0;
+ gpgme_error_t err;
- if (plaintext)
+ err = append_args_from_sender (gpg, ctx);
+ if (err)
+ ;
+ else if (plaintext)
{
/* Normal or cleartext signature. */
err = add_arg (gpg, "--output");
NULL, /* opassuan_transact */
NULL, /* conf_load */
NULL, /* conf_save */
+ NULL, /* query_swdb */
gpg_set_io_cbs,
gpg_io_event,
gpg_cancel,
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#include "engine-backend.h"
+
\f
struct engine_gpgconf
{
char *file_name;
char *home_dir;
+ char *version;
};
typedef struct engine_gpgconf *engine_gpgconf_t;
\f
+/* Return true if the engine's version is at least VERSION. */
+static int
+have_gpgconf_version (engine_gpgconf_t gpgconf, const char *version)
+{
+ return _gpgme_compare_versions (gpgconf->version, version);
+}
+
+
static char *
gpgconf_get_version (const char *file_name)
{
free (gpgconf->file_name);
if (gpgconf->home_dir)
free (gpgconf->home_dir);
+ if (gpgconf->version)
+ free (gpgconf->version);
free (gpgconf);
}
gpgme_error_t err = 0;
engine_gpgconf_t gpgconf;
- (void)version; /* Not yet used. */
-
gpgconf = calloc (1, sizeof *gpgconf);
if (!gpgconf)
return gpg_error_from_syserror ();
err = gpg_error_from_syserror ();
}
+ if (!err && version)
+ {
+ gpgconf->version = strdup (version);
+ if (!gpgconf->version)
+ err = gpg_error_from_syserror ();
+ }
+
if (err)
gpgconf_release (gpgconf);
else
char *linebuf;
size_t linebufsize;
int linelen;
- char *argv[4] = { NULL /* file_name */, NULL, NULL, NULL };
+ char *argv[6];
+ int argc = 0;
int rp[2];
struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */, -1, 0},
{-1, -1} };
int nread;
char *mark = NULL;
- argv[1] = (char*)arg1;
- argv[2] = arg2;
-
+ /* _gpgme_engine_new guarantees that this is not NULL. */
+ argv[argc++] = gpgconf->file_name;
- /* FIXME: Deal with engine->home_dir. */
+ if (gpgconf->home_dir && have_gpgconf_version (gpgconf, "2.1.13"))
+ {
+ argv[argc++] = (char*)"--homedir";
+ argv[argc++] = gpgconf->home_dir;
+ }
- /* _gpgme_engine_new guarantees that this is not NULL. */
- argv[0] = gpgconf->file_name;
+ argv[argc++] = (char*)arg1;
+ argv[argc++] = arg2;
+ argv[argc] = NULL;
+ assert (argc < DIM (argv));
if (_gpgme_io_pipe (rp, 1) < 0)
return gpg_error_from_syserror ();
#define BUFLEN 1024
char buf[BUFLEN];
int buflen = 0;
- char *argv[] = { NULL /* file_name */, (char*)arg1, arg2, 0 };
+ char *argv[6];
+ int argc = 0;
int rp[2];
struct spawn_fd_item_s cfd[] = { {-1, 0 /* STDIN_FILENO */}, {-1, -1} };
int status;
int nwrite;
- /* FIXME: Deal with engine->home_dir. */
-
/* _gpgme_engine_new guarantees that this is not NULL. */
- argv[0] = gpgconf->file_name;
+ argv[argc++] = gpgconf->file_name;
+
+ if (gpgconf->home_dir && have_gpgconf_version (gpgconf, "2.1.13"))
+ {
+ argv[argc++] = (char*)"--homedir";
+ argv[argc++] = gpgconf->home_dir;
+ }
+
+ argv[argc++] = (char*)arg1;
+ argv[argc++] = arg2;
+ argv[argc] = NULL;
+ assert (argc < DIM (argv));
if (_gpgme_io_pipe (rp, 0) < 0)
return gpg_error_from_syserror ();
}
+/* Parse a line received from gpgconf --query-swdb. This function may
+ * modify LINE. The result is stored at RESUL. */
+static gpg_error_t
+parse_swdb_line (char *line, gpgme_query_swdb_result_t result)
+{
+ char *field[9];
+ int fields = 0;
+ gpg_err_code_t ec;
+
+ while (line && fields < DIM (field))
+ {
+ field[fields++] = line;
+ line = strchr (line, ':');
+ if (line)
+ *line++ = 0;
+ }
+ /* We require that all fields exists - gpgme emits all these fields
+ * even on error. They might be empty, though. */
+ if (fields < 9)
+ return gpg_error (GPG_ERR_INV_ENGINE);
+
+ free (result->name);
+ result->name = strdup (field[0]);
+ if (!result->name)
+ return gpg_error_from_syserror ();
+
+ free (result->iversion);
+ result->iversion = strdup (field[1]);
+ if (!result->iversion)
+ return gpg_error_from_syserror ();
+
+ result->urgent = (strtol (field[3], NULL, 10) > 0);
+
+ ec = gpg_err_code (strtoul (field[4], NULL, 10));
+
+ result->created = _gpgme_parse_timestamp (field[5], NULL);
+ result->retrieved= _gpgme_parse_timestamp (field[6], NULL);
+
+ free (result->version);
+ result->version = strdup (field[7]);
+ if (!result->version)
+ return gpg_error_from_syserror ();
+
+ result->reldate = _gpgme_parse_timestamp (field[8], NULL);
+
+ /* Set other flags. */
+ result->warning = !!ec;
+ result->update = 0;
+ result->noinfo = 0;
+ result->unknown = 0;
+ result->tooold = 0;
+ result->error = 0;
+
+ switch (*field[2])
+ {
+ case '-': result->warning = 1; break;
+ case '?': result->unknown = result->warning = 1; break;
+ case 'u': result->update = 1; break;
+ case 'c': break;
+ case 'n': break;
+ default:
+ result->warning = 1;
+ if (!ec)
+ ec = GPG_ERR_INV_ENGINE;
+ break;
+ }
+
+ if (ec == GPG_ERR_TOO_OLD)
+ result->tooold = 1;
+ else if (ec == GPG_ERR_ENOENT)
+ result->noinfo = 1;
+ else if (ec)
+ result->error = 1;
+
+
+ return 0;
+}
+
+
+static gpgme_error_t
+gpgconf_query_swdb (void *engine,
+ const char *name, const char *iversion,
+ gpgme_query_swdb_result_t result)
+{
+ struct engine_gpgconf *gpgconf = engine;
+ gpgme_error_t err = 0;
+ char *linebuf;
+ size_t linebufsize;
+ int linelen;
+ char *argv[7];
+ int argc = 0;
+ int rp[2];
+ struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */, -1, 0},
+ {-1, -1} };
+ int status;
+ int nread;
+ char *mark = NULL;
+
+ if (!have_gpgconf_version (gpgconf, "2.1.16"))
+ return gpg_error (GPG_ERR_ENGINE_TOO_OLD);
+
+ /* _gpgme_engine_new guarantees that this is not NULL. */
+ argv[argc++] = gpgconf->file_name;
+
+ if (gpgconf->home_dir)
+ {
+ argv[argc++] = (char*)"--homedir";
+ argv[argc++] = gpgconf->home_dir;
+ }
+
+ argv[argc++] = (char*)"--query-swdb";
+ argv[argc++] = (char*)name;
+ argv[argc++] = (char*)iversion;
+ argv[argc] = NULL;
+ assert (argc < DIM (argv));
+
+ if (_gpgme_io_pipe (rp, 1) < 0)
+ return gpg_error_from_syserror ();
+
+ cfd[0].fd = rp[1];
+
+ status = _gpgme_io_spawn (gpgconf->file_name, argv,
+ IOSPAWN_FLAG_DETACHED, cfd, NULL, NULL, NULL);
+ if (status < 0)
+ {
+ _gpgme_io_close (rp[0]);
+ _gpgme_io_close (rp[1]);
+ return gpg_error_from_syserror ();
+ }
+
+ linebufsize = 2048; /* Same as used by gpgconf. */
+ linebuf = malloc (linebufsize);
+ if (!linebuf)
+ {
+ err = gpg_error_from_syserror ();
+ goto leave;
+ }
+ linelen = 0;
+
+ while ((nread = _gpgme_io_read (rp[0], linebuf + linelen,
+ linebufsize - linelen - 1)))
+ {
+ char *line;
+ const char *lastmark = NULL;
+ size_t nused;
+
+ if (nread < 0)
+ {
+ err = gpg_error_from_syserror ();
+ goto leave;
+ }
+
+ linelen += nread;
+ linebuf[linelen] = '\0';
+
+ for (line=linebuf; (mark = strchr (line, '\n')); line = mark+1 )
+ {
+ lastmark = mark;
+ if (mark > line && mark[-1] == '\r')
+ mark[-1] = '\0';
+ else
+ mark[0] = '\0';
+
+ /* Got a full line. Due to the CR removal code (which
+ occurs only on Windows) we might be one-off and thus
+ would see empty lines. */
+ if (*line)
+ {
+ err = parse_swdb_line (line, result);
+ goto leave; /* Ready. */
+ }
+ else /* empty line. */
+ err = 0;
+ }
+
+ nused = lastmark? (lastmark + 1 - linebuf) : 0;
+ memmove (linebuf, linebuf + nused, linelen - nused);
+ linelen -= nused;
+
+ if (!(linelen < linebufsize - 1))
+ {
+ char *newlinebuf;
+
+ if (linelen < 8 * 1024 - 1)
+ linebufsize = 8 * 1024;
+ else if (linelen < 64 * 1024 - 1)
+ linebufsize = 64 * 1024;
+ else
+ {
+ /* We reached our limit - give up. */
+ err = gpg_error (GPG_ERR_LINE_TOO_LONG);
+ goto leave;
+ }
+
+ newlinebuf = realloc (linebuf, linebufsize);
+ if (!newlinebuf)
+ {
+ err = gpg_error_from_syserror ();
+ goto leave;
+ }
+ linebuf = newlinebuf;
+ }
+ }
+
+ leave:
+ free (linebuf);
+ _gpgme_io_close (rp[0]);
+ return err;
+}
+
+
static void
gpgconf_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs)
{
NULL, /* opassuan_transact */
gpgconf_conf_load,
gpgconf_conf_save,
+ gpgconf_query_swdb,
gpgconf_set_io_cbs,
NULL, /* io_event */
NULL, /* cancel */
static gpgme_error_t
-gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain)
+gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain,
+ int export_session_key, const char *override_session_key)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
+ /* gpgsm is not capable of exporting session keys right now, so we
+ * will ignore this if requested. */
+ (void)export_session_key;
+ (void)override_session_key;
+
if (!gpgsm)
return gpg_error (GPG_ERR_INV_VALUE);
static gpgme_error_t
gpgsm_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text,
- gpgme_data_t plaintext)
+ gpgme_data_t plaintext, gpgme_ctx_t ctx)
{
engine_gpgsm_t gpgsm = engine;
gpgme_error_t err;
+ (void)ctx;
+
if (!gpgsm)
return gpg_error (GPG_ERR_INV_VALUE);
NULL, /* opassuan_transact */
NULL, /* conf_load */
NULL, /* conf_save */
+ NULL, /* query_swdb */
gpgsm_set_io_cbs,
gpgsm_io_event,
gpgsm_cancel,
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
NULL, /* opassuan_transact */
NULL, /* conf_load */
NULL, /* conf_save */
+ NULL, /* query_swdb */
engspawn_set_io_cbs,
engspawn_io_event, /* io_event */
engspawn_cancel, /* cancel */
static gpgme_error_t
_uiserver_decrypt (void *engine, int verify,
- gpgme_data_t ciph, gpgme_data_t plain)
+ gpgme_data_t ciph, gpgme_data_t plain,
+ int export_session_key, const char *override_session_key)
{
engine_uiserver_t uiserver = engine;
gpgme_error_t err;
const char *protocol;
char *cmd;
+ (void)override_session_key; /* Fixme: We need to see now to add this
+ * to the UI server protocol */
+
if (!uiserver)
return gpg_error (GPG_ERR_INV_VALUE);
if (uiserver->protocol == GPGME_PROTOCOL_DEFAULT)
else
return gpgme_error (GPG_ERR_UNSUPPORTED_PROTOCOL);
- if (asprintf (&cmd, "DECRYPT%s%s", protocol,
- verify ? "" : " --no-verify") < 0)
+ if (asprintf (&cmd, "DECRYPT%s%s%s", protocol,
+ verify ? "" : " --no-verify",
+ export_session_key ? " --export-session-key" : "") < 0)
return gpg_error_from_syserror ();
uiserver->input_cb.data = ciph;
static gpgme_error_t
-uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain)
+uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain,
+ int export_session_key, const char *override_session_key)
{
- return _uiserver_decrypt (engine, 0, ciph, plain);
+ return _uiserver_decrypt (engine, 0, ciph, plain,
+ export_session_key, override_session_key);
}
static gpgme_error_t
-uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain)
+uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain,
+ int export_session_key,
+ const char *override_session_key)
{
- return _uiserver_decrypt (engine, 1, ciph, plain);
+ return _uiserver_decrypt (engine, 1, ciph, plain,
+ export_session_key, override_session_key);
}
/* FIXME: Missing a way to specify --silent. */
static gpgme_error_t
uiserver_verify (void *engine, gpgme_data_t sig, gpgme_data_t signed_text,
- gpgme_data_t plaintext)
+ gpgme_data_t plaintext, gpgme_ctx_t ctx)
{
engine_uiserver_t uiserver = engine;
gpgme_error_t err;
const char *protocol;
char *cmd;
+ (void)ctx; /* FIXME: We should to add a --sender option to the
+ * UISever protocol. */
+
if (!uiserver)
return gpg_error (GPG_ERR_INV_VALUE);
if (uiserver->protocol == GPGME_PROTOCOL_DEFAULT)
NULL, /* opassuan_transact */
NULL, /* conf_load */
NULL, /* conf_save */
+ NULL, /* query_swdb */
uiserver_set_io_cbs,
uiserver_io_event,
uiserver_cancel,
NULL, /* cancel_op */
NULL, /* passwd */
- NULL, /* set_pinentry_mode */
+ NULL, /* set_pinentry_mode */
NULL /* opspawn */
};
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
gpgme_error_t
_gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph,
- gpgme_data_t plain)
+ gpgme_data_t plain, int export_session_key,
+ const char *override_session_key)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->decrypt)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
- return (*engine->ops->decrypt) (engine->engine, ciph, plain);
+ return (*engine->ops->decrypt) (engine->engine, ciph, plain,
+ export_session_key, override_session_key);
}
gpgme_error_t
_gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph,
- gpgme_data_t plain)
+ gpgme_data_t plain, int export_session_key,
+ const char *override_session_key)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->decrypt_verify)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
- return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain);
+ return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain,
+ export_session_key,
+ override_session_key);
}
gpgme_error_t
_gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
- gpgme_data_t signed_text, gpgme_data_t plaintext)
+ gpgme_data_t signed_text, gpgme_data_t plaintext,
+ gpgme_ctx_t ctx)
{
if (!engine)
return gpg_error (GPG_ERR_INV_VALUE);
if (!engine->ops->verify)
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
- return (*engine->ops->verify) (engine->engine, sig, signed_text, plaintext);
+ return (*engine->ops->verify) (engine->engine, sig, signed_text, plaintext,
+ ctx);
}
}
+gpgme_error_t
+_gpgme_engine_op_query_swdb (engine_t engine,
+ const char *name, const char *iversion,
+ gpgme_query_swdb_result_t result)
+{
+ if (!engine)
+ return gpg_error (GPG_ERR_INV_VALUE);
+
+ if (!engine->ops->query_swdb)
+ return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+
+ return (*engine->ops->query_swdb) (engine->engine, name, iversion, result);
+}
+
+
void
_gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs)
{
engine_colon_line_handler_t fnc,
void *fnc_value);
gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph,
- gpgme_data_t plain);
+ gpgme_data_t plain,
+ int export_session_key,
+ const char *override_session_key);
gpgme_error_t _gpgme_engine_op_decrypt_verify (engine_t engine,
gpgme_data_t ciph,
- gpgme_data_t plain);
+ gpgme_data_t plain,
+ int export_session_key,
+ const char *override_session_key
+ );
gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key,
int allow_secret);
gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type,
const char *pattern);
gpgme_error_t _gpgme_engine_op_verify (engine_t engine, gpgme_data_t sig,
gpgme_data_t signed_text,
- gpgme_data_t plaintext);
+ gpgme_data_t plaintext,
+ gpgme_ctx_t ctx);
gpgme_error_t _gpgme_engine_op_getauditlog (engine_t engine,
gpgme_data_t output,
gpgme_error_t _gpgme_engine_op_conf_save (engine_t engine,
gpgme_conf_comp_t conf);
+gpgme_error_t _gpgme_engine_op_query_swdb (engine_t engine,
+ const char *name,
+ const char *iversion,
+ gpgme_query_swdb_result_t result);
+
+
void _gpgme_engine_set_io_cbs (engine_t engine,
gpgme_io_cbs_t io_cbs);
void _gpgme_engine_io_event (engine_t engine,
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
}
-/* Public function to release load a configuration list. No
+/* Public function to load a configuration list. No
asynchronous interface for now. */
gpgme_error_t
gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p)
ctx->protocol = proto;
return err;
}
-
-
# Configure thread packages.
thread_modules=""
-@HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread"
+# For compatibility we keep proving the
+# thread modules variable.
+thread_modules="$thread_modules pthread"
libs_pthread="-lpthread"
cflags_pthread=""
cat <<EOF
Usage: gpgme-config [OPTIONS]
Options:
- --thread={${thread_modules}}]
--prefix
--exec-prefix
--version
result=
tmp_x=
case "$thread_module" in
- pthread) tmp_l="-lgpgme-pthread"; tmp_x="$libs_pthread" ;;
+ # deprecated
+ pthread) tmp_l="-lgpgme" ;;
*)
if test "x$with_glib" = "xyes" ; then
tmp_l="-lgpgme-glib"
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#include "debug.h"
#include "priv-io.h"
#include "sys-util.h"
+#include "mbox-util.h"
\f
/* The default locale. */
}
-/* Set the flag NAME for CTX to VALUE. The supported flags are:
- *
- * - full-status :: With a value of "1" the status callback set by
- * gpgme_set_status_cb returns all status lines
- * except for PROGRESS lines. With the default of
- * "0" the status callback is only called in certain
- * situations.
- */
-gpgme_error_t
-gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value)
-{
- int abool;
-
- if (!ctx || !name || !value)
- return gpg_error (GPG_ERR_INV_VALUE);
-
- abool = *value? !!atoi (value) : 0;
-
- if (!strcmp (name, "full-status"))
- {
- ctx->full_status = abool;
- }
- else if (!strcmp (name, "raw-description"))
- {
- ctx->raw_description = abool;
- }
- else
- return gpg_error (GPG_ERR_UNKNOWN_NAME);
-
- return 0;
-}
-
-
\f
/* Create a new context as an environment for GPGME crypto
operations. */
_gpgme_release_result (ctx);
_gpgme_signers_clear (ctx);
_gpgme_sig_notation_clear (ctx);
- if (ctx->signers)
- free (ctx->signers);
- if (ctx->lc_ctype)
- free (ctx->lc_ctype);
- if (ctx->lc_messages)
- free (ctx->lc_messages);
+ free (ctx->sender);
+ free (ctx->signers);
+ free (ctx->lc_ctype);
+ free (ctx->lc_messages);
+ free (ctx->override_session_key);
_gpgme_engine_info_release (ctx->engine_info);
ctx->engine_info = NULL;
DESTROY_LOCK (ctx->lock);
}
}
+
+/* Store the sender's address in the context. ADDRESS is addr-spec of
+ * mailbox but my also be a complete mailbox, in which case this
+ * function extracts the addr-spec from it. Returns 0 on success or
+ * an error code if no valid addr-spec could be extracted from
+ * ADDRESS. */
+gpgme_error_t
+gpgme_set_sender (gpgme_ctx_t ctx, const char *address)
+{
+ char *p = NULL;
+
+ TRACE_BEG1 (DEBUG_CTX, "gpgme_set_sender", ctx, "sender='%s'",
+ address?address:"(null)");
+
+ if (!ctx || (address && !(p = _gpgme_mailbox_from_userid (address))))
+ return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
+
+ free (ctx->sender);
+ ctx->sender = p;
+ return TRACE_ERR (0);
+}
+
+
+/* Return the sender's address (addr-spec part) from the context or
+ * NULL if none was set. The returned value is valid as long as the
+ * CTX is valid and gpgme_set_sender has not been used. */
+const char *
+gpgme_get_sender (gpgme_ctx_t ctx)
+{
+ TRACE1 (DEBUG_CTX, "gpgme_get_sender", ctx, "sender='%s'",
+ ctx?ctx->sender:"");
+
+ return ctx->sender;
+}
+
+
/* Enable or disable the use of an ascii armor for all output. */
void
gpgme_set_armor (gpgme_ctx_t ctx, int use_armor)
if (!ctx)
return;
- ctx->use_armor = use_armor;
+ ctx->use_armor = !!use_armor;
}
}
+/* Set the flag NAME for CTX to VALUE. The supported flags are:
+ *
+ * - full-status :: With a value of "1" the status callback set by
+ * gpgme_set_status_cb returns all status lines
+ * except for PROGRESS lines. With the default of
+ * "0" the status callback is only called in certain
+ * situations.
+ */
+gpgme_error_t
+gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value)
+{
+ gpgme_error_t err = 0;
+ int abool;
+
+ TRACE2 (DEBUG_CTX, "gpgme_set_ctx_flag", ctx,
+ "name='%s' value='%s'",
+ name? name:"(null)", value?value:"(null)");
+
+ abool = (value && *value)? !!atoi (value) : 0;
+
+ if (!ctx || !name || !value)
+ err = gpg_error (GPG_ERR_INV_VALUE);
+ else if (!strcmp (name, "full-status"))
+ {
+ ctx->full_status = abool;
+ }
+ else if (!strcmp (name, "raw-description"))
+ {
+ ctx->raw_description = abool;
+ }
+ else if (!strcmp (name, "export-session-key"))
+ {
+ ctx->export_session_keys = abool;
+ }
+ else if (!strcmp (name, "override-session-key"))
+ {
+ free (ctx->override_session_key);
+ ctx->override_session_key = strdup (value);
+ if (!ctx->override_session_key)
+ err = gpg_error_from_syserror ();
+ }
+ else
+ err = gpg_error (GPG_ERR_UNKNOWN_NAME);
+
+ return err;
+}
+
+
+/* Get the context flag named NAME. See gpgme_set_ctx_flag for a list
+ * of valid names. If the NAME is unknown NULL is returned. For a
+ * boolean flag an empty string is returned for False and the string
+ * "1" for True; thus either atoi or a simple string test can be
+ * used. */
+const char *
+gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name)
+{
+ if (!ctx || !name)
+ return NULL;
+ else if (!strcmp (name, "full-status"))
+ {
+ return ctx->full_status? "1":"";
+ }
+ else if (!strcmp (name, "raw-description"))
+ {
+ return ctx->raw_description? "1":"";
+ }
+ else if (!strcmp (name, "export-session-key"))
+ {
+ return ctx->export_session_keys? "1":"";
+ }
+ else if (!strcmp (name, "override-session-key"))
+ {
+ return ctx->override_session_key? ctx->override_session_key : "";
+ }
+ else
+ return NULL;
+}
+
+
/* Enable or disable the use of the special textmode. Textmode is for
example used for the RFC2015 signatures; note that the updated RFC
3156 mandates that the MUA does some preparations so that textmode
if (!ctx)
return;
- ctx->use_textmode = use_textmode;
+ ctx->use_textmode = !!use_textmode;
}
/* Return the state of the textmode flag. */
if (!ctx)
return;
- ctx->offline = offline;
+ ctx->offline = !!offline;
}
/* Return the state of the offline flag. */
gpgme_addrspec_from_uid @186
+ gpgme_set_sender @187
+ gpgme_get_sender @188
+
+ gpgme_op_query_swdb @189
+ gpgme_op_query_swdb_result @190
+
+ gpgme_get_ctx_flag @191
; END
gpgme_error_t gpgme_set_ctx_flag (gpgme_ctx_t ctx,
const char *name, const char *value);
+/* Get the value of the flag NAME from CTX. */
+const char *gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name);
+
/* Set the protocol to be used by CTX to PROTO. */
gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto);
/* Get the sig notations for this context. */
gpgme_sig_notation_t gpgme_sig_notation_get (gpgme_ctx_t ctx);
+/* Store a sender address in the context. */
+gpgme_error_t gpgme_set_sender (gpgme_ctx_t ctx, const char *address);
+
+/* Get the sender address from the context. */
+const char *gpgme_get_sender (gpgme_ctx_t ctx);
+
\f
/*
/* The original file name of the plaintext message, if
available. */
char *file_name;
+
+ /* A textual representation of the session key used to decrypt the
+ * message, if available */
+ char *session_key;
};
typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t;
gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp);
+/* Information about software versions. */
+typedef struct _gpgme_op_query_swdb_result
+{
+ /* RFU */
+ struct _gpgme_op_query_swdb_result *next;
+
+ /* The name of the package (e.g. "gpgme", "gnupg") */
+ char *name;
+
+ /* The version number of the installed version. */
+ char *iversion;
+
+ /* The time the online info was created. */
+ unsigned long created;
+
+ /* The time the online info was retrieved. */
+ unsigned long retrieved;
+
+ /* This bit is set if an error occured or some of the information
+ * in this structure may not be set. */
+ unsigned int warning : 1;
+
+ /* An update is available. */
+ unsigned int update : 1;
+
+ /* The update is important. */
+ unsigned int urgent : 1;
+
+ /* No information at all available. */
+ unsigned int noinfo : 1;
+
+ /* The package name is not known. */
+ unsigned int unknown : 1;
+
+ /* The information here is too old. */
+ unsigned int tooold : 1;
+
+ /* Other error. */
+ unsigned int error : 1;
+
+ unsigned int _reserved : 25;
+
+ /* The version number of the latest released version. */
+ char *version;
+
+ /* The release date of that version. */
+ unsigned long reldate;
+
+} *gpgme_query_swdb_result_t;
+
+
+/* Run the gpgconf --query-swdb command. */
+gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t ctx,
+ const char *name, const char *iversion,
+ unsigned int reserved);
+
+/* Return the result from the last query_swdb operation. */
+gpgme_query_swdb_result_t gpgme_op_query_swdb_result (gpgme_ctx_t ctx);
+
+
+
\f
/*
* Various functions.
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
{
struct _gpgme_op_keylist_result result;
+ /* The error code from ERROR keydb_search. */
+ gpgme_error_t keydb_search_err;
+
gpgme_key_t tmp_key;
/* This points to the last uid in tmp_key. */
opd->result.truncated = 1;
break;
+ case GPGME_STATUS_ERROR:
+ err = _gpgme_parse_failure (args);
+ if (!opd->keydb_search_err && !strcmp (args, "keydb_search"))
+ opd->keydb_search_err = err;
+ err = 0;
+ break;
+
default:
break;
}
- return 0;
+ return err;
}
\f
return TRACE_ERR (err);
if (!opd->key_cond)
- return TRACE_ERR (gpg_error (GPG_ERR_EOF));
+ return TRACE_ERR (opd->keydb_search_err? opd->keydb_search_err
+ /**/ : gpg_error (GPG_ERR_EOF));
opd->key_cond = 0;
assert (opd->key_queue);
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
gpgme_pubkey_algo_string;
gpgme_set_ctx_flag;
+ gpgme_get_ctx_flag;
gpgme_data_set_flag;
gpgme_op_createkey_start;
gpgme_op_interact;
gpgme_addrspec_from_uid;
+
+ gpgme_set_sender;
+ gpgme_get_sender;
+
+ gpgme_op_query_swdb;
+ gpgme_op_query_swdb_result;
};
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* NB: This code has been taken from GnuPG. Please keep it in sync
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifndef GNUPG_COMMON_MBOX_UTIL_H
#define GNUPG_COMMON_MBOX_UTIL_H
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifndef PARSETLV_H
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
if (fds[i].fd >= FD_SETSIZE)
{
TRACE_END (dbg_help, " -BAD- ]");
- gpg_err_set_errno (EBADF);
+ gpg_err_set_errno (EMFILE);
return TRACE_SYSRES (-1);
}
assert (!FD_ISSET (fds[i].fd, &readfds));
if (fds[i].fd >= FD_SETSIZE)
{
TRACE_END (dbg_help, " -BAD- ]");
- gpg_err_set_errno (EBADF);
+ gpg_err_set_errno (EMFILE);
return TRACE_SYSRES (-1);
}
assert (!FD_ISSET (fds[i].fd, &writefds));
+++ /dev/null
-/* posix-sema.c
- Copyright (C) 2001 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2004, 2007 g10 Code GmbH
-
- This file is part of GPGME.
-
- GPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- GPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <signal.h>
-#include <fcntl.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#include "util.h"
-#include "sema.h"
-#include "ath.h"
-
-void
-_gpgme_sema_subsystem_init ()
-{
-}
-
-void
-_gpgme_sema_cs_enter (struct critsect_s *s)
-{
- _gpgme_ath_mutex_lock (&s->priv);
-}
-
-void
-_gpgme_sema_cs_leave (struct critsect_s *s)
-{
- _gpgme_ath_mutex_unlock (&s->priv);
-}
-
-void
-_gpgme_sema_cs_destroy (struct critsect_s *s)
-{
- _gpgme_ath_mutex_destroy (&s->priv);
- s->priv = NULL;
-}
--- /dev/null
+/* queryswdb.c - Access to the SWDB file
+ * Copyright (C) 2016 g10 Code GmbH
+ *
+ * This file is part of GPGME.
+ *
+ * GPGME is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * GPGME is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdlib.h>
+#include <assert.h>
+
+#include "gpgme.h"
+#include "debug.h"
+#include "context.h"
+#include "ops.h"
+
+
+typedef struct
+{
+ struct _gpgme_op_query_swdb_result result;
+
+} *op_data_t;
+
+
+\f
+static void
+release_op_data (void *hook)
+{
+ op_data_t opd = (op_data_t) hook;
+ gpgme_query_swdb_result_t result = &opd->result;
+
+ assert (!result->next);
+ free (result->name);
+ free (result->iversion);
+ free (result->version);
+}
+
+
+gpgme_query_swdb_result_t
+gpgme_op_query_swdb_result (gpgme_ctx_t ctx)
+{
+ void *hook;
+ op_data_t opd;
+ gpgme_error_t err;
+
+ TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb_result", ctx);
+
+ err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook, -1, NULL);
+ opd = hook;
+
+ if (err || !opd)
+ {
+ TRACE_SUC0 ("result=(null)");
+ return NULL;
+ }
+
+ TRACE_SUC1 ("result=%p", &opd->result);
+ return &opd->result;
+}
+
+
+
+/* Query the swdb for software package NAME and check against the
+ * installed version given by IVERSION. If IVERSION is NULL a check
+ * is only done if GPGME can figure out the version by itself
+ * (e.g. for "gpgme" or "gnupg"). RESERVED should be 0.
+ *
+ * Note that we only implemented the synchronous variant of this
+ * function but the API is prepared for an asynchronous variant.
+ */
+gpgme_error_t
+gpgme_op_query_swdb (gpgme_ctx_t ctx, const char *name, const char *iversion,
+ unsigned int reserved)
+{
+ gpgme_error_t err;
+ void *hook;
+ op_data_t opd;
+
+ TRACE_BEG2 (DEBUG_CTX, "gpgme_op_query_swdb", ctx,
+ "name=%s, iversion=%a", name, iversion);
+
+ if (!ctx || reserved)
+ return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
+
+ if (ctx->protocol != GPGME_PROTOCOL_GPGCONF)
+ return TRACE_ERR (gpg_error (GPG_ERR_UNSUPPORTED_PROTOCOL));
+
+ if (!name)
+ name = "gpgme";
+
+ if (!iversion && !strcmp (name, "gpgme"))
+ iversion = VERSION;
+
+ err = _gpgme_op_reset (ctx, 1);
+ if (err)
+ return err;
+
+ err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook,
+ sizeof (*opd), release_op_data);
+ opd = hook;
+ if (err)
+ return TRACE_ERR (err);
+
+ err = _gpgme_engine_op_query_swdb (ctx->engine, name, iversion,
+ &opd->result);
+ return TRACE_ERR (err);
+}
#ifndef SEMA_H
#define SEMA_H
-struct critsect_s
-{
- const char *name;
- void *priv;
-};
+#include <gpg-error.h>
#define DEFINE_GLOBAL_LOCK(name) \
- struct critsect_s name = { #name, NULL }
+ gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER
+
#define DEFINE_STATIC_LOCK(name) \
- static struct critsect_s name = { #name, NULL }
+ static gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER
-#define DECLARE_LOCK(name) \
- struct critsect_s name
-#define INIT_LOCK(a) \
- do \
- { \
- (a).name = #a; \
- (a).priv = NULL; \
- } \
- while (0)
-#define DESTROY_LOCK(name) _gpgme_sema_cs_destroy (&(name))
+#define INIT_LOCK(name) \
+ name = (gpgrt_lock_t) GPGRT_LOCK_INITIALIZER
+#define DECLARE_LOCK(name) gpgrt_lock_t name
-#define LOCK(name) \
- do \
- { \
- _gpgme_sema_cs_enter (&(name)); \
- } \
- while (0)
+#define DESTROY_LOCK(name) gpgrt_lock_destroy(&name)
-#define UNLOCK(name) \
- do \
- { \
- _gpgme_sema_cs_leave (&(name)); \
- } \
- while (0)
+#define LOCK(name) gpgrt_lock_lock(&name)
-void _gpgme_sema_subsystem_init (void);
-void _gpgme_sema_cs_enter (struct critsect_s *s);
-void _gpgme_sema_cs_leave (struct critsect_s *s);
-void _gpgme_sema_cs_destroy (struct critsect_s *s);
+#define UNLOCK(name) gpgrt_lock_unlock(&name)
#endif /* SEMA_H */
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SYS_UTIL_H
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
# define GPG_ERR_FALSE 256
#endif
+#if GPG_ERROR_VERSION_NUMBER < 0x011900 /* 1.25 */
+# define GPG_ERR_ENGINE_TOO_OLD 300
+# define GPG_ERR_TOO_OLD 308
+#endif
+
#ifndef GPGRT_ATTR_SENTINEL
# define GPGRT_ATTR_SENTINEL(a) /* */
#endif
if (!sig)
return gpg_error (GPG_ERR_NO_DATA);
- return _gpgme_engine_op_verify (ctx->engine, sig, signed_text, plaintext);
+ return _gpgme_engine_op_verify (ctx->engine, sig, signed_text, plaintext,
+ ctx);
}
}
#endif
- _gpgme_sema_subsystem_init ();
_gpgme_debug_subsystem_init ();
_gpgme_io_subsystem_init ();
_gpgme_status_init ();
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
duplicates works just fine. */
int dup_from;
} fd_table[MAX_SLAFD];
+DEFINE_STATIC_LOCK (fd_table_lock);
/* Returns the FD or -1 on resource limit. */
{
int idx;
+ LOCK (fd_table_lock);
+
for (idx = 0; idx < MAX_SLAFD; idx++)
if (! fd_table[idx].used)
break;
if (idx == MAX_SLAFD)
{
gpg_err_set_errno (EIO);
- return -1;
+ idx = -1;
+ }
+ else
+ {
+ fd_table[idx].used = 1;
+ fd_table[idx].handle = INVALID_HANDLE_VALUE;
+ fd_table[idx].socket = INVALID_SOCKET;
+ fd_table[idx].rvid = 0;
+ fd_table[idx].dup_from = -1;
}
- fd_table[idx].used = 1;
- fd_table[idx].handle = INVALID_HANDLE_VALUE;
- fd_table[idx].socket = INVALID_SOCKET;
- fd_table[idx].rvid = 0;
- fd_table[idx].dup_from = -1;
+ UNLOCK (fd_table_lock);
return idx;
}
void
release_fd (int fd)
{
- if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used)
+ if (fd < 0 || fd >= MAX_SLAFD)
return;
- fd_table[fd].used = 0;
- fd_table[fd].handle = INVALID_HANDLE_VALUE;
- fd_table[fd].socket = INVALID_SOCKET;
- fd_table[fd].rvid = 0;
- fd_table[fd].dup_from = -1;
+ LOCK (fd_table_lock);
+
+ if (fd_table[fd].used)
+ {
+ fd_table[fd].used = 0;
+ fd_table[fd].handle = INVALID_HANDLE_VALUE;
+ fd_table[fd].socket = INVALID_SOCKET;
+ fd_table[fd].rvid = 0;
+ fd_table[fd].dup_from = -1;
+ }
+
+ UNLOCK (fd_table_lock);
}
+++ /dev/null
-/* w32-sema.c
- Copyright (C) 2001 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2004, 2007 g10 Code GmbH
-
- This file is part of GPGME.
-
- GPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- GPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#include <io.h>
-
-#include "util.h"
-#include "sema.h"
-#include "debug.h"
-
-static void
-sema_fatal (const char *text)
-{
- fprintf (stderr, "sema.c: %s\n", text);
- abort ();
-}
-
-
-static void
-critsect_init (struct critsect_s *s)
-{
- CRITICAL_SECTION *mp;
- static CRITICAL_SECTION init_lock;
- static int initialized;
-
- if (!initialized) {
- /* The very first time we call this function, we assume that
- only one thread is running, so that we can bootstrap the
- semaphore code. */
- InitializeCriticalSection (&init_lock);
- initialized = 1;
- }
- if (!s)
- return; /* we just want to initialize ourself */
-
- /* first test whether it is really not initialized */
- EnterCriticalSection (&init_lock);
- if ( s->priv ) {
- LeaveCriticalSection (&init_lock);
- return;
- }
- /* now init it */
- mp = malloc ( sizeof *mp );
- if (!mp) {
- LeaveCriticalSection (&init_lock);
- sema_fatal ("out of core while creating critical section lock");
- }
- InitializeCriticalSection (mp);
- s->priv = mp;
- LeaveCriticalSection (&init_lock);
-}
-
-void
-_gpgme_sema_subsystem_init ()
-{
- /* fixme: we should check that there is only one thread running */
- critsect_init (NULL);
-}
-
-
-void
-_gpgme_sema_cs_enter ( struct critsect_s *s )
-{
- if (!s->priv)
- critsect_init (s);
- EnterCriticalSection ( (CRITICAL_SECTION*)s->priv );
-}
-
-void
-_gpgme_sema_cs_leave (struct critsect_s *s)
-{
- if (!s->priv)
- critsect_init (s);
- LeaveCriticalSection ((CRITICAL_SECTION*)s->priv);
-}
-
-void
-_gpgme_sema_cs_destroy ( struct critsect_s *s )
-{
- if (s && s->priv) {
- DeleteCriticalSection ((CRITICAL_SECTION*)s->priv);
- free (s->priv);
- s->priv = NULL;
- }
-}
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
**/
#ifdef HAVE_CONFIG_H
We First try the generic place and then fallback to the x86
(i.e. 32 bit) place. This will prefer a 64 bit of the program
over a 32 bit version on 64 bit Windows if installed. */
- if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0)
- || SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0))
+ if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0))
+ {
+ result = _gpgme_strconcat (path, "\\", name, NULL);
+ if (result && access (result, F_OK))
+ {
+ free (result);
+ result = NULL;
+ }
+ }
+ if (!result
+ && SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0))
{
result = _gpgme_strconcat (path, "\\", name, NULL);
if (result && access (result, F_OK))
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+# License along with this program; if not, see <https://www.gnu.org/licenses/>.
## Process this file with automake to produce Makefile.in
noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \
run-verify run-encrypt run-identify run-decrypt run-genkey \
- run-keysign run-tofu
+ run-keysign run-tofu run-swdb
if RUN_GPG_TESTS
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+# License along with this program; if not, see <https://www.gnu.org/licenses/>.
VPATH = @srcdir@
run-export$(EXEEXT) run-import$(EXEEXT) run-sign$(EXEEXT) \
run-verify$(EXEEXT) run-encrypt$(EXEEXT) run-identify$(EXEEXT) \
run-decrypt$(EXEEXT) run-genkey$(EXEEXT) run-keysign$(EXEEXT) \
- run-tofu$(EXEEXT)
+ run-tofu$(EXEEXT) run-swdb$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
run_sign_OBJECTS = run-sign.$(OBJEXT)
run_sign_LDADD = $(LDADD)
run_sign_DEPENDENCIES = ../src/libgpgme.la
+run_swdb_SOURCES = run-swdb.c
+run_swdb_OBJECTS = run-swdb.$(OBJEXT)
+run_swdb_LDADD = $(LDADD)
+run_swdb_DEPENDENCIES = ../src/libgpgme.la
run_tofu_SOURCES = run-tofu.c
run_tofu_OBJECTS = run-tofu.$(OBJEXT)
run_tofu_LDADD = $(LDADD)
am__v_CCLD_1 =
SOURCES = run-decrypt.c run-encrypt.c run-export.c run-genkey.c \
run-identify.c run-import.c run-keylist.c run-keysign.c \
- run-sign.c run-tofu.c run-verify.c t-data.c t-engine-info.c \
- t-version.c
+ run-sign.c run-swdb.c run-tofu.c run-verify.c t-data.c \
+ t-engine-info.c t-version.c
DIST_SOURCES = run-decrypt.c run-encrypt.c run-export.c run-genkey.c \
run-identify.c run-import.c run-keylist.c run-keysign.c \
- run-sign.c run-tofu.c run-verify.c t-data.c t-engine-info.c \
- t-version.c
+ run-sign.c run-swdb.c run-tofu.c run-verify.c t-data.c \
+ t-engine-info.c t-version.c
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@rm -f run-sign$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_sign_OBJECTS) $(run_sign_LDADD) $(LIBS)
+run-swdb$(EXEEXT): $(run_swdb_OBJECTS) $(run_swdb_DEPENDENCIES) $(EXTRA_run_swdb_DEPENDENCIES)
+ @rm -f run-swdb$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(run_swdb_OBJECTS) $(run_swdb_LDADD) $(LIBS)
+
run-tofu$(EXEEXT): $(run_tofu_OBJECTS) $(run_tofu_DEPENDENCIES) $(EXTRA_run_tofu_DEPENDENCIES)
@rm -f run-tofu$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(run_tofu_OBJECTS) $(run_tofu_LDADD) $(LIBS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keylist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keysign.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-sign.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-swdb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-tofu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-verify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-data.Po@am__quote@
t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
- t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix)
+ t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) \
+ t-thread-keylist t-thread-keylist-verify
TESTS = initial.test $(c_tests) final.test
AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
AM_LDFLAGS = -no-install
LDADD = ../../src/libgpgme.la
-t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
-t_cancel_LDADD = ../../src/libgpgme-pthread.la -lpthread
+t_thread1_LDADD = ../../src/libgpgme.la -lpthread
+t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread
+t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread
+t_cancel_LDADD = ../../src/libgpgme.la -lpthread
# We don't run t-genkey and t-cancel in the test suite, because it
# takes too long
export GPG_AGENT_INFO :=
./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
for k in $(private_keys); do \
cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
done
t-trustlist$(EXEEXT) t-edit$(EXEEXT) t-keylist$(EXEEXT) \
t-keylist-sig$(EXEEXT) t-wait$(EXEEXT) \
t-encrypt-large$(EXEEXT) t-file-name$(EXEEXT) \
- t-gpgconf$(EXEEXT) t-encrypt-mixed$(EXEEXT) $(am__EXEEXT_1)
+ t-gpgconf$(EXEEXT) t-encrypt-mixed$(EXEEXT) $(am__EXEEXT_1) \
+ t-thread-keylist$(EXEEXT) t-thread-keylist-verify$(EXEEXT)
@HAVE_W32_SYSTEM_FALSE@am__EXEEXT_3 = t-cancel$(EXEEXT)
am__EXEEXT_4 = t-genkey$(EXEEXT) $(am__EXEEXT_3)
PROGRAMS = $(noinst_PROGRAMS)
t_cancel_SOURCES = t-cancel.c
t_cancel_OBJECTS = t-cancel.$(OBJEXT)
-t_cancel_DEPENDENCIES = ../../src/libgpgme-pthread.la
+t_cancel_DEPENDENCIES = ../../src/libgpgme.la
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
t_signers_OBJECTS = t-signers.$(OBJEXT)
t_signers_LDADD = $(LDADD)
t_signers_DEPENDENCIES = ../../src/libgpgme.la
+t_thread_keylist_SOURCES = t-thread-keylist.c
+t_thread_keylist_OBJECTS = t-thread-keylist.$(OBJEXT)
+t_thread_keylist_DEPENDENCIES = ../../src/libgpgme.la
+t_thread_keylist_verify_SOURCES = t-thread-keylist-verify.c
+t_thread_keylist_verify_OBJECTS = t-thread-keylist-verify.$(OBJEXT)
+t_thread_keylist_verify_DEPENDENCIES = ../../src/libgpgme.la
t_thread1_SOURCES = t-thread1.c
t_thread1_OBJECTS = t-thread1.$(OBJEXT)
-t_thread1_DEPENDENCIES = ../../src/libgpgme-pthread.la
+t_thread1_DEPENDENCIES = ../../src/libgpgme.la
t_trustlist_SOURCES = t-trustlist.c
t_trustlist_OBJECTS = t-trustlist.$(OBJEXT)
t_trustlist_LDADD = $(LDADD)
t-encrypt-sign.c t-encrypt-sym.c t-eventloop.c t-export.c \
t-file-name.c t-genkey.c t-gpgconf.c t-import.c t-keylist.c \
t-keylist-sig.c t-sig-notation.c t-sign.c t-signers.c \
- t-thread1.c t-trustlist.c t-verify.c t-wait.c
+ t-thread-keylist.c t-thread-keylist-verify.c t-thread1.c \
+ t-trustlist.c t-verify.c t-wait.c
DIST_SOURCES = t-cancel.c t-decrypt.c t-decrypt-verify.c t-edit.c \
t-encrypt.c t-encrypt-large.c t-encrypt-mixed.c \
t-encrypt-sign.c t-encrypt-sym.c t-eventloop.c t-export.c \
t-file-name.c t-genkey.c t-gpgconf.c t-import.c t-keylist.c \
t-keylist-sig.c t-sig-notation.c t-sign.c t-signers.c \
- t-thread1.c t-trustlist.c t-verify.c t-wait.c
+ t-thread-keylist.c t-thread-keylist-verify.c t-thread1.c \
+ t-trustlist.c t-verify.c t-wait.c
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \
t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \
- t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix)
+ t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) \
+ t-thread-keylist t-thread-keylist-verify
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@
AM_LDFLAGS = -no-install
LDADD = ../../src/libgpgme.la
-t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
-t_cancel_LDADD = ../../src/libgpgme-pthread.la -lpthread
+t_thread1_LDADD = ../../src/libgpgme.la -lpthread
+t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread
+t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread
+t_cancel_LDADD = ../../src/libgpgme.la -lpthread
# We don't run t-genkey and t-cancel in the test suite, because it
# takes too long
@rm -f t-signers$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(t_signers_OBJECTS) $(t_signers_LDADD) $(LIBS)
+t-thread-keylist$(EXEEXT): $(t_thread_keylist_OBJECTS) $(t_thread_keylist_DEPENDENCIES) $(EXTRA_t_thread_keylist_DEPENDENCIES)
+ @rm -f t-thread-keylist$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_thread_keylist_OBJECTS) $(t_thread_keylist_LDADD) $(LIBS)
+
+t-thread-keylist-verify$(EXEEXT): $(t_thread_keylist_verify_OBJECTS) $(t_thread_keylist_verify_DEPENDENCIES) $(EXTRA_t_thread_keylist_verify_DEPENDENCIES)
+ @rm -f t-thread-keylist-verify$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(t_thread_keylist_verify_OBJECTS) $(t_thread_keylist_verify_LDADD) $(LIBS)
+
t-thread1$(EXEEXT): $(t_thread1_OBJECTS) $(t_thread1_DEPENDENCIES) $(EXTRA_t_thread1_DEPENDENCIES)
@rm -f t-thread1$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(t_thread1_OBJECTS) $(t_thread1_LDADD) $(LIBS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sig-notation.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-sign.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-signers.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread-keylist-verify.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread-keylist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-thread1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-trustlist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@
export GPG_AGENT_INFO :=
./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
for k in $(private_keys); do \
cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
done
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
--- /dev/null
+/* t-thread-verify.c - Regression test.
+ Copyright (C) 2015 Intevation GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+#include <pthread.h>
+
+#include "t-support.h"
+
+#define THREAD_COUNT 100
+
+static const char test_text1[] = "Just GNU it!\n";
+static const char test_sig1[] =
+"-----BEGIN PGP SIGNATURE-----\n"
+"\n"
+"iN0EABECAJ0FAjoS+i9FFIAAAAAAAwA5YmFyw7bDpMO8w58gZGFzIHdhcmVuIFVt\n"
+"bGF1dGUgdW5kIGpldHp0IGVpbiBwcm96ZW50JS1aZWljaGVuNRSAAAAAAAgAJGZv\n"
+"b2Jhci4xdGhpcyBpcyBhIG5vdGF0aW9uIGRhdGEgd2l0aCAyIGxpbmVzGhpodHRw\n"
+"Oi8vd3d3Lmd1Lm9yZy9wb2xpY3kvAAoJEC1yfMdoaXc0JBIAoIiLlUsvpMDOyGEc\n"
+"dADGKXF/Hcb+AKCJWPphZCphduxSvrzH0hgzHdeQaA==\n"
+"=nts1\n"
+"-----END PGP SIGNATURE-----\n";
+
+void *
+start_keylist (void *arg)
+{
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_key_t key;
+
+ (void)arg;
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+
+ err = gpgme_op_keylist_start (ctx, NULL, 0);
+ fail_if_err (err);
+
+ while (!(err = gpgme_op_keylist_next (ctx, &key)))
+ {
+ gpgme_key_unref (key);
+ }
+
+ gpgme_release (ctx);
+ return NULL;
+}
+
+void *
+start_verify (void *arg)
+{
+ gpgme_ctx_t ctx;
+ gpgme_error_t err;
+ gpgme_data_t sig, text;
+ gpgme_verify_result_t result;
+ gpgme_signature_t signature;
+
+ (void)arg;
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+
+ /* Checking a valid message. */
+ err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0);
+ fail_if_err (err);
+ err = gpgme_data_new_from_mem (&sig, test_sig1, strlen (test_sig1), 0);
+ fail_if_err (err);
+ err = gpgme_op_verify (ctx, sig, text, NULL);
+ fail_if_err (err);
+ result = gpgme_op_verify_result (ctx);
+
+ signature = result->signatures;
+
+ if (strcmp (signature->fpr, "A0FF4590BB6122EDEF6E3C542D727CC768697734"))
+ {
+ fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n",
+ __FILE__, __LINE__, signature->fpr);
+ exit (1);
+ }
+ if (gpgme_err_code (signature->status) != GPG_ERR_NO_ERROR)
+ {
+ fprintf (stderr, "%s:%i: Unexpected signature status: %s\n",
+ __FILE__, __LINE__, gpgme_strerror (signature->status));
+ exit (1);
+ }
+ gpgme_free (text);
+ gpgme_free (sig);
+ gpgme_release (ctx);
+ return NULL;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+ pthread_t verify_threads[THREAD_COUNT];
+ pthread_t keylist_threads[THREAD_COUNT];
+ init_gpgme (GPGME_PROTOCOL_OpenPGP);
+
+ (void)argc;
+ (void)argv;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ if (pthread_create(&verify_threads[i], NULL, start_verify, NULL) ||
+ pthread_create(&keylist_threads[i], NULL, start_keylist, NULL))
+ {
+ fprintf(stderr, "%s:%i: failed to create threads \n",
+ __FILE__, __LINE__);
+ exit(1);
+ }
+ }
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ pthread_join (verify_threads[i], NULL);
+ pthread_join (keylist_threads[i], NULL);
+ }
+ return 0;
+}
--- /dev/null
+/* t-thread-verify.c - Regression test.
+ Copyright (C) 2015 Intevation GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <gpgme.h>
+
+#include <pthread.h>
+
+#include "t-support.h"
+
+#define THREAD_COUNT 100
+
+void *
+start_keylist (void *arg)
+{
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_key_t key;
+
+ (void) arg;
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+
+ err = gpgme_op_keylist_start (ctx, NULL, 0);
+ fail_if_err (err);
+
+ while (!(err = gpgme_op_keylist_next (ctx, &key)))
+ {
+ gpgme_key_unref (key);
+ }
+
+ gpgme_release (ctx);
+
+ return NULL;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+ pthread_t keylist_threads[THREAD_COUNT];
+ init_gpgme (GPGME_PROTOCOL_OpenPGP);
+
+ (void)argc;
+ (void)argv;
+
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ if (pthread_create(&keylist_threads[i], NULL, start_keylist, NULL))
+ {
+ fprintf(stderr, "%s:%i: failed to create threads \n",
+ __FILE__, __LINE__);
+ exit(1);
+ }
+ }
+ for (i = 0; i < THREAD_COUNT; i++)
+ {
+ pthread_join (keylist_threads[i], NULL);
+ }
+ return 0;
+}
gpgme_error_t err;
gpgme_data_t sig, text;
gpgme_verify_result_t result;
+ const char *s;
(void)argc;
(void)argv;
exit (1);
}
+ /* Checking that set/get_sernder works. */
+ err = gpgme_set_sender (ctx, "foo@example.org");
+ fail_if_err (err);
+ s = gpgme_get_sender (ctx);
+ if (!s || strcmp (s, "foo@example.org"))
+ {
+ fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+
+ err = gpgme_set_sender (ctx, "<bar@example.org>");
+ fail_if_err (err);
+ s = gpgme_get_sender (ctx);
+ if (!s || strcmp (s, "bar@example.org"))
+ {
+ fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+
+ err = gpgme_set_sender (ctx, "Foo bar (comment) <foo@example.org>");
+ fail_if_err (err);
+ s = gpgme_get_sender (ctx);
+ if (!s || strcmp (s, "foo@example.org"))
+ {
+ fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+
+ err = gpgme_set_sender (ctx, "foo");
+ if (gpgme_err_code (err) != GPG_ERR_INV_VALUE)
+ {
+ fprintf (stderr, "%s:%i: gpgme_set_sender didn't detect bogus address\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+ /* (the former address should still be there.) */
+ s = gpgme_get_sender (ctx);
+ if (!s || strcmp (s, "foo@example.org"))
+ {
+ fprintf (stderr, "%s:%i: gpgme_{set,get}_sender mismatch\n",
+ __FILE__, __LINE__);
+ exit (1);
+ }
+
+
gpgme_data_release (sig);
gpgme_data_release (text);
gpgme_release (ctx);
echo faked-system-time 1008241200 >> ./gpgsm.conf
./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key
./trustlist.txt:
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
echo faked-system-time 1008241200 >> ./gpgsm.conf
./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key
./trustlist.txt:
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
{
gpgme_recipient_t recp;
int count = 0;
+
printf ("Original file name: %s\n", nonnull(result->file_name));
printf ("Wrong key usage: %i\n", result->wrong_key_usage);
- printf ("Unsupported algorithm: %s\n ", nonnull(result->unsupported_algorithm));
+ printf ("Unsupported algorithm: %s\n",
+ nonnull(result->unsupported_algorithm));
+ if (result->session_key)
+ printf ("Session key: %s\n", result->session_key);
for (recp = result->recipients; recp->next; recp = recp->next)
{
" --status print status lines from the backend\n"
" --openpgp use the OpenPGP protocol (default)\n"
" --cms use the CMS protocol\n"
+ " --export-session-key show the session key\n"
+ " --override-session-key STRING use STRING as session key\n"
, stderr);
exit (ex);
}
gpgme_data_t out = NULL;
gpgme_decrypt_result_t result;
int print_status = 0;
+ int export_session_key = 0;
+ const char *override_session_key = NULL;
if (argc)
{ argc--; argv++; }
protocol = GPGME_PROTOCOL_CMS;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--export-session-key"))
+ {
+ export_session_key = 1;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--override-session-key"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ override_session_key = *argv;
+ argc--; argv++;
+ }
else if (!strncmp (*argv, "--", 2))
show_usage (1);
gpgme_set_status_cb (ctx, status_cb, NULL);
gpgme_set_ctx_flag (ctx, "full-status", "1");
}
+ if (export_session_key)
+ {
+ err = gpgme_set_ctx_flag (ctx, "export-session-key", "1");
+ if (err)
+ {
+ fprintf (stderr, PGM ": error requesting exported session key: %s\n",
+ gpgme_strerror (err));
+ exit (1);
+ }
+ }
+ if (override_session_key)
+ {
+ err = gpgme_set_ctx_flag (ctx, "override-session-key",
+ override_session_key);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error overriding session key: %s\n",
+ gpgme_strerror (err));
+ exit (1);
+ }
+ }
err = gpgme_data_new_from_stream (&in, fp_in);
if (err)
fprintf (stderr, PGM ": decrypt failed: %s\n", gpgme_strerror (err));
exit (1);
}
- if (result) {
- print_result (result);
- print_data (out);
- }
+ if (result)
+ {
+ print_result (result);
+ print_data (out);
+ }
gpgme_data_release (out);
gpgme_data_release (in);
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
" --uiserver use the UI server\n"
" --loopback use a loopback pinentry\n"
" --key NAME use key NAME for signing\n"
+ " --sender MBOX use MBOX as sender address\n"
, stderr);
exit (ex);
}
gpgme_sign_result_t result;
int print_status = 0;
int use_loopback = 0;
+ const char *sender = NULL;
if (argc)
{ argc--; argv++; }
key_string = *argv;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--sender"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ sender = *argv;
+ argc--; argv++;
+ }
else if (!strcmp (*argv, "--loopback"))
{
use_loopback = 1;
gpgme_key_unref (akey);
}
+ if (sender)
+ {
+ err = gpgme_set_sender (ctx, sender);
+ fail_if_err (err);
+ }
+
err = gpgme_data_new_from_file (&in, *argv, 1);
if (err)
{
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
#include <unistd.h>
--- /dev/null
+/* run-swdb.c - Test tool for SWDB function
+ * Copyright (C) 2016 g10 Code GmbH
+ *
+ * This file is part of GPGME.
+ *
+ * GPGME is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * GPGME is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+/* We need to include config.h so that we know whether we are building
+ with large file system (LFS) support. */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+#include <gpgme.h>
+
+#define PGM "run-swdb"
+
+#include "run-support.h"
+
+
+static int verbose;
+
+
+static const char *
+isotimestr (unsigned long value)
+{
+ time_t t;
+ static char buffer[25+5];
+ struct tm *tp;
+
+ if (!value)
+ return "none";
+ t = value;
+
+ tp = gmtime (&t);
+ snprintf (buffer, sizeof buffer, "%04d-%02d-%02d %02d:%02d:%02d",
+ 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
+ tp->tm_hour, tp->tm_min, tp->tm_sec);
+ return buffer;
+}
+
+
+static int
+show_usage (int ex)
+{
+ fputs ("usage: " PGM " [options] NAME [VERSION]\n\n"
+ "Options:\n"
+ " --verbose run in verbose mode\n"
+ " --status print status lines from the backend\n"
+ , stderr);
+ exit (ex);
+}
+
+
+int
+main (int argc, char **argv)
+{
+ int last_argc = -1;
+ gpgme_error_t err;
+ gpgme_ctx_t ctx;
+ gpgme_protocol_t protocol = GPGME_PROTOCOL_GPGCONF;
+ const char *name;
+ const char *iversion;
+ gpgme_query_swdb_result_t result;
+
+ if (argc)
+ { argc--; argv++; }
+
+ while (argc && last_argc != argc )
+ {
+ last_argc = argc;
+ if (!strcmp (*argv, "--"))
+ {
+ argc--; argv++;
+ break;
+ }
+ else if (!strcmp (*argv, "--help"))
+ show_usage (0);
+ else if (!strcmp (*argv, "--verbose"))
+ {
+ verbose = 1;
+ argc--; argv++;
+ }
+ else if (!strncmp (*argv, "--", 2))
+ show_usage (1);
+ }
+
+ if (argc < 1 || argc > 2)
+ show_usage (1);
+ name = argv[0];
+ iversion = argc > 1? argv[1] : NULL;
+
+ init_gpgme (protocol);
+
+ err = gpgme_new (&ctx);
+ fail_if_err (err);
+ gpgme_set_protocol (ctx, protocol);
+
+ err = gpgme_op_query_swdb (ctx, name, iversion, 0);
+ if (err)
+ {
+ fprintf (stderr, PGM ": error querying swdb: %s\n", gpg_strerror (err));
+ exit (1);
+ }
+
+ result = gpgme_op_query_swdb_result (ctx);
+ if (!result)
+ {
+ fprintf (stderr, PGM ": error querying swdb: %s\n", "no result");
+ exit (1);
+ }
+
+ printf ("package ...: %s\n"
+ "iversion ..: %s\n"
+ "version ...: %s\n",
+ nonnull (result->name),
+ nonnull (result->iversion),
+ nonnull (result->version));
+ printf ("reldate ...: %s\n", isotimestr (result->reldate));
+ printf ("created ...: %s\n", isotimestr (result->created));
+ printf ("retrieved .: %s\n", isotimestr (result->retrieved));
+ printf ("flags .....:%s%s%s%s%s%s%s\n",
+ result->warning? " warning" : "",
+ result->update? " update" : "",
+ result->urgent? " urgent" : "",
+ result->unknown? " unknown" : "",
+ result->tooold? " tooold" : "",
+ result->noinfo? " noinfo" : "",
+ result->error? " error" : "" );
+
+
+ gpgme_release (ctx);
+ return 0;
+}
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
const char *fpr;
const char *policystr = NULL;
gpgme_tofu_policy_t policy;
+ const char *s;
if (argc)
{ argc--; argv++; }
fail_if_err (err);
gpgme_set_protocol (ctx, protocol);
gpgme_set_armor (ctx, 1);
+
+
+ s = gpgme_get_ctx_flag (ctx, "no_such-flag");
+ if (s)
+ {
+ fprintf (stderr, PGM ": gpgme_get_ctx_flag failed "
+ "(bad name not detected)\n");
+ exit (1);
+ }
+ s = gpgme_get_ctx_flag (ctx, "full-status");
+ if (!s || *s)
+ {
+ fprintf (stderr, PGM ": gpgme_get_ctx_flag failed (wrong false)\n");
+ exit (1);
+ }
if (print_status)
{
gpgme_set_status_cb (ctx, status_cb, NULL);
gpgme_set_ctx_flag (ctx, "full-status", "1");
+ s = gpgme_get_ctx_flag (ctx, "full-status");
+ if (!s || strcmp (s, "1"))
+ {
+ fprintf (stderr, PGM ": gpgme_get_ctx_flag fauled (wrong true)\n");
+ exit (1);
+ }
}
err = gpgme_get_key (ctx, fpr, &thekey, 0);
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ License along with this program; if not, see <https://www.gnu.org/licenses/>.
*/
/* We need to include config.h so that we know whether we are building
" --status print status lines from the backend\n"
" --openpgp use the OpenPGP protocol (default)\n"
" --cms use the CMS protocol\n"
+ " --sender MBOX use MBOX as sender address\n"
, stderr);
exit (ex);
}
gpgme_data_t msg = NULL;
gpgme_verify_result_t result;
int print_status = 0;
+ const char *sender = NULL;
if (argc)
{ argc--; argv++; }
protocol = GPGME_PROTOCOL_CMS;
argc--; argv++;
}
+ else if (!strcmp (*argv, "--sender"))
+ {
+ argc--; argv++;
+ if (!argc)
+ show_usage (1);
+ sender = *argv;
+ argc--; argv++;
+ }
else if (!strncmp (*argv, "--", 2))
show_usage (1);
}
/* gpgme_set_ctx_flag (ctx, "raw-description", "1"); */
+ if (sender)
+ {
+ err = gpgme_set_sender (ctx, sender);
+ fail_if_err (err);
+ }
+
err = gpgme_data_new_from_stream (&sig, fp_sig);
if (err)
{