+2013-08-12 Werner Koch <wk@gnupg.org>
+
+ Release 1.4.3.
+ * configure.ac: Change LT version to C22/A11/R0.
+
+ Make test suite workable with GnuPG 2.1.
+ * tests/gpg/start-stop-agent: New.
+ * tests/gpg/initial.test: New.
+ * tests/gpg/final.test: New.
+ * tests/gpg/Makefile.am (c_tests): New.
+ (TESTS): Move all to c_tests. Add initial.test, final.test, and
+ c_tests.
+ (TESTS_ENVIRONMENT): Add C_ALL=C
+ (private_keys): New.
+ (EXTRA_DIST): Add new files.
+ (./private-keys-v1.d/gpg-sample.stamp): Copy private keys.
+ (all-local): Depend on gpg-sample.stamp.
+ * tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F: New.
+ * tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD: New.
+ * tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66: New.
+ * tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C: New.
+ * tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD: New.
+
+ Improve detection of default gpg by configure.
+ * configure.ac: Move test for gpgconf before test for gpg.
+ (GPG, GPGSM, G13): Use gpgconf instead of AC_PATH_PROG if possible.
+
+2013-08-09 Werner Koch <wk@gnupg.org>
+
+ Add function gpgme_data_identify.
+ * src/gpgme.h.in (gpgme_data_type_t): New.
+ (gpgme_data_identify): New prototype.
+ * src/data-identify.c: New.
+ * src/parsetlv.c, src/parsetlv.h: New. Take from gpa.
+ * src/libgpgme.vers, src/gpgme.def: Add gpgme_data_identify.
+ * src/gpgme-tool.c (status): Add STATUS_IDENTIFY_RESULT.
+ (gt_identify): New.
+ (cmd_identify): New.
+
+ (hlp_passwd): Move close to cmd_passwd.
+
+2013-08-02 Werner Koch <wk@gnupg.org>
+
+ Prefer GnuPG-2 engines over GnuPG-1.
+ * src/util.h: Move some prototypes to ...
+ * src/sys-util.h: New.
+ * src/Makefile.am (main_sources): Add sys-util.h.
+ * configure.ac (AH_VERBATIM): Add DIRSEP_C and DIRSEP_S.
+ * src/dirinfo.c: Include sys-util.h.
+ (WANT_GPG_NAME, WANT_GPGSM_NAME, WANT_G13_NAME)
+ (WANT_UISRV_SOCKET): New.
+ (dirinfo): Add corresponding fields.
+ (parse_output): Add arg COMPONENTS and set new fields.
+ (read_gpgconf_dirs): Add arg components and act upon it.
+ (get_gpgconf_item): Call read_gpgconf_dirs two times. Add debug
+ output.
+ (_gpgme_get_default_gpg_name): New.
+ (_gpgme_get_default_gpgsm_name): New.
+ (_gpgme_get_default_g13_name): New.
+ (_gpgme_get_default_gpgconf_name): New.
+ (_gpgme_get_default_uisrv_socket): New.
+ * src/engine-gpg.c, src/engine-g13.c, src/engine-gpgconf.c
+ * src/engine-gpgsm.c, src/engine-uiserver.c: Change to use
+ _gpgme_get_default_ instead of those from sys-util.h.
+ * src/posix-util.c (_gpgme_get_gpg_path): Include sys-util.h.
+ (_gpgme_get_uiserver_socket_path): Remove.
+ * src/w32-util.c (_gpgme_get_gpg_path): Include sys-util.h.
+ (_gpgme_get_uiserver_socket_path): Remove.
+
+ w32: Try to locate gpg in the gpgme installation dir.
+ * src/w32-util.c (my_hmodule): New.
+ (wchar_to_utf8): New.
+ (DllMain): New.
+ (_gpgme_get_inst_dir): New.
+ (find_program_in_dir): New.
+ (find_program_in_inst_dir): Add arg INST_DIR.
+ (_gpgme_get_gpg_path): Get inst_dir before acquiring the lock.
+ (_gpgme_get_gpgconf_path): Ditto.
+ (_gpgme_get_g13_path): Ditto.
+ (_gpgme_get_w32spawn_path): Ditto.
+
+2013-07-31 Werner Koch <wk@gnupg.org>
+
+ doc: Add --binary option for the OUTPUT command of an uiserver.
+
+2013-06-18 Werner Koch <wk@gnupg.org>
+
+ Add function gpgme_signers_count.
+ * src/signers.c (gpgme_signers_count): New.
+ * src/libgpgme.vers, src/gpgme.def: Add as external symbol.
+ * src/gpgme.h.in: Add prototype.
+
2013-05-28 Werner Koch <wk@gnupg.org>
Release 1.4.2.
+Noteworthy changes in version 1.4.3 (2013-08-12)
+------------------------------------------------
+
+ * The default engine names are now taken from the output of gpgconf.
+ If gpgconf is not found the use of gpg 1 is assumed.
+
+ * Under Windows the default engines names are first searched in the
+ installation directory of the gpgme DLL.
+
+ * New function gpgme_data_identify to detect the type of a message.
+
+ * Interface changes relative to the 1.4.2 release:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ gpgme_signers_count NEW.
+ gpgme_data_type_t NEW.
+ gpgme_data_identify NEW.
+
+
Noteworthy changes in version 1.4.2 (2013-05-28)
------------------------------------------------
#undef REPLACE_TTYNAME_R
-/* Separators as used in $PATH. */
+/* Separators as used in $PATH and file name. */
#ifdef HAVE_DOSISH_SYSTEM
#define PATHSEP_C ';'
+#define DIRSEP_C '\\'
+#define DIRSEP_S "\\"
#else
#define PATHSEP_C ':'
+#define DIRSEP_C '/'
+#define DIRSEP_S "/"
#endif
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for gpgme 1.4.2.
+# Generated by GNU Autoconf 2.69 for gpgme 1.4.3.
#
# Report bugs to <http://bugs.gnupg.org>.
#
# Identity of this package.
PACKAGE_NAME='gpgme'
PACKAGE_TARNAME='gpgme'
-PACKAGE_VERSION='1.4.2'
-PACKAGE_STRING='gpgme 1.4.2'
+PACKAGE_VERSION='1.4.3'
+PACKAGE_STRING='gpgme 1.4.3'
PACKAGE_BUGREPORT='http://bugs.gnupg.org'
PACKAGE_URL=''
HAVE_G13_FALSE
HAVE_G13_TRUE
G13
-RUN_GPGCONF_TESTS_FALSE
-RUN_GPGCONF_TESTS_TRUE
-HAVE_GPGCONF_FALSE
-HAVE_GPGCONF_TRUE
-GPGCONF
RUN_GPGSM_TESTS_FALSE
RUN_GPGSM_TESTS_TRUE
HAVE_GPGSM_FALSE
RUN_GPG_TESTS_FALSE
RUN_GPG_TESTS_TRUE
GPG
+RUN_GPGCONF_TESTS_FALSE
+RUN_GPGCONF_TESTS_TRUE
+HAVE_GPGCONF_FALSE
+HAVE_GPGCONF_TRUE
+GPGCONF
HAVE_ASSUAN_FALSE
HAVE_ASSUAN_TRUE
LIBASSUAN_LIBS
with_gpgsm_version
with_gpgconf_version
with_g13_version
+with_gpgconf
+enable_gpgconf_test
with_gpg
enable_gpg_test
with_gpgsm
enable_gpgsm_test
-with_gpgconf
-enable_gpgconf_test
with_g13
enable_g13_test
enable_fd_passing
# 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.4.2 to adapt to many kinds of systems.
+\`configure' configures gpgme 1.4.3 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.4.2:";;
+ short | recursive ) echo "Configuration of gpgme 1.4.3:";;
esac
cat <<\_ACEOF
--enable-w32-glib build GPGME Glib for W32
--enable-w32-qt build GPGME Qt for W32
--disable-largefile omit support for large files
+ --disable-gpgconf-test disable GPGCONF run test
--disable-gpg-test disable GPG run test
--disable-gpgsm-test disable GPGSM run test
- --disable-gpgconf-test disable GPGCONF run test
--disable-g13-test disable G13 run test
--disable-fd-passing do not use FD passing
--with-gpgconf-version=VER
require GPGCONF version VER
--with-g13-version=VER require G13 version VER
+ --with-gpgconf=PATH use gpgconf binary at PATH
--with-gpg=PATH use GnuPG binary at PATH
--with-gpgsm=PATH use GpgSM binary at PATH
- --with-gpgconf=PATH use gpgconf binary at PATH
--with-g13=PATH use g13 binary at PATH
Some influential environment variables:
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-gpgme configure 1.4.2
+gpgme configure 1.4.3
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.4.2, which was
+It was created by gpgme $as_me 1.4.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
-LIBGPGME_LT_CURRENT=21
+LIBGPGME_LT_CURRENT=22
# Subtract 2 from this value if you want to make the LFS transition an
# ABI break. [Note to self: Remove this comment with the next regular break.]
-LIBGPGME_LT_AGE=10
+LIBGPGME_LT_AGE=11
LIBGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
ac_config_headers="$ac_config_headers config.h"
+# Note: For automake 1.13 add the option
+# serial-tests
am__api_version='1.11'
# Find a good install program. We prefer a C program (faster),
# Define the identity of the package.
PACKAGE='gpgme'
- VERSION='1.4.2'
+ VERSION='1.4.3'
cat >>confdefs.h <<_ACEOF
#define VERSION "$VERSION"
_ACEOF
-VERSION_NUMBER=0x010402
+VERSION_NUMBER=0x010403
# Don't default to build static libs.
#
# Provide information about the build.
#
-BUILD_REVISION="009e26a"
+BUILD_REVISION="d788c35"
cat >>confdefs.h <<_ACEOF
BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
-BUILD_FILEVERSION="${BUILD_FILEVERSION}158"
+BUILD_FILEVERSION="${BUILD_FILEVERSION}55176"
BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
cat >>confdefs.h <<_ACEOF
-#define NEED_GPG_VERSION "$NEED_GPG_VERSION"
+#define NEED_GPGCONF_VERSION "$NEED_GPGCONF_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
-#define NEED_GPGSM_VERSION "$NEED_GPGSM_VERSION"
+#define NEED_GPG_VERSION "$NEED_GPG_VERSION"
_ACEOF
cat >>confdefs.h <<_ACEOF
-#define NEED_GPGCONF_VERSION "$NEED_GPGCONF_VERSION"
+#define NEED_GPGSM_VERSION "$NEED_GPGSM_VERSION"
_ACEOF
_ACEOF
-
+#
+# Check for GPGCONF
+#
+gpgconf_usable_for_test=no
NO_OVERRIDE=no
-# Check whether --with-gpg was given.
-if test "${with_gpg+set}" = set; then :
- withval=$with_gpg; GPG=$withval
+# Check whether --with-gpgconf was given.
+if test "${with_gpgconf+set}" = set; then :
+ withval=$with_gpgconf; GPGCONF=$withval
else
NO_OVERRIDE=yes
fi
-if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
- GPG=
+if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
+ GPGCONF=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- # Extract the first word of "gpg", so it can be a program name with args.
-set dummy gpg; ac_word=$2
+ # Extract the first word of "gpgconf", so it can be a program name with args.
+set dummy gpgconf; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GPG+:} false; then :
+if ${ac_cv_path_GPGCONF+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $GPG in
+ case $GPGCONF in
[\\/]* | ?:[\\/]*)
- ac_cv_path_GPG="$GPG" # Let the user override the test with a path.
+ ac_cv_path_GPGCONF="$GPGCONF" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_GPG="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_GPGCONF="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
;;
esac
fi
-GPG=$ac_cv_path_GPG
-if test -n "$GPG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPG" >&5
-$as_echo "$GPG" >&6; }
+GPGCONF=$ac_cv_path_GPGCONF
+if test -n "$GPGCONF"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGCONF" >&5
+$as_echo "$GPGCONF" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
- if test -z "$GPG"; then
- GPG="$GPG_DEFAULT"
+ if test -z "$GPGCONF"; then
+ GPGCONF="$GPGCONF_DEFAULT"
fi
fi
-if test "$GPG" = no; then
+if test "$GPGCONF" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
***
-*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
***" >&5
$as_echo "$as_me: WARNING:
***
-*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
***" >&2;}
else
as_fn_error $? "
***
-*** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
+*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
***" "$LINENO" 5
fi
fi
else
cat >>confdefs.h <<_ACEOF
-#define GPG_PATH "$GPG"
+#define GPGCONF_PATH "$GPGCONF"
_ACEOF
+$as_echo "#define ENABLE_GPGCONF 1" >>confdefs.h
+
fi
-GPG_VERSION=unknown
+ if test "$GPGCONF" != "no"; then
+ HAVE_GPGCONF_TRUE=
+ HAVE_GPGCONF_FALSE='#'
+else
+ HAVE_GPGCONF_TRUE='#'
+ HAVE_GPGCONF_FALSE=
+fi
+
+
+GPGCONF_VERSION=unknown
ok=maybe
-if test -z "$GPG" -o "x$GPG" = "xno"; then
+if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GnuPG version can not be checked when cross compiling" >&5
-$as_echo "$as_me: WARNING: GnuPG version can not be checked when cross compiling" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF version can not be checked when cross compiling" >&5
+$as_echo "$as_me: WARNING: GPGCONF version can not be checked when cross compiling" >&2;}
ok=no
else
- if test ! -x "$GPG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GnuPG not executable, version check disabled" >&5
-$as_echo "$as_me: WARNING: GnuPG not executable, version check disabled" >&2;}
+ if test ! -x "$GPGCONF"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF not executable, version check disabled" >&5
+$as_echo "$as_me: WARNING: GPGCONF not executable, version check disabled" >&2;}
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPG >= $NEED_GPG_VERSION" >&5
-$as_echo_n "checking for GPG >= $NEED_GPG_VERSION... " >&6; }
- req_major=`echo $NEED_GPG_VERSION | \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGCONF >= $NEED_GPGCONF_VERSION" >&5
+$as_echo_n "checking for GPGCONF >= $NEED_GPGCONF_VERSION... " >&6; }
+ req_major=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- req_minor=`echo $NEED_GPG_VERSION | \
+ req_minor=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- req_micro=`echo $NEED_GPG_VERSION | \
+ req_micro=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- GPG_VERSION=`$GPG --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
- major=`echo $GPG_VERSION | \
+ GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
+ major=`echo $GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
- minor=`echo $GPG_VERSION | \
+ minor=`echo $GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
- micro=`echo $GPG_VERSION | \
+ micro=`echo $GPGCONF_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
if test "$ok" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
+ if test "$cross_compiling" != "yes"; then
+ gpgconf_usable_for_test=yes
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&5
-$as_echo "$as_me: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&5
+$as_echo "$as_me: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&2;}
fi
fi
-run_gpg_test="$ok"
-# Check whether --enable-gpg-test was given.
-if test "${enable_gpg_test+set}" = set; then :
- enableval=$enable_gpg_test; run_gpg_test=$enableval
+run_gpgconf_test="$ok"
+# Check whether --enable-gpgconf-test was given.
+if test "${enable_gpgconf_test+set}" = set; then :
+ enableval=$enable_gpgconf_test; run_gpgconf_test=$enableval
fi
- if test "$run_gpg_test" = "yes"; then
- RUN_GPG_TESTS_TRUE=
- RUN_GPG_TESTS_FALSE='#'
+ if test "$run_gpgconf_test" = "yes"; then
+ RUN_GPGCONF_TESTS_TRUE=
+ RUN_GPGCONF_TESTS_FALSE='#'
else
- RUN_GPG_TESTS_TRUE='#'
- RUN_GPG_TESTS_FALSE=
+ RUN_GPGCONF_TESTS_TRUE='#'
+ RUN_GPGCONF_TESTS_FALSE=
fi
+#
+# Check for GPG
+#
NO_OVERRIDE=no
-# Check whether --with-gpgsm was given.
-if test "${with_gpgsm+set}" = set; then :
- withval=$with_gpgsm; GPGSM=$withval
+# Check whether --with-gpg was given.
+if test "${with_gpg+set}" = set; then :
+ withval=$with_gpg; GPG=$withval
else
NO_OVERRIDE=yes
fi
-if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
- GPGSM=
+if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
+ GPG=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- # Extract the first word of "gpgsm", so it can be a program name with args.
-set dummy gpgsm; ac_word=$2
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
+ else
+ # Extract the first word of "gpg", so it can be a program name with args.
+set dummy gpg; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GPGSM+:} false; then :
+if ${ac_cv_path_GPG+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $GPGSM in
+ case $GPG in
[\\/]* | ?:[\\/]*)
- ac_cv_path_GPGSM="$GPGSM" # Let the user override the test with a path.
+ ac_cv_path_GPG="$GPG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_GPGSM="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_GPG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
;;
esac
fi
-GPGSM=$ac_cv_path_GPGSM
-if test -n "$GPGSM"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGSM" >&5
-$as_echo "$GPGSM" >&6; }
+GPG=$ac_cv_path_GPG
+if test -n "$GPG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPG" >&5
+$as_echo "$GPG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+ fi
fi
- if test -z "$GPGSM"; then
- GPGSM="$GPGSM_DEFAULT"
+ if test -z "$GPG"; then
+ GPG="$GPG_DEFAULT"
fi
fi
-if test "$GPGSM" = no; then
+if test "$GPG" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
***
-*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
+*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
***" >&5
$as_echo "$as_me: WARNING:
***
-*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
+*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
***" >&2;}
else
as_fn_error $? "
***
-*** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
+*** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
***" "$LINENO" 5
fi
fi
else
cat >>confdefs.h <<_ACEOF
-#define GPGSM_PATH "$GPGSM"
+#define GPG_PATH "$GPG"
_ACEOF
-$as_echo "#define ENABLE_GPGSM 1" >>confdefs.h
-
-fi
- if test "$GPGSM" != "no"; then
- HAVE_GPGSM_TRUE=
- HAVE_GPGSM_FALSE='#'
-else
- HAVE_GPGSM_TRUE='#'
- HAVE_GPGSM_FALSE=
fi
-
-
-
-GPGSM_VERSION=unknown
+GPG_VERSION=unknown
ok=maybe
-if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
+if test -z "$GPG" -o "x$GPG" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM version can not be checked when cross compiling" >&5
-$as_echo "$as_me: WARNING: GPGSM version can not be checked when cross compiling" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GnuPG version can not be checked when cross compiling" >&5
+$as_echo "$as_me: WARNING: GnuPG version can not be checked when cross compiling" >&2;}
ok=no
else
- if test ! -x "$GPGSM"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM not executable, version check disabled" >&5
-$as_echo "$as_me: WARNING: GPGSM not executable, version check disabled" >&2;}
+ if test ! -x "$GPG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GnuPG not executable, version check disabled" >&5
+$as_echo "$as_me: WARNING: GnuPG not executable, version check disabled" >&2;}
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGSM >= $NEED_GPGSM_VERSION" >&5
-$as_echo_n "checking for GPGSM >= $NEED_GPGSM_VERSION... " >&6; }
- req_major=`echo $NEED_GPGSM_VERSION | \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPG >= $NEED_GPG_VERSION" >&5
+$as_echo_n "checking for GPG >= $NEED_GPG_VERSION... " >&6; }
+ req_major=`echo $NEED_GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- req_minor=`echo $NEED_GPGSM_VERSION | \
+ req_minor=`echo $NEED_GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- req_micro=`echo $NEED_GPGSM_VERSION | \
+ req_micro=`echo $NEED_GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
- major=`echo $GPGSM_VERSION | \
+ GPG_VERSION=`$GPG --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
+ major=`echo $GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
- minor=`echo $GPGSM_VERSION | \
+ minor=`echo $GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
- micro=`echo $GPGSM_VERSION | \
+ micro=`echo $GPG_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&5
-$as_echo "$as_me: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&5
+$as_echo "$as_me: WARNING: GPG must be at least version $NEED_GPG_VERSION" >&2;}
fi
fi
-run_gpgsm_test="$ok"
-# Check whether --enable-gpgsm-test was given.
-if test "${enable_gpgsm_test+set}" = set; then :
- enableval=$enable_gpgsm_test; run_gpgsm_test=$enableval
+run_gpg_test="$ok"
+# Check whether --enable-gpg-test was given.
+if test "${enable_gpg_test+set}" = set; then :
+ enableval=$enable_gpg_test; run_gpg_test=$enableval
fi
- if test "$run_gpgsm_test" = "yes"; then
- RUN_GPGSM_TESTS_TRUE=
- RUN_GPGSM_TESTS_FALSE='#'
+ if test "$run_gpg_test" = "yes"; then
+ RUN_GPG_TESTS_TRUE=
+ RUN_GPG_TESTS_FALSE='#'
else
- RUN_GPGSM_TESTS_TRUE='#'
- RUN_GPGSM_TESTS_FALSE=
+ RUN_GPG_TESTS_TRUE='#'
+ RUN_GPG_TESTS_FALSE=
fi
+
+#
+# Check for GPGSM
+#
NO_OVERRIDE=no
-# Check whether --with-gpgconf was given.
-if test "${with_gpgconf+set}" = set; then :
- withval=$with_gpgconf; GPGCONF=$withval
+# Check whether --with-gpgsm was given.
+if test "${with_gpgsm+set}" = set; then :
+ withval=$with_gpgsm; GPGSM=$withval
else
NO_OVERRIDE=yes
fi
-if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
- GPGCONF=
+if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
+ GPGSM=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- # Extract the first word of "gpgconf", so it can be a program name with args.
-set dummy gpgconf; ac_word=$2
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
+ else
+ # Extract the first word of "gpgsm", so it can be a program name with args.
+set dummy gpgsm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GPGCONF+:} false; then :
+if ${ac_cv_path_GPGSM+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $GPGCONF in
+ case $GPGSM in
[\\/]* | ?:[\\/]*)
- ac_cv_path_GPGCONF="$GPGCONF" # Let the user override the test with a path.
+ ac_cv_path_GPGSM="$GPGSM" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_GPGCONF="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_GPGSM="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
;;
esac
fi
-GPGCONF=$ac_cv_path_GPGCONF
-if test -n "$GPGCONF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGCONF" >&5
-$as_echo "$GPGCONF" >&6; }
+GPGSM=$ac_cv_path_GPGSM
+if test -n "$GPGSM"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GPGSM" >&5
+$as_echo "$GPGSM" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+ fi
fi
- if test -z "$GPGCONF"; then
- GPGCONF="$GPGCONF_DEFAULT"
+ if test -z "$GPGSM"; then
+ GPGSM="$GPGSM_DEFAULT"
fi
fi
-if test "$GPGCONF" = no; then
+if test "$GPGSM" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
***
-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
+*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
***" >&5
$as_echo "$as_me: WARNING:
***
-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
+*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
***" >&2;}
else
as_fn_error $? "
***
-*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
+*** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
***" "$LINENO" 5
fi
fi
else
cat >>confdefs.h <<_ACEOF
-#define GPGCONF_PATH "$GPGCONF"
+#define GPGSM_PATH "$GPGSM"
_ACEOF
-$as_echo "#define ENABLE_GPGCONF 1" >>confdefs.h
+$as_echo "#define ENABLE_GPGSM 1" >>confdefs.h
fi
- if test "$GPGCONF" != "no"; then
- HAVE_GPGCONF_TRUE=
- HAVE_GPGCONF_FALSE='#'
+ if test "$GPGSM" != "no"; then
+ HAVE_GPGSM_TRUE=
+ HAVE_GPGSM_FALSE='#'
else
- HAVE_GPGCONF_TRUE='#'
- HAVE_GPGCONF_FALSE=
+ HAVE_GPGSM_TRUE='#'
+ HAVE_GPGSM_FALSE=
fi
-GPGCONF_VERSION=unknown
+
+GPGSM_VERSION=unknown
ok=maybe
-if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
+if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF version can not be checked when cross compiling" >&5
-$as_echo "$as_me: WARNING: GPGCONF version can not be checked when cross compiling" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM version can not be checked when cross compiling" >&5
+$as_echo "$as_me: WARNING: GPGSM version can not be checked when cross compiling" >&2;}
ok=no
else
- if test ! -x "$GPGCONF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF not executable, version check disabled" >&5
-$as_echo "$as_me: WARNING: GPGCONF not executable, version check disabled" >&2;}
+ if test ! -x "$GPGSM"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM not executable, version check disabled" >&5
+$as_echo "$as_me: WARNING: GPGSM not executable, version check disabled" >&2;}
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGCONF >= $NEED_GPGCONF_VERSION" >&5
-$as_echo_n "checking for GPGCONF >= $NEED_GPGCONF_VERSION... " >&6; }
- req_major=`echo $NEED_GPGCONF_VERSION | \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPGSM >= $NEED_GPGSM_VERSION" >&5
+$as_echo_n "checking for GPGSM >= $NEED_GPGSM_VERSION... " >&6; }
+ req_major=`echo $NEED_GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
- req_minor=`echo $NEED_GPGCONF_VERSION | \
+ req_minor=`echo $NEED_GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
- req_micro=`echo $NEED_GPGCONF_VERSION | \
+ req_micro=`echo $NEED_GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
- GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
- major=`echo $GPGCONF_VERSION | \
+ GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[^0-9]*\(.*\)/\1/p'`
+ major=`echo $GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
- minor=`echo $GPGCONF_VERSION | \
+ minor=`echo $GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
- micro=`echo $GPGCONF_VERSION | \
+ micro=`echo $GPGSM_VERSION | \
sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&5
-$as_echo "$as_me: WARNING: GPGCONF must be at least version $NEED_GPGCONF_VERSION" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&5
+$as_echo "$as_me: WARNING: GPGSM must be at least version $NEED_GPGSM_VERSION" >&2;}
fi
fi
-run_gpgconf_test="$ok"
-# Check whether --enable-gpgconf-test was given.
-if test "${enable_gpgconf_test+set}" = set; then :
- enableval=$enable_gpgconf_test; run_gpgconf_test=$enableval
+run_gpgsm_test="$ok"
+# Check whether --enable-gpgsm-test was given.
+if test "${enable_gpgsm_test+set}" = set; then :
+ enableval=$enable_gpgsm_test; run_gpgsm_test=$enableval
fi
- if test "$run_gpgconf_test" = "yes"; then
- RUN_GPGCONF_TESTS_TRUE=
- RUN_GPGCONF_TESTS_FALSE='#'
+ if test "$run_gpgsm_test" = "yes"; then
+ RUN_GPGSM_TESTS_TRUE=
+ RUN_GPGSM_TESTS_FALSE='#'
else
- RUN_GPGCONF_TESTS_TRUE='#'
- RUN_GPGCONF_TESTS_FALSE=
+ RUN_GPGSM_TESTS_TRUE='#'
+ RUN_GPGSM_TESTS_FALSE=
fi
+#
+# Check for G13
+#
NO_OVERRIDE=no
# Check whether --with-g13 was given.
G13=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- # Extract the first word of "g13", so it can be a program name with args.
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
+ if test -z "$G13"; then
+ # Use a hack if gpgconf has no support for g13.
+ G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
+ fi
+ else
+ # Extract the first word of "g13", so it can be a program name with args.
set dummy g13; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
fi
+ fi
fi
if test -z "$G13"; then
G13="$G13_DEFAULT"
+#
+# Other checks
+#
+
# Check for funopen
for ac_func in funopen
do :
as_fn_error $? "conditional \"HAVE_ASSUAN\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${HAVE_GPGCONF_TRUE}" && test -z "${HAVE_GPGCONF_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_GPGCONF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${RUN_GPGCONF_TESTS_TRUE}" && test -z "${RUN_GPGCONF_TESTS_FALSE}"; then
+ as_fn_error $? "conditional \"RUN_GPGCONF_TESTS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${RUN_GPG_TESTS_TRUE}" && test -z "${RUN_GPG_TESTS_FALSE}"; then
as_fn_error $? "conditional \"RUN_GPG_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
as_fn_error $? "conditional \"RUN_GPGSM_TESTS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${HAVE_GPGCONF_TRUE}" && test -z "${HAVE_GPGCONF_FALSE}"; then
- as_fn_error $? "conditional \"HAVE_GPGCONF\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${RUN_GPGCONF_TESTS_TRUE}" && test -z "${RUN_GPGCONF_TESTS_FALSE}"; then
- as_fn_error $? "conditional \"RUN_GPGCONF_TESTS\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${HAVE_G13_TRUE}" && test -z "${HAVE_G13_FALSE}"; then
as_fn_error $? "conditional \"HAVE_G13\" 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.4.2, which was
+This file was extended by gpgme $as_me 1.4.3, 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.4.2
+gpgme config.status 1.4.3
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
echo "
GPGME v${VERSION} has been configured as follows:
- Revision: 009e26a (158)
+ Revision: d788c35 (55176)
Platform: $host
- GnuPG path: $GPG
- GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
- GpgSM path: $GPGSM
- GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
- GpgConf path: $GPGCONF
- GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
- G13 path: $G13
+ Gpgconf at: $GPGCONF
+ Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
+ GPG at: $GPG
+ GPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
+ Gpgsm at: $GPGSM
+ Gpgsm version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
+ G13 at: $G13
G13 version: $G13_VERSION, min. $NEED_G13_VERSION
Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
# for the LT versions.
m4_define(mym4_version_major, [1])
m4_define(mym4_version_minor, [4])
-m4_define(mym4_version_micro, [2])
+m4_define(mym4_version_micro, [3])
# 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=21
+LIBGPGME_LT_CURRENT=22
# Subtract 2 from this value if you want to make the LFS transition an
# ABI break. [Note to self: Remove this comment with the next regular break.]
-LIBGPGME_LT_AGE=10
+LIBGPGME_LT_AGE=11
LIBGPGME_LT_REVISION=0
# If the API is changed in an incompatible way: increment the next counter.
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/gpgme.h.in)
AC_CONFIG_HEADER(config.h)
+# Note: For automake 1.13 add the option
+# serial-tests
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
NEED_G13_VERSION=0.0.0
fi
+AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
+ [Min. needed GPGCONF version.])
AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
[Min. needed GnuPG version.])
AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
[Min. needed GPGSM version.])
-AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
- [Min. needed GPGCONF version.])
AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
[Min. needed G13 version.])
+#
+# Check for GPGCONF
+#
+gpgconf_usable_for_test=no
+NO_OVERRIDE=no
+AC_ARG_WITH(gpgconf,
+ AC_HELP_STRING([--with-gpgconf=PATH],
+ [use gpgconf binary at PATH]),
+ GPGCONF=$withval, NO_OVERRIDE=yes)
+if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
+ GPGCONF=
+ NO_OVERRIDE=yes
+ if test "$cross_compiling" != "yes"; then
+ AC_PATH_PROG(GPGCONF, gpgconf)
+ fi
+ if test -z "$GPGCONF"; then
+ GPGCONF="$GPGCONF_DEFAULT"
+ fi
+fi
+if test "$GPGCONF" = no; then
+ if test "$NO_OVERRIDE" = "yes"; then
+ if test "$cross_compiling" != "yes"; then
+ AC_MSG_WARN([
+***
+*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
+***])
+ else
+ AC_MSG_ERROR([
+***
+*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
+***])
+ fi
+ fi
+else
+ AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
+ AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
+fi
+AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
+
+dnl Check for GPGCONF version requirement.
+GPGCONF_VERSION=unknown
+ok=maybe
+if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
+ ok=no
+else
+ if test "$cross_compiling" = "yes"; then
+ AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
+ ok=no
+ else
+ if test ! -x "$GPGCONF"; then
+ AC_MSG_WARN([GPGCONF not executable, version check disabled])
+ ok=no
+ fi
+ fi
+fi
+if test "$ok" = "maybe"; then
+ AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
+ req_major=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+ req_minor=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+ req_micro=`echo $NEED_GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+ GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
+ major=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+ minor=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+ micro=`echo $GPGCONF_VERSION | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+
+ if test "$major" -gt "$req_major"; then
+ ok=yes
+ else
+ if test "$major" -eq "$req_major"; then
+ if test "$minor" -gt "$req_minor"; then
+ ok=yes
+ else
+ if test "$minor" -eq "$req_minor"; then
+ if test "$micro" -ge "$req_micro"; then
+ ok=yes
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test "$ok" = "yes"; then
+ AC_MSG_RESULT(yes)
+ if test "$cross_compiling" != "yes"; then
+ gpgconf_usable_for_test=yes
+ fi
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
+ fi
+fi
+run_gpgconf_test="$ok"
+AC_ARG_ENABLE(gpgconf-test,
+ AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
+ run_gpgconf_test=$enableval)
+AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
+
+#
+# Check for GPG
+#
NO_OVERRIDE=no
AC_ARG_WITH(gpg,
AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
GPG=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- AC_PATH_PROG(GPG, gpg)
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
+ else
+ AC_PATH_PROG(GPG, gpg)
+ fi
fi
if test -z "$GPG"; then
GPG="$GPG_DEFAULT"
AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
AC_SUBST(GPG_PATH)
+
+#
+# Check for GPGSM
+#
NO_OVERRIDE=no
AC_ARG_WITH(gpgsm,
AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
GPGSM=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- AC_PATH_PROG(GPGSM, gpgsm)
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
+ else
+ AC_PATH_PROG(GPGSM, gpgsm)
+ fi
fi
if test -z "$GPGSM"; then
GPGSM="$GPGSM_DEFAULT"
AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
-NO_OVERRIDE=no
-AC_ARG_WITH(gpgconf,
- AC_HELP_STRING([--with-gpgconf=PATH],
- [use gpgconf binary at PATH]),
- GPGCONF=$withval, NO_OVERRIDE=yes)
-if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
- GPGCONF=
- NO_OVERRIDE=yes
- if test "$cross_compiling" != "yes"; then
- AC_PATH_PROG(GPGCONF, gpgconf)
- fi
- if test -z "$GPGCONF"; then
- GPGCONF="$GPGCONF_DEFAULT"
- fi
-fi
-if test "$GPGCONF" = no; then
- if test "$NO_OVERRIDE" = "yes"; then
- if test "$cross_compiling" != "yes"; then
- AC_MSG_WARN([
-***
-*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
-***])
- else
- AC_MSG_ERROR([
-***
-*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
-***])
- fi
- fi
-else
- AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
- AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
-fi
-AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
-
-dnl Check for GPGCONF version requirement.
-GPGCONF_VERSION=unknown
-ok=maybe
-if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
- ok=no
-else
- if test "$cross_compiling" = "yes"; then
- AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
- ok=no
- else
- if test ! -x "$GPGCONF"; then
- AC_MSG_WARN([GPGCONF not executable, version check disabled])
- ok=no
- fi
- fi
-fi
-if test "$ok" = "maybe"; then
- AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
- req_major=`echo $NEED_GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
- req_minor=`echo $NEED_GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
- req_micro=`echo $NEED_GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
- GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
- major=`echo $GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
- minor=`echo $GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
- micro=`echo $GPGCONF_VERSION | \
- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
-
- if test "$major" -gt "$req_major"; then
- ok=yes
- else
- if test "$major" -eq "$req_major"; then
- if test "$minor" -gt "$req_minor"; then
- ok=yes
- else
- if test "$minor" -eq "$req_minor"; then
- if test "$micro" -ge "$req_micro"; then
- ok=yes
- fi
- fi
- fi
- fi
- fi
- if test "$ok" = "yes"; then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
- fi
-fi
-run_gpgconf_test="$ok"
-AC_ARG_ENABLE(gpgconf-test,
- AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
- run_gpgconf_test=$enableval)
-AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
-
-
+#
+# Check for G13
+#
NO_OVERRIDE=no
AC_ARG_WITH(g13,
AC_HELP_STRING([--with-g13=PATH],
G13=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
- AC_PATH_PROG(G13, g13)
+ if test "$gpgconf_usable_for_test" = "yes"; then
+ G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
+ if test -z "$G13"; then
+ # Use a hack if gpgconf has no support for g13.
+ G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
+ fi
+ else
+ AC_PATH_PROG(G13, g13)
+ fi
fi
if test -z "$G13"; then
G13="$G13_DEFAULT"
AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
+#
+# Other checks
+#
+
# Check for funopen
AC_CHECK_FUNCS(funopen)
if test $ac_cv_func_funopen != yes; then
# Add a few constants to help porting to W32
AH_VERBATIM([SEPCONSTANTS],
[
-/* Separators as used in $PATH. */
+/* Separators as used in $PATH and file name. */
#ifdef HAVE_DOSISH_SYSTEM
#define PATHSEP_C ';'
+#define DIRSEP_C '\\'
+#define DIRSEP_S "\\"
#else
#define PATHSEP_C ':'
+#define DIRSEP_C '/'
+#define DIRSEP_S "/"
#endif
])
Revision: mym4_revision (mym4_revision_dec)
Platform: $host
- GnuPG path: $GPG
- GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
- GpgSM path: $GPGSM
- GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
- GpgConf path: $GPGCONF
- GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
- G13 path: $G13
+ Gpgconf at: $GPGCONF
+ Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
+ GPG at: $GPG
+ GPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
+ Gpgsm at: $GPGSM
+ Gpgsm version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
+ G13 at: $G13
G13 version: $G13_VERSION, min. $NEED_G13_VERSION
Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
This file documents the GPGME library.
- This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
-Easy' Reference Manual', for Version 1.4.2.
+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
+Made Easy' Reference Manual', for Version 1.4.3.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
\1f
Indirect:
-gpgme.info-1: 1756
-gpgme.info-2: 281093
+gpgme.info-1: 1758
+gpgme.info-2: 283468
\1f
Tag Table:
(Indirect)
-Node: Top\7f1756
-Node: Introduction\7f8595
-Node: Getting Started\7f9382
-Node: Features\7f10507
-Node: Overview\7f11657
-Node: Preparation\7f12766
-Node: Header\7f13763
-Node: Building the Source\7f14462
-Node: Largefile Support (LFS)\7f16571
-Node: Using Automake\7f21882
-Node: Using Libtool\7f23518
-Node: Library Version Check\7f23868
-Node: Signal Handling\7f27823
-Node: Multi Threading\7f29039
-Ref: Multi Threading-Footnote-1\7f31221
-Node: Protocols and Engines\7f31635
-Node: Engine Version Check\7f33984
-Node: Engine Information\7f34561
-Node: Engine Configuration\7f38261
-Node: OpenPGP\7f39523
-Node: Cryptographic Message Syntax\7f39859
-Node: Algorithms\7f40153
-Ref: Algorithms-Footnote-1\7f40632
-Node: Public Key Algorithms\7f40760
-Node: Hash Algorithms\7f42691
-Node: Error Handling\7f43789
-Node: Error Values\7f45651
-Node: Error Sources\7f50729
-Node: Error Codes\7f53056
-Node: Error Strings\7f57695
-Node: Exchanging Data\7f59474
-Node: Creating Data Buffers\7f61303
-Node: Memory Based Data Buffers\7f61819
-Node: File Based Data Buffers\7f65173
-Node: Callback Based Data Buffers\7f67344
-Node: Destroying Data Buffers\7f72900
-Node: Manipulating Data Buffers\7f74259
-Node: Data Buffer I/O Operations\7f74678
-Node: Data Buffer Meta-Data\7f77381
-Node: Contexts\7f80731
-Node: Creating Contexts\7f81854
-Node: Destroying Contexts\7f82665
-Node: Result Management\7f83000
-Node: Context Attributes\7f84406
-Node: Protocol Selection\7f85184
-Node: Crypto Engine\7f86196
-Node: ASCII Armor\7f88017
-Node: Text Mode\7f88629
-Node: Included Certificates\7f89560
-Node: Key Listing Mode\7f90935
-Node: Passphrase Callback\7f94292
-Node: Progress Meter Callback\7f97430
-Node: Locale\7f99354
-Node: Key Management\7f100893
-Node: Listing Keys\7f110818
-Node: Information About Keys\7f118080
-Node: Key Signatures\7f126078
-Node: Manipulating Keys\7f130090
-Node: Generating Keys\7f130932
-Node: Exporting Keys\7f135539
-Node: Importing Keys\7f141438
-Ref: Importing Keys-Footnote-1\7f148601
-Node: Deleting Keys\7f148729
-Node: Changing Passphrases\7f150126
-Node: Advanced Key Editing\7f151387
-Node: Trust Item Management\7f154491
-Node: Listing Trust Items\7f155561
-Node: Information About Trust Items\7f157859
-Node: Manipulating Trust Items\7f159741
-Node: Crypto Operations\7f160702
-Node: Decrypt\7f161946
-Node: Verify\7f165804
-Node: Decrypt and Verify\7f183660
-Node: Sign\7f185664
-Node: Selecting Signers\7f186228
-Node: Creating a Signature\7f187209
-Node: Signature Notation Data\7f191798
-Node: Encrypt\7f193982
-Node: Encrypting a Plaintext\7f194338
-Node: Run Control\7f200183
-Node: Waiting For Completion\7f200930
-Node: Using External Event Loops\7f202976
-Node: I/O Callback Interface\7f204943
-Node: Registering I/O Callbacks\7f210037
-Node: I/O Callback Example\7f212028
-Node: I/O Callback Example GTK+\7f218247
-Node: I/O Callback Example GDK\7f220036
-Node: I/O Callback Example Qt\7f221678
-Node: Cancellation\7f223966
-Node: UI Server Protocol\7f226219
-Ref: UI Server Protocol-Footnote-1\7f227650
-Node: UI Server Encrypt\7f227769
-Node: UI Server Sign\7f232950
-Node: UI Server Decrypt\7f235179
-Node: UI Server Verify\7f236617
-Node: UI Server Set Input Files\7f240119
-Node: UI Server Sign/Encrypt Files\7f240919
-Node: UI Server Verify/Decrypt Files\7f242688
-Node: UI Server Import/Export Keys\7f244534
-Node: UI Server Checksum Files\7f245567
-Node: Miscellaneous UI Server Commands\7f247733
-Ref: command SENDER\7f249645
-Node: Debugging\7f251321
-Node: Library Copying\7f252976
-Node: Copying\7f281093
-Node: Function and Data Index\7f318724
-Node: Concept Index\7f343986
+Node: Top\7f1758
+Node: Introduction\7f8599
+Node: Getting Started\7f9386
+Node: Features\7f10511
+Node: Overview\7f11661
+Node: Preparation\7f12770
+Node: Header\7f13767
+Node: Building the Source\7f14466
+Node: Largefile Support (LFS)\7f16575
+Node: Using Automake\7f21886
+Node: Using Libtool\7f23522
+Node: Library Version Check\7f23872
+Node: Signal Handling\7f27827
+Node: Multi Threading\7f29043
+Ref: Multi Threading-Footnote-1\7f31225
+Node: Protocols and Engines\7f31639
+Node: Engine Version Check\7f33988
+Node: Engine Information\7f34565
+Node: Engine Configuration\7f38265
+Node: OpenPGP\7f39527
+Node: Cryptographic Message Syntax\7f39863
+Node: Algorithms\7f40157
+Ref: Algorithms-Footnote-1\7f40636
+Node: Public Key Algorithms\7f40764
+Node: Hash Algorithms\7f42695
+Node: Error Handling\7f43793
+Node: Error Values\7f45655
+Node: Error Sources\7f50733
+Node: Error Codes\7f53060
+Node: Error Strings\7f57699
+Node: Exchanging Data\7f59478
+Node: Creating Data Buffers\7f61307
+Node: Memory Based Data Buffers\7f61823
+Node: File Based Data Buffers\7f65177
+Node: Callback Based Data Buffers\7f67348
+Node: Destroying Data Buffers\7f72904
+Node: Manipulating Data Buffers\7f74263
+Node: Data Buffer I/O Operations\7f74755
+Node: Data Buffer Meta-Data\7f77458
+Node: Data Buffer Convenience\7f80840
+Node: Contexts\7f82776
+Node: Creating Contexts\7f83899
+Node: Destroying Contexts\7f84710
+Node: Result Management\7f85045
+Node: Context Attributes\7f86451
+Node: Protocol Selection\7f87229
+Node: Crypto Engine\7f88241
+Node: ASCII Armor\7f90062
+Node: Text Mode\7f90674
+Node: Included Certificates\7f91605
+Node: Key Listing Mode\7f92980
+Node: Passphrase Callback\7f96337
+Node: Progress Meter Callback\7f99475
+Node: Locale\7f101399
+Node: Key Management\7f102938
+Node: Listing Keys\7f112863
+Node: Information About Keys\7f120125
+Node: Key Signatures\7f128123
+Node: Manipulating Keys\7f132135
+Node: Generating Keys\7f132977
+Node: Exporting Keys\7f137584
+Node: Importing Keys\7f143483
+Ref: Importing Keys-Footnote-1\7f150646
+Node: Deleting Keys\7f150774
+Node: Changing Passphrases\7f152171
+Node: Advanced Key Editing\7f153432
+Node: Trust Item Management\7f156536
+Node: Listing Trust Items\7f157606
+Node: Information About Trust Items\7f159904
+Node: Manipulating Trust Items\7f161786
+Node: Crypto Operations\7f162747
+Node: Decrypt\7f163991
+Node: Verify\7f167849
+Node: Decrypt and Verify\7f185705
+Node: Sign\7f187709
+Node: Selecting Signers\7f188273
+Node: Creating a Signature\7f189425
+Node: Signature Notation Data\7f194014
+Node: Encrypt\7f196198
+Node: Encrypting a Plaintext\7f196554
+Node: Run Control\7f202400
+Node: Waiting For Completion\7f203147
+Node: Using External Event Loops\7f205193
+Node: I/O Callback Interface\7f207160
+Node: Registering I/O Callbacks\7f212254
+Node: I/O Callback Example\7f214245
+Node: I/O Callback Example GTK+\7f220464
+Node: I/O Callback Example GDK\7f222253
+Node: I/O Callback Example Qt\7f223895
+Node: Cancellation\7f226183
+Node: UI Server Protocol\7f228436
+Ref: UI Server Protocol-Footnote-1\7f229867
+Node: UI Server Encrypt\7f229986
+Node: UI Server Sign\7f235246
+Node: UI Server Decrypt\7f237554
+Node: UI Server Verify\7f238992
+Node: UI Server Set Input Files\7f242494
+Node: UI Server Sign/Encrypt Files\7f243294
+Node: UI Server Verify/Decrypt Files\7f245063
+Node: UI Server Import/Export Keys\7f246909
+Node: UI Server Checksum Files\7f247942
+Node: Miscellaneous UI Server Commands\7f250108
+Ref: command SENDER\7f252020
+Node: Debugging\7f253696
+Node: Library Copying\7f255351
+Node: Copying\7f283468
+Node: Function and Data Index\7f321099
+Node: Concept Index\7f346851
\1f
End Tag Table
This file documents the GPGME library.
- This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
-Easy' Reference Manual', for Version 1.4.2.
+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
+Made Easy' Reference Manual', for Version 1.4.3.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
Main Menu
*********
-This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
-Easy' Reference Manual', for Version 1.4.2 of the GPGME library.
+This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG Made
+Easy' Reference Manual', for Version 1.4.3 of the GPGME library.
* Menu:
* Data Buffer I/O Operations:: I/O operations on data buffers.
* Data Buffer Meta-Data:: Meta-data manipulation of data buffers.
+* Data Buffer Convenience:: Convenience fucntion for data buffers.
\1f
File: gpgme.info, Node: Data Buffer I/O Operations, Next: Data Buffer Meta-Data, Up: Manipulating Data Buffers
? gpgme_error_from_errno (errno) : 0;
\1f
-File: gpgme.info, Node: Data Buffer Meta-Data, Prev: Data Buffer I/O Operations, Up: Manipulating Data Buffers
+File: gpgme.info, Node: Data Buffer Meta-Data, Next: Data Buffer Convenience, Prev: Data Buffer I/O Operations, Up: Manipulating Data Buffers
6.3.2 Data Buffer Meta-Data
---------------------------
data object with the handle DH to ENC.
\1f
+File: gpgme.info, Node: Data Buffer Convenience, Prev: Data Buffer Meta-Data, Up: Manipulating Data Buffers
+
+6.3.3 Data Buffer Convenience Functions
+---------------------------------------
+
+ -- Data type: enum gpgme_data_type_t
+ The `gpgme_data_type_t' type is used to return the detected type
+ of the content of a data buffer.
+
+`GPGME_DATA_TYPE_INVALID'
+ This is returned by `gpgme_data_identify' if it was not possible
+ to identify the data. Reasons for this might be a non-seekable
+ stream or a memory problem. The value is 0.
+
+`GPGME_DATA_TYPE_UNKNOWN'
+ The type of the data is not known.
+
+`GPGME_DATA_TYPE_PGP_SIGNED'
+ The data is an OpenPGP signed message. This may be a binary
+ signature, a detached one or a cleartext signature.
+
+`GPGME_DATA_TYPE_PGP_OTHER'
+ This is a generic OpenPGP message. In most cases this will be
+ encrypted data.
+
+`GPGME_DATA_TYPE_PGP_KEY'
+ This is an OpenPGP key (private or public).
+
+`GPGME_DATA_TYPE_CMS_SIGNED'
+ This is a CMS signed message.
+
+`GPGME_DATA_TYPE_CMS_ENCRYPTED'
+ This is a CMS encrypted (enveloped data) message.
+
+`GPGME_DATA_TYPE_CMS_OTHER'
+ This is used for other CMS message types.
+
+`GPGME_DATA_TYPE_X509_CERT'
+ The data is a X.509 certificate
+
+`GPGME_DATA_TYPE_PKCS12'
+ The data is a PKCS#12 message. This is commonly used to exchange
+ private keys for X.509.
+
+ -- Function: gpgme_data_type_t gpgme_data_identify (gpgme_data_t DH)
+ The function `gpgme_data_identify' returns the type of the data
+ with the handle DH. If it is not possible to perform the
+ identification, the function returns zero
+ (`GPGME_DATA_TYPE_INVALID'). Note that depending on how the data
+ object has been created the identification may not be possible or
+ the data object may change its internal state (file pointer
+ moved). For file or memory based data object, the state should
+ not change.
+
+\1f
File: gpgme.info, Node: Contexts, Next: UI Server Protocol, Prev: Exchanging Data, Up: Top
7 Contexts
Calling this function acquires an additional reference for the key.
+ -- Function: unsigned int gpgme_signers_count (const gpgme_ctx_t CTX)
+ The function `gpgme_signers_count' returns the number of signer
+ keys in the context CTX.
+
-- Function: gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t CTX,
int SEQ)
The function `gpgme_signers_enum' returns the SEQth key in the
encoding specified for CIPHER) and the text mode attributes set
for the context CTX.
- KEY must be a `NULL'-terminated array of keys. The user must keep
- references for all keys during the whole duration of the call (but
- see `gpgme_op_encrypt_start' for the requirements with the
+ RECP must be a `NULL'-terminated array of keys. The user must
+ keep references for all keys during the whole duration of the call
+ (but see `gpgme_op_encrypt_start' for the requirements with the
asynchronous variant).
The value in FLAGS is a bitwise-or combination of one or multiple
implement the `GETINFO pid' command. Sending this command a second
time replaces the file descriptor set by the last one.
- -- Command: OUTPUT FD=N
+ -- Command: OUTPUT FD=N [-binary]
Set the file descriptor to be used for the output (i.e. the
- encrypted message) to N. For OpenPGP, the output needs to be
- ASCII armored; for CMS, the output needs to be Base-64 encoded.
+ encrypted message) to N. If the option `--binary' is given the
+ output shall be in binary format; if not given, the output for
+ OpenPGP needs to be ASCII armored and for CMS Base-64 encoded.
For details on the file descriptor, see the `INPUT' command.
The setting of the recipients, the data source and destination may
file descriptor, see the description of `INPUT' in the `ENCRYPT'
section.
- -- Command: OUTPUT FD=N
+ -- Command: OUTPUT FD=N [-binary]
Set the file descriptor to be used for the output. The output is
either the complete signed message or in case of a detached
- signature just that detached signature. For OpenPGP, the output
- needs to be ASCII armored; for CMS, the output needs to be Base-64
+ signature just that detached signature. If the option `--binary'
+ is given the output shall be in binary format; if not given, the
+ output for OpenPGP needs to be ASCII armored and for CMS Base-64
encoded. For details on the file descriptor, see the `INPUT'
command.
This file documents the GPGME library.
- This is Edition 1.4.2, last updated 28 May 2013, of `The `GnuPG Made
-Easy' Reference Manual', for Version 1.4.2.
+ This is Edition 1.4.3, last updated 9 August 2013, of `The `GnuPG
+Made Easy' Reference Manual', for Version 1.4.3.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012,
2013 g10 Code GmbH.
(line 10)
* DECRYPT_VERIFY_FILES: UI Server Verify/Decrypt Files.
(line 12)
-* ENCRYPT: UI Server Encrypt. (line 46)
+* ENCRYPT: UI Server Encrypt. (line 47)
* ENCRYPT_FILES: UI Server Sign/Encrypt Files.
(line 10)
* ENCRYPT_SIGN_FILES: UI Server Sign/Encrypt Files.
(line 12)
* enum gpgme_data_encoding_t: Data Buffer Meta-Data.
(line 28)
+* enum gpgme_data_type_t: Data Buffer Convenience.
+ (line 7)
* enum gpgme_event_io_t: I/O Callback Interface.
(line 57)
* enum gpgme_hash_algo_t: Hash Algorithms. (line 10)
(line 69)
* gpgme_data_get_file_name: Data Buffer Meta-Data.
(line 7)
+* gpgme_data_identify: Data Buffer Convenience.
+ (line 46)
* gpgme_data_new: Memory Based Data Buffers.
(line 13)
* gpgme_data_new_from_cbs: Callback Based Data Buffers.
* gpgme_data_set_file_name: Data Buffer Meta-Data.
(line 18)
* gpgme_data_t: Exchanging Data. (line 14)
+* gpgme_data_type_t: Data Buffer Convenience.
+ (line 7)
* gpgme_data_write: Data Buffer I/O Operations.
(line 18)
* gpgme_data_write_cb_t: Callback Based Data Buffers.
* gpgme_signature_t: Verify. (line 92)
* gpgme_signers_add: Selecting Signers. (line 15)
* gpgme_signers_clear: Selecting Signers. (line 7)
-* gpgme_signers_enum: Selecting Signers. (line 22)
+* gpgme_signers_count: Selecting Signers. (line 21)
+* gpgme_signers_enum: Selecting Signers. (line 26)
* gpgme_ssize_t: Exchanging Data. (line 31)
* gpgme_strerror: Error Strings. (line 7)
* gpgme_strerror_r: Error Strings. (line 17)
* INPUT <3>: UI Server Sign. (line 13)
* INPUT: UI Server Encrypt. (line 23)
* MESSAGE: UI Server Verify. (line 11)
-* MICALG: UI Server Sign. (line 43)
+* MICALG: UI Server Sign. (line 44)
* off_t (*gpgme_data_seek_cb_t) (void *HANDLE, off_t OFFSET, int WHENCE): Callback Based Data Buffers.
(line 44)
* OUTPUT <1>: UI Server Verify. (line 24)
* OUTPUT <2>: UI Server Decrypt. (line 20)
* OUTPUT <3>: UI Server Sign. (line 19)
* OUTPUT: UI Server Encrypt. (line 36)
-* PREP_ENCRYPT: UI Server Encrypt. (line 72)
-* PROTOCOL: UI Server Encrypt. (line 97)
+* PREP_ENCRYPT: UI Server Encrypt. (line 73)
+* PROTOCOL: UI Server Encrypt. (line 98)
* RECIPIENT: UI Server Encrypt. (line 10)
* SENDER: Miscellaneous UI Server Commands.
(line 51)
* SESSION: Miscellaneous UI Server Commands.
(line 70)
-* SIGN: UI Server Sign. (line 33)
+* SIGN: UI Server Sign. (line 34)
* SIGN_FILES: UI Server Sign/Encrypt Files.
(line 11)
* SIGSTATUS: UI Server Verify. (line 59)
* cryptographic operation, verification: Verify. (line 6)
* cryptographic operation, wait for: Waiting For Completion.
(line 6)
+* data buffer, convenience: Data Buffer Convenience.
+ (line 6)
* data buffer, creation: Creating Data Buffers. (line 6)
* data buffer, destruction: Destroying Data Buffers.
(line 6)
(line 6)
* hash algorithms: Hash Algorithms. (line 6)
* header file: Header. (line 6)
+* identify: Data Buffer Convenience.
+ (line 6)
* include file: Header. (line 6)
* key listing: Listing Keys. (line 6)
* key listing mode: Key Listing Mode. (line 6)
(line 6)
* trust item, manipulation: Manipulating Trust Items.
(line 6)
+* type of data: Data Buffer Convenience.
+ (line 6)
* UI server: UI Server Protocol. (line 6)
* user interface server: UI Server Protocol. (line 6)
* verification: Verify. (line 6)
@menu
* Data Buffer I/O Operations:: I/O operations on data buffers.
* Data Buffer Meta-Data:: Meta-data manipulation of data buffers.
+* Data Buffer Convenience:: Convenience fucntion for data buffers.
@end menu
the data object with the handle @var{dh} to @var{enc}.
@end deftypefun
+@node Data Buffer Convenience
+@subsection Data Buffer Convenience Functions
+@cindex data buffer, convenience
+@cindex type of data
+@cindex identify
+
+@deftp {Data type} {enum gpgme_data_type_t}
+@tindex gpgme_data_type_t
+The @code{gpgme_data_type_t} type is used to return the detected type
+of the content of a data buffer.
+@end deftp
+
+@table @code
+@item GPGME_DATA_TYPE_INVALID
+This is returned by @code{gpgme_data_identify} if it was not possible
+to identify the data. Reasons for this might be a non-seekable stream
+or a memory problem. The value is 0.
+@item GPGME_DATA_TYPE_UNKNOWN
+The type of the data is not known.
+@item GPGME_DATA_TYPE_PGP_SIGNED
+The data is an OpenPGP signed message. This may be a binary
+signature, a detached one or a cleartext signature.
+@item GPGME_DATA_TYPE_PGP_OTHER
+This is a generic OpenPGP message. In most cases this will be
+encrypted data.
+@item GPGME_DATA_TYPE_PGP_KEY
+This is an OpenPGP key (private or public).
+@item GPGME_DATA_TYPE_CMS_SIGNED
+This is a CMS signed message.
+@item GPGME_DATA_TYPE_CMS_ENCRYPTED
+This is a CMS encrypted (enveloped data) message.
+@item GPGME_DATA_TYPE_CMS_OTHER
+This is used for other CMS message types.
+@item GPGME_DATA_TYPE_X509_CERT
+The data is a X.509 certificate
+@item GPGME_DATA_TYPE_PKCS12
+The data is a PKCS#12 message. This is commonly used to exchange
+private keys for X.509.
+@end table
+
+@deftypefun gpgme_data_type_t gpgme_data_identify (@w{gpgme_data_t @var{dh}})
+The function @code{gpgme_data_identify} returns the type of the data
+with the handle @var{dh}. If it is not possible to perform the
+identification, the function returns zero
+(@code{GPGME_DATA_TYPE_INVALID}). Note that depending on how the data
+object has been created the identification may not be possible or the
+data object may change its internal state (file pointer moved). For
+file or memory based data object, the state should not change.
+@end deftypefun
+
@c
@c Chapter Contexts
Calling this function acquires an additional reference for the key.
@end deftypefun
+@deftypefun @w{unsigned int} gpgme_signers_count (@w{const gpgme_ctx_t @var{ctx}})
+The function @code{gpgme_signers_count} returns the number of signer keys in
+the context @var{ctx}.
+@end deftypefun
+
@deftypefun gpgme_key_t gpgme_signers_enum (@w{const gpgme_ctx_t @var{ctx}}, @w{int @var{seq}})
The function @code{gpgme_signers_enum} returns the @var{seq}th key in
the list of signers in the context @var{ctx}. An additional reference
that is not set, by the encoding specified for @var{cipher}) and the
text mode attributes set for the context @var{ctx}.
-@var{key} must be a @code{NULL}-terminated array of keys. The user
+@var{recp} must be a @code{NULL}-terminated array of keys. The user
must keep references for all keys during the whole duration of the
call (but see @code{gpgme_op_encrypt_start} for the requirements with
the asynchronous variant).
-@set UPDATED 28 May 2013
-@set UPDATED-MONTH May 2013
-@set EDITION 1.4.2
-@set VERSION 1.4.2
+@set UPDATED 9 August 2013
+@set UPDATED-MONTH August 2013
+@set EDITION 1.4.3
+@set VERSION 1.4.3
@deffn Command INPUT FD=@var{n}
Set the file descriptor for the message to be encrypted to @var{n}. The
-message send to the server is binary encoded.
+message send to the server is binary encoded.
GpgOL is a Windows only program, thus @var{n} is not a libc file
descriptor but a regular system handle. Given that the Assuan
@c %Libassuan manual}, on how to do descriptor passing.
@end deffn
-@deffn Command OUTPUT FD=@var{n}
+@deffn Command OUTPUT FD=@var{n} [--binary]
Set the file descriptor to be used for the output (i.e. the encrypted
-message) to @var{n}. For OpenPGP, the output needs to be ASCII armored;
-for CMS, the output needs to be Base-64 encoded. For details on the
-file descriptor, see the @code{INPUT} command.
+message) to @var{n}. If the option @code{--binary} is given the
+output shall be in binary format; if not given, the output for OpenPGP
+needs to be ASCII armored and for CMS Base-64 encoded. For details on
+the file descriptor, see the @code{INPUT} command.
@end deffn
-@noindent
+@noindent
The setting of the recipients, the data source and destination may
happen in any order, even intermixed. If this has been done the actual
encryption operation is called using:
section.
@end deffn
-@deffn Command OUTPUT FD=@var{n}
-Set the file descriptor to be used for the output. The output is either
-the complete signed message or in case of a detached signature just that
-detached signature. For OpenPGP, the output needs to be ASCII armored;
-for CMS, the output needs to be Base-64 encoded. For details on the
-file descriptor, see the @code{INPUT} command.
+@deffn Command OUTPUT FD=@var{n} [--binary]
+Set the file descriptor to be used for the output. The output is
+either the complete signed message or in case of a detached signature
+just that detached signature. If the option @code{--binary} is given
+the output shall be in binary format; if not given, the output for
+OpenPGP needs to be ASCII armored and for CMS Base-64 encoded. For
+details on the file descriptor, see the @code{INPUT} command.
@end deffn
@noindent
@noindent
The signing operation is then initiated by:
-@deffn Command SIGN -@w{}-protocol=@var{name} [-@w{}-detached]
+@deffn Command SIGN -@w{}-protocol=@var{name} [-@w{}-detached]
Sign the data set with the @code{INPUT} command and write it to the sink
set by OUTPUT. @var{name} is the signing protocol used for the
message. For a description of the allowed protocols see the
The server needs to support the verification of opaque signatures as
well as detached signatures. The kind of input sources controls what
-kind message is to be verified.
+kind message is to be verified.
@deffn Command MESSAGE FD=@var{n}
This command is used with detached signatures to set the file descriptor
@table @asis
@item MESSAGE and INPUT
This indicates a detached signature. Output data is not applicable.
-@item INPUT
+@item INPUT
This indicates an opaque signature. As no output command has been given,
the server is only required to check the signature.
@item INPUT and OUTPUT
The signature is valid but additional information was shown regarding the
validity of the key.
@item red
-The signature is not valid.
+The signature is not valid.
@end table
@var{displaystring} is a percent-and-plus-encoded string with a short
To allow the server to pop up the windows in the correct relation to the
client, the client is advised to tell the server by sending the option:
-@deffn {Command option} window-id @var{number}
+@deffn {Command option} window-id @var{number}
The @var{number} represents the native window ID of the clients current
window. On Windows systems this is a windows handle (@code{HWND}) and
on X11 systems it is the @code{X Window ID}. The number needs to be
which signing protocol should be preferred.
@end deffn
-@noindent
+@noindent
To allow the UI-server to visually identify a running operation or to
associate operations the server MAY support the command:
-@set UPDATED 28 May 2013
-@set UPDATED-MONTH May 2013
-@set EDITION 1.4.2
-@set VERSION 1.4.2
+@set UPDATED 9 August 2013
+@set UPDATED-MONTH August 2013
+@set EDITION 1.4.3
+@set VERSION 1.4.3
# This is a template. The dist target uses it to create the real file.
Summary: GPGME - GnuPG Made Easy
Name: gpgme
-Version: 1.4.2
+Version: 1.4.3
Release: 1
URL: http://www.gnupg.org/gpgme.html
Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz
(defsystem gpgme
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
- :version "1.4.2"
+ :version "1.4.3"
:licence "GPL"
:depends-on ("cffi" "gpg-error")
:components ((:file "gpgme-package")
# unresolved symbols to the thread module.
main_sources = \
util.h conversion.c get-env.c context.h ops.h \
+ parsetlv.c parsetlv.h \
data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
- data-compat.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 \
$(uiserver_components) \
$(g13_components) vfs-mount.c vfs-create.c \
gpgconf.c \
- sema.h priv-io.h $(system_components) dirinfo.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) \
LTLIBRARIES = $(lib_LTLIBRARIES)
@HAVE_W32_SYSTEM_TRUE@am__DEPENDENCIES_1 = versioninfo.lo
am__libgpgme_glib_la_SOURCES_DIST = util.h conversion.c get-env.c \
- context.h ops.h data.h data.c data-fd.c data-stream.c \
- data-mem.c data-user.c data-compat.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 trust-item.c trustlist.c import.c export.c genkey.c \
- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
- engine-backend.h engine.c engine-gpg.c status-table.c \
- engine-gpgsm.c assuan-support.c engine-assuan.c \
- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
- vfs-create.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 dirinfo.c debug.c debug.h gpgme.c version.c error.c \
- ath.c w32-glib-io.c
+ context.h ops.h parsetlv.c parsetlv.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 trust-item.c \
+ trustlist.c import.c export.c genkey.c delete.c edit.c \
+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
+ assuan-support.c engine-assuan.c engine-gpgconf.c \
+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.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
@HAVE_GPGSM_TRUE@am__objects_1 = engine-gpgsm.lo
@HAVE_ASSUAN_TRUE@am__objects_2 = assuan-support.lo engine-assuan.lo
@HAVE_GPGCONF_TRUE@am__objects_3 = engine-gpgconf.lo
@HAVE_DOSISH_SYSTEM_FALSE@ posix-io.lo $(am__objects_6)
@HAVE_DOSISH_SYSTEM_TRUE@am__objects_7 = w32-util.lo w32-sema.lo \
@HAVE_DOSISH_SYSTEM_TRUE@ $(am__objects_6)
-am__objects_8 = conversion.lo get-env.lo data.lo data-fd.lo \
- data-stream.lo data-mem.lo data-user.lo data-compat.lo \
- signers.lo sig-notation.lo wait.lo wait-global.lo \
- wait-private.lo wait-user.lo op-support.lo encrypt.lo \
- encrypt-sign.lo decrypt.lo decrypt-verify.lo verify.lo sign.lo \
- passphrase.lo progress.lo key.lo keylist.lo trust-item.lo \
- trustlist.lo import.lo export.lo genkey.lo delete.lo edit.lo \
- getauditlog.lo opassuan.lo passwd.lo engine.lo engine-gpg.lo \
- status-table.lo $(am__objects_1) $(am__objects_2) \
- $(am__objects_3) $(am__objects_4) $(am__objects_5) \
- vfs-mount.lo vfs-create.lo gpgconf.lo $(am__objects_7) \
- dirinfo.lo debug.lo gpgme.lo version.lo error.lo
+am__objects_8 = conversion.lo get-env.lo parsetlv.lo data.lo \
+ data-fd.lo data-stream.lo data-mem.lo data-user.lo \
+ data-compat.lo data-identify.lo signers.lo sig-notation.lo \
+ wait.lo wait-global.lo wait-private.lo wait-user.lo \
+ op-support.lo encrypt.lo encrypt-sign.lo decrypt.lo \
+ decrypt-verify.lo verify.lo sign.lo passphrase.lo progress.lo \
+ key.lo keylist.lo trust-item.lo trustlist.lo import.lo \
+ export.lo genkey.lo delete.lo edit.lo getauditlog.lo \
+ opassuan.lo passwd.lo engine.lo engine-gpg.lo status-table.lo \
+ $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+ $(am__objects_4) $(am__objects_5) vfs-mount.lo vfs-create.lo \
+ gpgconf.lo $(am__objects_7) dirinfo.lo debug.lo gpgme.lo \
+ version.lo error.lo
@BUILD_W32_GLIB_TRUE@am_libgpgme_glib_la_OBJECTS = $(am__objects_8) \
@BUILD_W32_GLIB_TRUE@ ath.lo w32-glib-io.lo
libgpgme_glib_la_OBJECTS = $(am_libgpgme_glib_la_OBJECTS)
$(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 get-env.c \
- context.h ops.h data.h data.c data-fd.c data-stream.c \
- data-mem.c data-user.c data-compat.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 trust-item.c trustlist.c import.c export.c genkey.c \
- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
- engine-backend.h engine.c engine-gpg.c status-table.c \
- engine-gpgsm.c assuan-support.c engine-assuan.c \
- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
- vfs-create.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 dirinfo.c debug.c debug.h gpgme.c version.c error.c \
+ context.h ops.h parsetlv.c parsetlv.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 trust-item.c \
+ trustlist.c import.c export.c genkey.c delete.c edit.c \
+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
+ assuan-support.c engine-assuan.c engine-gpgconf.c \
+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.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_9 = w32-io.lo
am_libgpgme_pthread_la_OBJECTS = $(am__objects_8) ath-pthread.lo \
$(libgpgme_pthread_la_LDFLAGS) $(LDFLAGS) -o $@
@HAVE_PTHREAD_TRUE@am_libgpgme_pthread_la_rpath = -rpath $(libdir)
am__libgpgme_qt_la_SOURCES_DIST = util.h conversion.c get-env.c \
- context.h ops.h data.h data.c data-fd.c data-stream.c \
- data-mem.c data-user.c data-compat.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 trust-item.c trustlist.c import.c export.c genkey.c \
- delete.c edit.c getauditlog.c opassuan.c passwd.c engine.h \
- engine-backend.h engine.c engine-gpg.c status-table.c \
- engine-gpgsm.c assuan-support.c engine-assuan.c \
- engine-gpgconf.c engine-uiserver.c engine-g13.c vfs-mount.c \
- vfs-create.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 dirinfo.c debug.c debug.h gpgme.c version.c error.c \
- ath.c w32-qt-io.cpp kdpipeiodevice.h kdpipeiodevice.cpp \
+ context.h ops.h parsetlv.c parsetlv.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 trust-item.c \
+ trustlist.c import.c export.c genkey.c delete.c edit.c \
+ getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
+ engine.c engine-gpg.c status-table.c engine-gpgsm.c \
+ assuan-support.c engine-assuan.c engine-gpgconf.c \
+ engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.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-qt-io.cpp kdpipeiodevice.h kdpipeiodevice.cpp \
kdpipeiodevice.moc
@BUILD_W32_QT_TRUE@am_libgpgme_qt_la_OBJECTS = $(am__objects_8) ath.lo \
@BUILD_W32_QT_TRUE@ w32-qt-io.lo kdpipeiodevice.lo
$(CXXFLAGS) $(libgpgme_qt_la_LDFLAGS) $(LDFLAGS) -o $@
@BUILD_W32_QT_TRUE@am_libgpgme_qt_la_rpath = -rpath $(libdir)
am__libgpgme_la_SOURCES_DIST = util.h conversion.c get-env.c context.h \
- ops.h data.h data.c data-fd.c data-stream.c data-mem.c \
- data-user.c data-compat.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 trust-item.c \
+ ops.h parsetlv.c parsetlv.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 trust-item.c \
trustlist.c import.c export.c genkey.c delete.c edit.c \
getauditlog.c opassuan.c passwd.c engine.h engine-backend.h \
engine.c engine-gpg.c status-table.c engine-gpgsm.c \
assuan-support.c engine-assuan.c engine-gpgconf.c \
engine-uiserver.c engine-g13.c vfs-mount.c vfs-create.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 dirinfo.c \
- debug.c debug.h gpgme.c version.c error.c ath.c w32-io.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_8) ath.lo $(am__objects_9)
libgpgme_la_OBJECTS = $(am_libgpgme_la_OBJECTS)
libgpgme_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
# unresolved symbols to the thread module.
main_sources = \
util.h conversion.c get-env.c context.h ops.h \
+ parsetlv.c parsetlv.h \
data.h data.c data-fd.c data-stream.c data-mem.c data-user.c \
- data-compat.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 \
$(uiserver_components) \
$(g13_components) vfs-mount.c vfs-create.c \
gpgconf.c \
- sema.h priv-io.h $(system_components) dirinfo.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) \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conversion.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-compat.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-fd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-identify.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-mem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-stream.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data-user.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keylist.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/op-support.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opassuan.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsetlv.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@
--- /dev/null
+/* data-identify.c - Try to identify the data
+ Copyright (C) 2013 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/>.
+ */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "gpgme.h"
+#include "data.h"
+#include "util.h"
+#include "parsetlv.h"
+
+/* The size of the sample data we take for detection. */
+#define SAMPLE_SIZE 2048
+
+
+
+/* Note that DATA may be binary but a final nul is required so that
+ string operations will find a terminator.
+
+ Returns: GPGME_DATA_TYPE_xxxx */
+static gpgme_data_type_t
+basic_detection (const char *data, size_t datalen)
+{
+ tlvinfo_t ti;
+ const char *s;
+ size_t n;
+ int maybe_p12 = 0;
+
+ if (datalen < 24) /* Object is probably too short for detection. */
+ return GPGME_DATA_TYPE_UNKNOWN;
+
+ /* This is a common example of a CMS object - it is obvious that we
+ only need to read a few bytes to get to the OID:
+ 30 82 0B 59 06 09 2A 86 48 86 F7 0D 01 07 02 A0 82 0B 4A 30 82 0B 46 02
+ ----------- ++++++++++++++++++++++++++++++++
+ SEQUENCE OID (signedData)
+ (2 byte len)
+
+ A PKCS#12 message is:
+
+ 30 82 08 59 02 01 03 30 82 08 1F 06 09 2A 86 48 86 F7 0D 01 07 01 A0 82
+ ----------- ++++++++ ----------- ++++++++++++++++++++++++++++++++
+ SEQUENCE INTEGER SEQUENCE OID (data)
+
+ A X.509 certificate is:
+
+ 30 82 05 B8 30 82 04 A0 A0 03 02 01 02 02 07 15 46 A0 BF 30 07 39 30 0D
+ ----------- +++++++++++ ----- ++++++++ --------------------------
+ SEQUENCE SEQUENCE [0] INTEGER INTEGER SEQU
+ (tbs) (version) (s/n) (Algo)
+
+ Thus we need to read at least 22 bytes, we add 2 bytes to cope with
+ length headers stored with 4 bytes.
+ */
+
+
+ s = data;
+ n = datalen;
+
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp; /* Not properly BER encoded. */
+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
+ && ti.is_cons))
+ goto try_pgp; /* A CMS object always starts with a sequence. */
+
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp; /* Not properly BER encoded. */
+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
+ && ti.is_cons && n >= ti.length)
+ {
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp;
+ if (!(ti.cls == ASN1_CLASS_CONTEXT && ti.tag == 0
+ && ti.is_cons && ti.length == 3 && n >= ti.length))
+ goto try_pgp;
+
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp;
+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
+ && !ti.is_cons && ti.length == 1 && n && (*s == 1 || *s == 2)))
+ goto try_pgp;
+ s++;
+ n--;
+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
+ && !ti.is_cons))
+ goto try_pgp;
+ /* Because the now following S/N may be larger than the sample
+ data we have, we stop parsing here and don't check for the
+ algorithm ID. */
+ return GPGME_DATA_TYPE_X509_CERT;
+ }
+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_INTEGER
+ && !ti.is_cons && ti.length == 1 && n && *s == 3)
+ {
+ maybe_p12 = 1;
+ s++;
+ n--;
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp;
+ if (!(ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_SEQUENCE
+ && ti.is_cons))
+ goto try_pgp;
+ if (parse_tlv (&s, &n, &ti))
+ goto try_pgp;
+ }
+ if (ti.cls == ASN1_CLASS_UNIVERSAL && ti.tag == ASN1_TAG_OBJECT_ID
+ && !ti.is_cons && ti.length && n >= ti.length)
+ {
+ if (ti.length == 9)
+ {
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x01", 9))
+ {
+ /* Data. */
+ return (maybe_p12 ? GPGME_DATA_TYPE_PKCS12
+ /* */ : GPGME_DATA_TYPE_CMS_OTHER);
+ }
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02", 9))
+ {
+ /* Signed Data. */
+ return (maybe_p12 ? GPGME_DATA_TYPE_PKCS12
+ /* */ : GPGME_DATA_TYPE_CMS_SIGNED);
+ }
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x03", 9))
+ return GPGME_DATA_TYPE_CMS_ENCRYPTED; /* Enveloped Data. */
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x05", 9))
+ return GPGME_DATA_TYPE_CMS_OTHER; /* Digested Data. */
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x07\x06", 9))
+ return GPGME_DATA_TYPE_CMS_OTHER; /* Encrypted Data. */
+ }
+ else if (ti.length == 11)
+ {
+ if (!memcmp (s, "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x10\x01\x02", 11))
+ return GPGME_DATA_TYPE_CMS_OTHER; /* Auth Data. */
+ }
+ }
+
+
+ try_pgp:
+ /* Check whether this might be a non-armored PGP message. We need
+ to do this before checking for armor lines, so that we don't get
+ fooled by armored messages inside a signed binary PGP message. */
+ if ((data[0] & 0x80))
+ {
+ /* That might be a binary PGP message. At least it is not plain
+ ASCII. Of course this might be certain lead-in text of
+ armored CMS messages. However, I am not sure whether this is
+ at all defined and in any case it is uncommon. Thus we don't
+ do any further plausibility checks but stupidly assume no CMS
+ armored data will follow. */
+ return GPGME_DATA_TYPE_UNKNOWN;
+ }
+
+ /* Now check whether there are armor lines. */
+ for (s = data; s && *s; s = (*s=='\n')?(s+1):((s=strchr (s,'\n'))?(s+1):s))
+ {
+ if (!strncmp (s, "-----BEGIN ", 11))
+ {
+ if (!strncmp (s+11, "SIGNED ", 7))
+ return GPGME_DATA_TYPE_CMS_SIGNED;
+ if (!strncmp (s+11, "ENCRYPTED ", 10))
+ return GPGME_DATA_TYPE_CMS_ENCRYPTED;
+ if (!strncmp (s+11, "PGP ", 4))
+ {
+ if (!strncmp (s+15, "SIGNATURE", 9))
+ return GPGME_DATA_TYPE_PGP_SIGNED;
+ if (!strncmp (s+15, "SIGNED MESSAGE", 14))
+ return GPGME_DATA_TYPE_PGP_SIGNED;
+ if (!strncmp (s+15, "PUBLIC KEY BLOCK", 16))
+ return GPGME_DATA_TYPE_PGP_KEY;
+ if (!strncmp (s+15, "PRIVATE KEY BLOCK", 17))
+ return GPGME_DATA_TYPE_PGP_KEY;
+ if (!strncmp (s+15, "SECRET KEY BLOCK", 16))
+ return GPGME_DATA_TYPE_PGP_KEY;
+ if (!strncmp (s+15, "ARMORED FILE", 12))
+ return GPGME_DATA_TYPE_UNKNOWN;
+ return GPGME_DATA_TYPE_PGP_OTHER; /* PGP MESSAGE */
+ }
+ if (!strncmp (s+11, "CERTIFICATE", 11))
+ return GPGME_DATA_TYPE_X509_CERT;
+ if (!strncmp (s+11, "PKCS12", 6))
+ return GPGME_DATA_TYPE_PKCS12;
+ return GPGME_DATA_TYPE_CMS_OTHER; /* Not PGP, thus we assume CMS. */
+ }
+ }
+
+ return GPGME_DATA_TYPE_UNKNOWN;
+}
+
+
+/* Try to detect the type of the data. Note that this function works
+ only on seekable data objects. The function tries to reset the
+ file pointer but there is no guarantee that it will work.
+
+ FIXME: We may want to add internal buffering so that this function
+ can be implemented for allmost all kind of data objects.
+ */
+gpgme_data_type_t
+gpgme_data_identify (gpgme_data_t dh, int reserved)
+{
+ gpgme_data_type_t result;
+ char *sample;
+ int n;
+ gpgme_off_t off;
+
+ /* Check whether we can seek the data object. */
+ off = gpgme_data_seek (dh, 0, SEEK_CUR);
+ if (off == (gpgme_off_t)(-1))
+ return GPGME_DATA_TYPE_INVALID;
+
+ /* Allocate a buffer and read the data. */
+ sample = malloc (SAMPLE_SIZE);
+ if (!sample)
+ return GPGME_DATA_TYPE_INVALID; /* Ooops. */
+ n = gpgme_data_read (dh, sample, SAMPLE_SIZE - 1);
+ if (n < 0)
+ {
+ free (sample);
+ return GPGME_DATA_TYPE_INVALID; /* Ooops. */
+ }
+ sample[n] = 0; /* (Required for our string functions.) */
+
+ result = basic_detection (sample, n);
+ free (sample);
+ gpgme_data_seek (dh, off, SEEK_SET);
+
+ return result;
+}
/* dirinfo.c - Get directory information
- * Copyright (C) 2009 g10 Code GmbH
+ * Copyright (C) 2009, 2013 g10 Code GmbH
*
* This file is part of GPGME.
*
#include "priv-io.h"
#include "debug.h"
#include "sema.h"
+#include "sys-util.h"
DEFINE_STATIC_LOCK (dirinfo_lock);
enum
{
WANT_HOMEDIR,
- WANT_AGENT_SOCKET
+ WANT_AGENT_SOCKET,
+ WANT_GPG_NAME,
+ WANT_GPGSM_NAME,
+ WANT_G13_NAME,
+ WANT_UISRV_SOCKET
};
/* Values retrieved via gpgconf and cached here. */
int valid; /* Cached information is valid. */
char *homedir;
char *agent_socket;
+ char *gpg_name;
+ char *gpgsm_name;
+ char *g13_name;
+ char *uisrv_socket;
} dirinfo;
/* Parse the output of "gpgconf --list-dirs". This function expects
- that DIRINFO_LOCK is held by the caller. */
+ that DIRINFO_LOCK is held by the caller. If COMPONENTS is set, the
+ output of --list-components is expected. */
static void
-parse_output (char *line)
+parse_output (char *line, int components)
{
char *value, *p;
if (!value)
return;
*value++ = 0;
+ if (components)
+ {
+ /* Skip the second field. */
+ value = strchr (value, ':');
+ if (!value)
+ return;
+ *value++ = 0;
+ }
p = strchr (value, ':');
if (p)
*p = 0;
if (!*value)
return;
- if (!strcmp (line, "homedir") && !dirinfo.homedir)
- dirinfo.homedir = strdup (value);
- else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket)
- dirinfo.agent_socket = strdup (value);
+ if (components)
+ {
+ if (!strcmp (line, "gpg") && !dirinfo.gpg_name)
+ dirinfo.gpg_name = strdup (value);
+ else if (!strcmp (line, "gpgsm") && !dirinfo.gpgsm_name)
+ dirinfo.gpgsm_name = strdup (value);
+ else if (!strcmp (line, "g13") && !dirinfo.g13_name)
+ dirinfo.g13_name = strdup (value);
+ }
+ else
+ {
+ if (!strcmp (line, "homedir") && !dirinfo.homedir)
+ {
+ const char name[] = "S.uiserver";
+
+ dirinfo.homedir = strdup (value);
+ if (dirinfo.homedir)
+ {
+ dirinfo.uisrv_socket = malloc (strlen (dirinfo
+ .homedir)
+ + 1 + strlen (name) + 1);
+ if (dirinfo.uisrv_socket)
+ strcpy (stpcpy (stpcpy (dirinfo.uisrv_socket, dirinfo.homedir),
+ DIRSEP_S), name);
+ }
+ }
+ else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket)
+ dirinfo.agent_socket = strdup (value);
+ }
}
/* Read the directory information from gpgconf. This function expects
- that DIRINFO_LOCK is held by the caller. */
+ that DIRINFO_LOCK is held by the caller. PGNAME is the name of the
+ gpgconf binary. If COMPONENTS is set, not the directories bit the
+ name of the componeNts are read. */
static void
-read_gpgconf_dirs (void)
+read_gpgconf_dirs (const char *pgmname, int components)
{
- const char *pgmname;
char linebuf[1024] = {0};
int linelen = 0;
char * argv[3];
int nread;
char *mark = NULL;
- pgmname = _gpgme_get_gpgconf_path ();
- if (!pgmname)
- return; /* No way. */
-
argv[0] = (char *)pgmname;
- argv[1] = "--list-dirs";
+ argv[1] = components? "--list-components" : "--list-dirs";
argv[2] = NULL;
if (_gpgme_io_pipe (rp, 1) < 0)
else
mark[0] = '\0';
- parse_output (line);
+ parse_output (line, components);
}
nused = lastmark? (lastmark + 1 - linebuf) : 0;
static const char *
-get_gpgconf_dir (int what)
+get_gpgconf_item (int what)
{
const char *result = NULL;
LOCK (dirinfo_lock);
if (!dirinfo.valid)
{
- read_gpgconf_dirs ();
+ const char *pgmname;
+
+ pgmname = _gpgme_get_gpgconf_path ();
+ if (pgmname && access (pgmname, F_OK))
+ {
+ _gpgme_debug (DEBUG_INIT,
+ "gpgme_dinfo: gpgconf='%s' [not installed]\n", pgmname);
+ pgmname = NULL; /* Not available. */
+ }
+ else
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgconf='%s'\n",
+ pgmname? pgmname : "[null]");
+ if (!pgmname)
+ {
+ /* Probably gpgconf is not installed. Assume we are using
+ GnuPG-1. */
+ pgmname = _gpgme_get_gpg_path ();
+ if (pgmname)
+ dirinfo.gpg_name = strdup (pgmname);
+ }
+ else
+ {
+ read_gpgconf_dirs (pgmname, 0);
+ read_gpgconf_dirs (pgmname, 1);
+ }
/* Even if the reading of the directories failed (e.g. due to an
too old version gpgconf or no gpgconf at all), we need to
mark the entries as valid so that we won't try over and over
the read values later because they are practically statically
allocated. */
dirinfo.valid = 1;
+ if (dirinfo.gpg_name)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpg='%s'\n",
+ dirinfo.gpg_name);
+ if (dirinfo.g13_name)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: g13='%s'\n",
+ dirinfo.g13_name);
+ if (dirinfo.gpgsm_name)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgsm='%s'\n",
+ dirinfo.gpgsm_name);
+ if (dirinfo.homedir)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: homedir='%s'\n",
+ dirinfo.homedir);
+ if (dirinfo.agent_socket)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: agent='%s'\n",
+ dirinfo.agent_socket);
+ if (dirinfo.uisrv_socket)
+ _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: uisrv='%s'\n",
+ dirinfo.uisrv_socket);
}
switch (what)
{
case WANT_HOMEDIR: result = dirinfo.homedir; break;
case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break;
+ case WANT_GPG_NAME: result = dirinfo.gpg_name; break;
+ case WANT_GPGSM_NAME: result = dirinfo.gpgsm_name; break;
+ case WANT_G13_NAME: result = dirinfo.g13_name; break;
+ case WANT_UISRV_SOCKET: result = dirinfo.uisrv_socket; break;
}
UNLOCK (dirinfo_lock);
return result;
const char *
_gpgme_get_default_homedir (void)
{
- return get_gpgconf_dir (WANT_HOMEDIR);
+ return get_gpgconf_item (WANT_HOMEDIR);
}
/* Return the default gpg-agent socket name. Returns NULL if not known. */
const char *
_gpgme_get_default_agent_socket (void)
{
- return get_gpgconf_dir (WANT_AGENT_SOCKET);
+ return get_gpgconf_item (WANT_AGENT_SOCKET);
+}
+
+/* Return the default gpg file name. Returns NULL if not known. */
+const char *
+_gpgme_get_default_gpg_name (void)
+{
+ return get_gpgconf_item (WANT_GPG_NAME);
+}
+
+/* Return the default gpgsm file name. Returns NULL if not known. */
+const char *
+_gpgme_get_default_gpgsm_name (void)
+{
+ return get_gpgconf_item (WANT_GPGSM_NAME);
+}
+
+/* Return the default g13 file name. Returns NULL if not known. */
+const char *
+_gpgme_get_default_g13_name (void)
+{
+ return get_gpgconf_item (WANT_G13_NAME);
}
+/* Return the default gpgconf file name. Returns NULL if not known.
+ Because gpgconf is the binary used to retrieved all these default
+ names, this function is merely a simple wrapper around the function
+ used to locate this binary. */
+const char *
+_gpgme_get_default_gpgconf_name (void)
+{
+ return _gpgme_get_gpgconf_path ();
+}
+
+/* Return the default UI-server socket name. Returns NULL if not
+ known. */
+const char *
+_gpgme_get_default_uisrv_socket (void)
+{
+ return get_gpgconf_item (WANT_UISRV_SOCKET);
+}
g13_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
- : _gpgme_get_g13_path ());
+ : _gpgme_get_default_g13_name ());
}
#if USE_DESCRIPTOR_PASSING
err = assuan_pipe_connect
- (g13->assuan_ctx, file_name ? file_name : _gpgme_get_g13_path (),
+ (g13->assuan_ctx, file_name ? file_name : _gpgme_get_default_g13_name (),
argv, NULL, NULL, NULL, ASSUAN_PIPE_CONNECT_FDPASSING);
#else
err = assuan_pipe_connect
- (g13->assuan_ctx, file_name ? file_name : _gpgme_get_g13_path (),
+ (g13->assuan_ctx, file_name ? file_name : _gpgme_get_default_g13_name (),
argv, NULL, NULL, NULL, 0);
#endif
if (err)
struct engine_ops _gpgme_engine_ops_g13 =
{
/* Static functions. */
- _gpgme_get_g13_path,
+ _gpgme_get_default_g13_name,
NULL,
g13_get_version,
g13_get_req_version,
gpg_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
- : _gpgme_get_gpg_path ());
+ : _gpgme_get_default_gpg_name ());
}
if (!gpg)
return gpg_error (GPG_ERR_INV_VALUE);
- if (!gpg->file_name && !_gpgme_get_gpg_path ())
+ if (!gpg->file_name && !_gpgme_get_default_gpg_name ())
return trace_gpg_error (GPG_ERR_INV_ENGINE);
if (gpg->lc_ctype)
fd_list[n].dup_to = -1;
status = _gpgme_io_spawn (gpg->file_name ? gpg->file_name :
- _gpgme_get_gpg_path (), gpg->argv,
+ _gpgme_get_default_gpg_name (), gpg->argv,
IOSPAWN_FLAG_ALLOW_SET_FG,
fd_list, NULL, NULL, &pid);
{
struct engine_ops _gpgme_engine_ops_gpg =
{
/* Static functions. */
- _gpgme_get_gpg_path,
+ _gpgme_get_default_gpg_name,
NULL,
gpg_get_version,
gpg_get_req_version,
gpgconf_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
- : _gpgme_get_gpgconf_path ());
+ : _gpgme_get_default_gpgconf_name ());
}
return gpg_error_from_syserror ();
gpgconf->file_name = strdup (file_name ? file_name
- : _gpgme_get_gpgconf_path ());
+ : _gpgme_get_default_gpgconf_name ());
if (!gpgconf->file_name)
err = gpg_error_from_syserror ();
struct engine_ops _gpgme_engine_ops_gpgconf =
{
/* Static functions. */
- _gpgme_get_gpgconf_path,
+ _gpgme_get_default_gpgconf_name,
NULL,
gpgconf_get_version,
gpgconf_get_req_version,
gpgsm_get_version (const char *file_name)
{
return _gpgme_get_program_version (file_name ? file_name
- : _gpgme_get_gpgsm_path ());
+ : _gpgme_get_default_gpgsm_name ());
}
#if USE_DESCRIPTOR_PASSING
err = assuan_pipe_connect
- (gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
+ (gpgsm->assuan_ctx,
+ file_name ? file_name : _gpgme_get_default_gpgsm_name (),
argv, NULL, NULL, NULL, ASSUAN_PIPE_CONNECT_FDPASSING);
#else
{
achild_fds[i] = (assuan_fd_t) child_fds[i];
err = assuan_pipe_connect
- (gpgsm->assuan_ctx, file_name ? file_name : _gpgme_get_gpgsm_path (),
+ (gpgsm->assuan_ctx,
+ file_name ? file_name : _gpgme_get_default_gpgsm_name (),
argv, achild_fds, NULL, NULL, 0);
/* For now... */
struct engine_ops _gpgme_engine_ops_gpgsm =
{
/* Static functions. */
- _gpgme_get_gpgsm_path,
+ _gpgme_get_default_gpgsm_name,
NULL,
gpgsm_get_version,
gpgsm_get_req_version,
err = assuan_socket_connect (uiserver->assuan_ctx,
file_name ?
- file_name : _gpgme_get_uiserver_socket_path (),
+ file_name : _gpgme_get_default_uisrv_socket (),
0, ASSUAN_SOCKET_SERVER_FDPASSING);
if (err)
goto leave;
struct engine_ops _gpgme_engine_ops_uiserver =
{
/* Static functions. */
- _gpgme_get_uiserver_socket_path,
+ _gpgme_get_default_uisrv_socket,
NULL,
uiserver_get_version,
uiserver_get_req_version,
STATUS_INCLUDE_CERTS,
STATUS_KEYLIST_MODE,
STATUS_RECIPIENT,
- STATUS_ENCRYPT_RESULT
+ STATUS_ENCRYPT_RESULT,
+ STATUS_IDENTIFY_RESULT
} status_t;
const char *status_string[] =
"INCLUDE_CERTS",
"KEYLIST_MODE",
"RECIPIENT",
- "ENCRYPT_RESULT"
+ "ENCRYPT_RESULT",
+ "IDENTIFY_RESULT"
};
struct gpgme_tool
}
-static const char hlp_passwd[] =
- "PASSWD <user-id>\n"
- "\n"
- "Ask the backend to change the passphrase for the key\n"
- "specified by USER-ID.";
gpg_error_t
gt_passwd (gpgme_tool_t gt, char *fpr)
{
}
+gpg_error_t
+gt_identify (gpgme_tool_t gt, gpgme_data_t data)
+{
+ const char *s = "?";
+
+ switch (gpgme_data_identify (data, 0))
+ {
+ case GPGME_DATA_TYPE_INVALID: return gpg_error (GPG_ERR_GENERAL);
+ case GPGME_DATA_TYPE_UNKNOWN : s = "unknown"; break;
+ case GPGME_DATA_TYPE_PGP_SIGNED : s = "PGP-signed"; break;
+ case GPGME_DATA_TYPE_PGP_OTHER : s = "PGP"; break;
+ case GPGME_DATA_TYPE_PGP_KEY : s = "PGP-key"; break;
+ case GPGME_DATA_TYPE_CMS_SIGNED : s = "CMS-signed"; break;
+ case GPGME_DATA_TYPE_CMS_ENCRYPTED: s = "CMS-encrypted"; break;
+ case GPGME_DATA_TYPE_CMS_OTHER : s = "CMS"; break;
+ case GPGME_DATA_TYPE_X509_CERT : s = "X.509"; break;
+ case GPGME_DATA_TYPE_PKCS12 : s = "PKCS12"; break;
+ }
+ gt_write_status (gt, STATUS_IDENTIFY_RESULT, s, NULL);
+ return 0;
+}
+
+
#define GT_RESULT_ENCRYPT 0x1
#define GT_RESULT_DECRYPT 0x2
#define GT_RESULT_SIGN 0x4
}
+static const char hlp_passwd[] =
+ "PASSWD <user-id>\n"
+ "\n"
+ "Ask the backend to change the passphrase for the key\n"
+ "specified by USER-ID.";
static gpg_error_t
cmd_passwd (assuan_context_t ctx, char *line)
{
}
+static const char hlp_identify[] =
+ "IDENTIY\n"
+ "\n"
+ "Identify the type of data set with the INPUT command.";
+static gpg_error_t
+cmd_identify (assuan_context_t ctx, char *line)
+{
+ struct server *server = assuan_get_pointer (ctx);
+ gpg_error_t err;
+ assuan_fd_t inp_fd;
+ char *inp_fn;
+ gpgme_data_t inp_data;
+
+ inp_fd = server->input_fd;
+ inp_fn = server->input_filename;
+ if (inp_fd == ASSUAN_INVALID_FD && !inp_fn)
+ return GPG_ERR_ASS_NO_INPUT;
+
+ err = server_data_obj (inp_fd, inp_fn, 0, server->input_enc, &inp_data,
+ &server->input_stream);
+ if (err)
+ return err;
+
+ err = gt_identify (server->gt, inp_data);
+
+ gpgme_data_release (inp_data);
+ server_reset_fds (server);
+
+ return err;
+}
+
+
+
/* Tell the assuan library about our commands. */
static gpg_error_t
register_commands (assuan_context_t ctx)
{ "PUBKEY_ALGO_NAME", cmd_pubkey_algo_name },
{ "HASH_ALGO_NAME", cmd_hash_algo_name },
{ "PASSWD", cmd_passwd, hlp_passwd },
+ { "IDENTIFY", cmd_identify, hlp_identify },
{ NULL }
};
int idx;
gpgme_set_pinentry_mode @158
gpgme_get_pinentry_mode @159
+ gpgme_signers_count @160
+
+ gpgme_data_identify @161
+
; END
}
gpgme_data_encoding_t;
+/* Known data types. */
+typedef enum
+ {
+ GPGME_DATA_TYPE_INVALID = 0, /* Not detected. */
+ GPGME_DATA_TYPE_UNKNOWN = 1,
+ GPGME_DATA_TYPE_PGP_SIGNED = 0x10,
+ GPGME_DATA_TYPE_PGP_OTHER = 0x12,
+ GPGME_DATA_TYPE_PGP_KEY = 0x13,
+ GPGME_DATA_TYPE_CMS_SIGNED = 0x20,
+ GPGME_DATA_TYPE_CMS_ENCRYPTED= 0x21,
+ GPGME_DATA_TYPE_CMS_OTHER = 0x22,
+ GPGME_DATA_TYPE_X509_CERT = 0x23,
+ GPGME_DATA_TYPE_PKCS12 = 0x24,
+ }
+gpgme_data_type_t;
+
\f
/* Public key algorithms from libgcrypt. */
typedef enum
/* Add KEY to list of signers in CTX. */
gpgme_error_t gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key);
+/* Return the number of signers in CTX. */
+unsigned int gpgme_signers_count (const gpgme_ctx_t ctx);
+
/* Return the SEQth signer's key in CTX. */
gpgme_key_t gpgme_signers_enum (const gpgme_ctx_t ctx, int seq);
gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh,
const char *file_name);
+/* Try to identify the type of the data in DH. */
+gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved);
+
/* Create a new data buffer which retrieves the data from the callback
function READ_CB. Deprecated, please use gpgme_data_new_from_cbs
gpgme_data_set_file_name;
gpgme_data_get_file_name;
+ gpgme_data_identify;
gpgme_sig_notation_clear;
gpgme_sig_notation_add;
gpgme_set_textmode;
gpgme_signers_add;
gpgme_signers_clear;
+ gpgme_signers_count;
gpgme_signers_enum;
gpgme_key_ref;
--- /dev/null
+/* parsetlv.c - ASN.1 TLV functions
+ * Copyright (C) 2005, 2007, 2008, 2012 g10 Code GmbH
+ *
+ * This file 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.
+ *
+ * This file 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/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "parsetlv.h"
+
+
+/* Simple but pretty complete ASN.1 BER parser. Parse the data at the
+ address of BUFFER with a length given at the address of SIZE. On
+ success return 0 and update BUFFER and SIZE to point to the value.
+ Do not update them on error. The information about the object are
+ stored in the caller allocated TI structure. */
+int
+_gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti)
+{
+ int c;
+ unsigned long tag;
+ const unsigned char *buf = (const unsigned char *)(*buffer);
+ size_t length = *size;
+
+ ti->cls = 0;
+ ti->tag = 0;
+ ti->is_cons = 0;
+ ti->is_ndef = 0;
+ ti->length = 0;
+ ti->nhdr = 0;
+
+ if (!length)
+ return -1;
+ c = *buf++; length--; ++ti->nhdr;
+
+ ti->cls = (c & 0xc0) >> 6;
+ ti->is_cons = !!(c & 0x20);
+ tag = c & 0x1f;
+
+ if (tag == 0x1f)
+ {
+ tag = 0;
+ do
+ {
+ tag <<= 7;
+ if (!length)
+ return -1;
+ c = *buf++; length--; ++ti->nhdr;
+ tag |= c & 0x7f;
+ }
+ while (c & 0x80);
+ }
+ ti->tag = tag;
+
+ if (!length)
+ return -1;
+ c = *buf++; length--; ++ti->nhdr;
+
+ if ( !(c & 0x80) )
+ ti->length = c;
+ else if (c == 0x80)
+ ti->is_ndef = 1;
+ else if (c == 0xff)
+ return -1;
+ else
+ {
+ unsigned long len = 0;
+ int count = (c & 0x7f);
+
+ if (count > sizeof (len) || count > sizeof (size_t))
+ return -1;
+
+ for (; count; count--)
+ {
+ len <<= 8;
+ if (!length)
+ return -1;
+ c = *buf++; length--; ++ti->nhdr;
+ len |= c & 0xff;
+ }
+ ti->length = len;
+ }
+
+ *buffer = (void*)buf;
+ *size = length;
+ return 0;
+}
--- /dev/null
+/* parsetlv.h - TLV functions defintions
+ * Copyright (C) 2012 g10 Code GmbH
+ *
+ * This file 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.
+ *
+ * This file 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/>.
+ */
+
+#ifndef PARSETLV_H
+#define PARSETLV_H
+
+/* ASN.1 constants. */
+#define ASN1_CLASS_UNIVERSAL 0
+#define ASN1_CLASS_APPLICATION 1
+#define ASN1_CLASS_CONTEXT 2
+#define ASN1_CLASS_PRIVATE 3
+#define ASN1_TAG_INTEGER 2
+#define ASN1_TAG_OBJECT_ID 6
+#define ASN1_TAG_SEQUENCE 16
+
+
+/* Object used with parse_tlv. */
+struct tlvinfo_s
+{
+ int cls; /* The class of the tag. */
+ int tag; /* The tag. */
+ int is_cons; /* True if it is a constructed object. */
+ int is_ndef; /* True if the object has an indefinite length. */
+ size_t length; /* The length of the value. */
+ size_t nhdr; /* The number of octets in the header (tag,length). */
+};
+typedef struct tlvinfo_s tlvinfo_t;
+
+/*-- parsetlv.c --*/
+int _gpgme_parse_tlv (char const **buffer, size_t *size, tlvinfo_t *ti);
+#define parse_tlv(a,b,c) _gpgme_parse_tlv ((a), (b), (c))
+
+
+#endif /*PARSETLV_H*/
#include <assert.h>
#include "util.h"
+#include "sys-util.h"
const char *
_gpgme_get_gpg_path (void)
}
-const char *
-_gpgme_get_uiserver_socket_path (void)
-{
- static char *socket_path;
- const char *homedir;
- const char name[] = "S.uiserver";
-
- if (socket_path)
- return socket_path;
-
- homedir = _gpgme_get_default_homedir ();
- if (! homedir)
- return NULL;
-
- socket_path = malloc (strlen (homedir) + 1 + strlen (name) + 1);
- if (! socket_path)
- return NULL;
-
- strcpy (stpcpy (stpcpy (socket_path, homedir), "/"), name);
- return socket_path;
-}
-
-
/* See w32-util.c */
int
_gpgme_get_conf_int (const char *key, int *value)
}
+/* Return the number of signers in CTX. */
+unsigned int
+gpgme_signers_count (const gpgme_ctx_t ctx)
+{
+ return ctx? ctx->signers_len : 0;
+}
+
+
/* Return the SEQth signer's key in CTX with one reference. */
gpgme_key_t
gpgme_signers_enum (const gpgme_ctx_t ctx, int seq)
--- /dev/null
+/* sys-util.h - System utilities not generally used.
+ * Copyright (C) 2013 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/>.
+ */
+
+#ifndef SYS_UTIL_H
+#define SYS_UTIL_H
+
+/*-- {posix,w32}-util.c --*/
+const char *_gpgme_get_gpg_path (void);
+const char *_gpgme_get_gpgsm_path (void);
+const char *_gpgme_get_gpgconf_path (void);
+const char *_gpgme_get_g13_path (void);
+
+#endif /* SYS_UTIL_H */
\f
/*-- {posix,w32}-util.c --*/
-const char *_gpgme_get_gpg_path (void);
-const char *_gpgme_get_gpgsm_path (void);
-const char *_gpgme_get_gpgconf_path (void);
-const char *_gpgme_get_g13_path (void);
-const char *_gpgme_get_uiserver_socket_path (void);
-
int _gpgme_get_conf_int (const char *key, int *value);
void _gpgme_allow_set_foreground_window (pid_t pid);
/*-- dirinfo.c --*/
const char *_gpgme_get_default_homedir (void);
const char *_gpgme_get_default_agent_socket (void);
+const char *_gpgme_get_default_gpg_name (void);
+const char *_gpgme_get_default_gpgsm_name (void);
+const char *_gpgme_get_default_g13_name (void);
+const char *_gpgme_get_default_gpgconf_name (void);
+const char *_gpgme_get_default_uisrv_socket (void);
\f
/* w32-util.c - Utility functions for the W32 API
- Copyright (C) 1999 Free Software Foundation, Inc
- Copyright (C) 2001 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2003, 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. */
+ * Copyright (C) 1999 Free Software Foundation, Inc
+ * Copyright (C) 2001 Werner Koch (dd9jn)
+ * Copyright (C) 2001, 2002, 2003, 2004, 2007, 2013 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/>.
+ **/
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "ath.h"
#include "sema.h"
#include "debug.h"
+#include "sys-util.h"
#ifndef HAVE_W32CE_SYSTEM
DEFINE_STATIC_LOCK (get_path_lock);
+/* The module handle of this DLL. If we are linked statically,
+ dllmain does not exists and thus the value of my_hmodule will be
+ NULL. The effect is that a GetModuleFileName always returns the
+ file name of the DLL or executable which contains the gpgme code. */
+static HMODULE my_hmodule;
+
#ifdef HAVE_ALLOW_SET_FOREGROUND_WINDOW
}
#endif /* HAVE_ALLOW_SET_FOREGROUND_WINDOW */
+
+/* Return a malloced string encoded in UTF-8 from the wide char input
+ string STRING. Caller must free this value. Returns NULL and sets
+ ERRNO on failure. Calling this function with STRING set to NULL is
+ not defined. */
+static char *
+wchar_to_utf8 (const wchar_t *string)
+{
+ int n;
+ char *result;
+
+ n = WideCharToMultiByte (CP_UTF8, 0, string, -1, NULL, 0, NULL, NULL);
+ if (n < 0)
+ {
+ gpg_err_set_errno (EINVAL);
+ return NULL;
+ }
+
+ result = malloc (n+1);
+ if (!result)
+ return NULL;
+
+ n = WideCharToMultiByte (CP_UTF8, 0, string, -1, result, n, NULL, NULL);
+ if (n < 0)
+ {
+ free (result);
+ gpg_err_set_errno (EINVAL);
+ result = NULL;
+ }
+ return result;
+}
+
+
void
_gpgme_allow_set_foreground_window (pid_t pid)
{
}
-#if 0
-static char *
-find_program_in_registry (const char *name)
+/* Return the name of the directory with the gpgme DLL or the EXE (if
+ statically linked). May return NULL on severe errors. */
+const char *
+_gpgme_get_inst_dir (void)
{
- char *program = NULL;
+ static char *inst_dir;
- program = read_w32_registry_string (NULL, "Software\\GNU\\GnuPG", name);
- if (program)
+ LOCK (get_path_lock);
+ if (!inst_dir)
{
- int i;
+ wchar_t *moddir;
- TRACE2 (DEBUG_CTX, "gpgme:find_program_in_registry", 0,
- "found %s in registry: `%s'", name, program);
- for (i = 0; program[i]; i++)
- {
- if (program[i] == '/')
- program[i] = '\\';
- }
+ moddir = malloc ((MAX_PATH+5) * sizeof *moddir);
+ if (moddir)
+ {
+ if (!GetModuleFileNameW (my_hmodule, moddir, MAX_PATH))
+ *moddir = 0;
+ if (!*moddir)
+ gpg_err_set_errno (ENOENT);
+ else
+ {
+ inst_dir = wchar_to_utf8 (moddir);
+ if (inst_dir)
+ {
+ char *p = strrchr (inst_dir, '\\');
+ if (p)
+ *p = 0;
+ }
+ }
+ free (moddir);
+ }
}
- return program;
+ UNLOCK (get_path_lock);
+ return inst_dir;
}
-#endif
static char *
-find_program_in_inst_dir (const char *name)
+find_program_in_dir (const char *dir, const char *name)
{
- char *result = NULL;
- char *tmp;
-
- tmp = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
- "Software\\GNU\\GnuPG",
- "Install Directory");
- if (!tmp)
- return NULL;
+ char *result;
- result = malloc (strlen (tmp) + 1 + strlen (name) + 1);
+ result = malloc (strlen (dir) + 1 + strlen (name) + 1);
if (!result)
- {
- free (tmp);
- return NULL;
- }
+ return NULL;
- strcpy (stpcpy (stpcpy (result, tmp), "\\"), name);
- free (tmp);
+ strcpy (stpcpy (stpcpy (result, dir), "\\"), name);
if (access (result, F_OK))
{
free (result);
static char *
+find_program_in_inst_dir (const char *inst_dir, const char *name)
+{
+ char *result;
+ char *dir;
+
+ /* If an installation directory has been passed, this overrides a
+ location given bu the registry. The idea here is that we prefer
+ a a program installed alongside with gpgme. We don't want the
+ registry to override this to have a better isolation of an gpgme
+ aware applications for other effects. Note that the "Install
+ Directory" registry item has been used for ages in Gpg4win and
+ earlier GnuPG windows installers. It is technically not anymore
+ required. */
+ if (inst_dir)
+ {
+ result = find_program_in_dir (inst_dir, name);
+ if (result)
+ return result;
+ }
+
+ dir = read_w32_registry_string ("HKEY_LOCAL_MACHINE",
+ "Software\\GNU\\GnuPG",
+ "Install Directory");
+ if (dir)
+ {
+ result = find_program_in_dir (dir, name);
+ free (dir);
+ return result;
+ }
+ return NULL;
+}
+
+
+static char *
find_program_at_standard_place (const char *name)
{
char path[MAX_PATH];
_gpgme_get_gpg_path (void)
{
static char *gpg_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
-#if 0
if (!gpg_program)
- gpg_program = find_program_in_registry ("gpgProgram");
-#endif
- if (!gpg_program)
- gpg_program = find_program_in_inst_dir ("gpg.exe");
+ gpg_program = find_program_in_inst_dir (inst_dir, "gpg.exe");
if (!gpg_program)
gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
UNLOCK (get_path_lock);
_gpgme_get_gpgsm_path (void)
{
static char *gpgsm_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
-#if 0
if (!gpgsm_program)
- gpgsm_program = find_program_in_registry ("gpgsmProgram");
-#endif
- if (!gpgsm_program)
- gpgsm_program = find_program_in_inst_dir ("gpgsm.exe");
+ gpgsm_program = find_program_in_inst_dir (inst_dir, "gpgsm.exe");
if (!gpgsm_program)
gpgsm_program = find_program_at_standard_place ("GNU\\GnuPG\\gpgsm.exe");
UNLOCK (get_path_lock);
_gpgme_get_gpgconf_path (void)
{
static char *gpgconf_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
-#if 0
- if (!gpgconf_program)
- gpgconf_program = find_program_in_registry ("gpgconfProgram");
-#endif
if (!gpgconf_program)
- gpgconf_program = find_program_in_inst_dir ("gpgconf.exe");
+ gpgconf_program = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
if (!gpgconf_program)
gpgconf_program
= find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
_gpgme_get_g13_path (void)
{
static char *g13_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
-#if 0
if (!g13_program)
- g13_program = find_program_in_registry ("g13Program");
-#endif
- if (!g13_program)
- g13_program = find_program_in_inst_dir ("g13.exe");
+ g13_program = find_program_in_inst_dir (inst_dir, "g13.exe");
if (!g13_program)
g13_program = find_program_at_standard_place ("GNU\\GnuPG\\g13.exe");
UNLOCK (get_path_lock);
const char *
-_gpgme_get_uiserver_socket_path (void)
-{
- static char *socket_path;
- const char *homedir;
- const char name[] = "S.uiserver";
-
- if (socket_path)
- return socket_path;
-
- homedir = _gpgme_get_default_homedir ();
- if (! homedir)
- return NULL;
-
- socket_path = malloc (strlen (homedir) + 1 + strlen (name) + 1);
- if (! socket_path)
- return NULL;
-
- strcpy (stpcpy (stpcpy (socket_path, homedir), "\\"), name);
- return socket_path;
-}
-
-
-const char *
_gpgme_get_w32spawn_path (void)
{
static char *w32spawn_program;
+ const char *inst_dir;
+ inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock);
if (!w32spawn_program)
- w32spawn_program = find_program_in_inst_dir ("gpgme-w32spawn.exe");
+ w32spawn_program = find_program_in_inst_dir (inst_dir,"gpgme-w32spawn.exe");
if (!w32spawn_program)
w32spawn_program
= find_program_at_standard_place ("GNU\\GnuPG\\gpgme-w32spawn.exe");
return tmp;
}
#endif /*HAVE_W32CE_SYSTEM*/
+
+
+/* Entry point called by the DLL loader. */
+#ifdef DLL_EXPORT
+int WINAPI
+DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
+{
+ (void)reserved;
+
+ if (reason == DLL_PROCESS_ATTACH)
+ my_hmodule = hinst;
+
+ return TRUE;
+}
+#endif /*DLL_EXPORT*/
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2004, 2005, 2009 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
## Process this file with automake to produce Makefile.in
GPG = @GPG@
+GPG_AGENT = @GPG_AGENT@
-TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO=
# The keylist tests must come after the import and the edit test.
noinst_HEADERS = t-support.h
tests_unix = t-eventloop t-thread1
endif
-TESTS = t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \
+c_tests = \
+ 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 $(tests_unix)
+TESTS = initial.test $(c_tests) final.test
+
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
- random_seed
+ random_seed S.gpg-agent
+
+private_keys = \
+ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
+ 76F7E2B35832976B50A27A282D9B87E44577EB66 \
+ A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
+ 13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
+ 7A030357C0F253A5BBCD282FFC4E521B37558F5C
-EXTRA_DIST = pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
- geheim.txt pubkey-1.asc seckey-1.asc pinentry
+
+EXTRA_DIST = start-stop-agent initial.test final.test \
+ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
+ geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys)
INCLUDES = -I$(top_builddir)/src
t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread
# We don't run t-genkey in the test suite, because it takes too long
-noinst_PROGRAMS = $(TESTS) t-genkey
+noinst_PROGRAMS = $(c_tests) t-genkey
clean-local:
- -gpg-connect-agent KILLAGENT /bye
+ -$(srcdir)/start-stop-agent --stop
-rm -fR private-keys-v1.d
-all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg
+all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \
+ ./private-keys-v1.d/gpg-sample.stamp
export GNUPGHOME := $(abs_builddir)
-export GPG_AGENT_INFO :=
+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
+ for k in $(private_keys); do \
+ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
+ done
+ echo x > ./private-keys-v1.d/gpg-sample.stamp
./pubring.gpg: $(srcdir)/pubdemo.asc
-$(GPG) --no-permission-warning \
# Copyright (C) 2000 Werner Koch (dd9jn)
# Copyright (C) 2001, 2004, 2005, 2009 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
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-TESTS = t-encrypt$(EXEEXT) t-encrypt-sym$(EXEEXT) \
- t-encrypt-sign$(EXEEXT) t-sign$(EXEEXT) t-signers$(EXEEXT) \
- t-decrypt$(EXEEXT) t-verify$(EXEEXT) t-decrypt-verify$(EXEEXT) \
- t-sig-notation$(EXEEXT) t-export$(EXEEXT) t-import$(EXEEXT) \
- 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) $(am__EXEEXT_1)
+TESTS = initial.test $(am__EXEEXT_2) final.test
noinst_PROGRAMS = $(am__EXEEXT_2) t-genkey$(EXEEXT)
subdir = tests/gpg
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=
+GPG_AGENT = @GPG_AGENT@
+TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO=
# The keylist tests must come after the import and the edit test.
noinst_HEADERS = t-support.h
@HAVE_W32_SYSTEM_FALSE@tests_unix = t-eventloop t-thread1
@HAVE_W32_SYSTEM_TRUE@tests_unix =
+c_tests = \
+ 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 $(tests_unix)
+
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
- random_seed
+ random_seed S.gpg-agent
-EXTRA_DIST = pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
- geheim.txt pubkey-1.asc seckey-1.asc pinentry
+private_keys = \
+ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \
+ 76F7E2B35832976B50A27A282D9B87E44577EB66 \
+ A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD \
+ 13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F \
+ 7A030357C0F253A5BBCD282FFC4E521B37558F5C
+
+EXTRA_DIST = start-stop-agent initial.test final.test \
+ pubdemo.asc secdemo.asc cipher-1.asc cipher-2.asc \
+ geheim.txt pubkey-1.asc seckey-1.asc pinentry $(private_keys)
INCLUDES = -I$(top_builddir)/src
AM_CPPFLAGS = @GPG_ERROR_CFLAGS@
clean-local:
- -gpg-connect-agent KILLAGENT /bye
+ -$(srcdir)/start-stop-agent --stop
-rm -fR private-keys-v1.d
-all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg
+all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \
+ ./private-keys-v1.d/gpg-sample.stamp
export GNUPGHOME := $(abs_builddir)
-export GPG_AGENT_INFO :=
+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
+ for k in $(private_keys); do \
+ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \
+ done
+ echo x > ./private-keys-v1.d/gpg-sample.stamp
./pubring.gpg: $(srcdir)/pubdemo.asc
-$(GPG) --no-permission-warning \
--- /dev/null
+#!/bin/sh
+
+${srcdir}/start-stop-agent --stop
+exit 0
--- /dev/null
+#!/bin/sh
+
+${srcdir}/start-stop-agent --start
+exit 0
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2013 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved. This file is
+# distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY, to the extent permitted by law; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+if [ -z "$(command -v gpg-connect-agent)" ]; then
+ echo "gpg-agent not installed and thus not started" >&2
+ exit 0;
+fi
+
+GPG_AGENT_INFO=
+export GPG_AGENT_INFO
+
+token=$(echo "gpgme-$(pwd)" | tr ' ' '_')
+
+if [ "$1" = "--stop" ]; then
+ if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
+ != "D set" ]; then
+ echo "gpg-agent not running" >&2
+ exit 0
+ fi
+ echo "stopping gpg-agent " >&2
+ gpg-connect-agent KILLAGENT /bye >/dev/null 2>&1
+ exit 0
+fi
+
+if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
+ = "D set" ]; then
+ echo "gpg-agent already running" >&2
+ exit 0
+fi
+
+echo "starting gpg-agent " >&2
+gpg-connect-agent putval\ $token\ set /bye >/dev/null 2>&1
+if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \
+ != "D set" ]; then
+ echo "error starting gpg-agent" >&2
+ exit 1
+fi
+exit 0