2000-11-10 17:50:24 +00:00
|
|
|
|
/* t-keylist.c - regression test
|
2003-04-30 03:02:50 +00:00
|
|
|
|
Copyright (C) 2000 Werner Koch (dd9jn)
|
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README: Refer to COPYING.LESSER and "each file" instead of
COPYING.
* COPYING.LESSER: New file.
* gpgme.spec.in (%doc): Add COPYING.LESSER.
* acinclude.m4, configure.ac, Makefile.am: Change license to LGPL
2.1 or later.
* TODO: Add copyright notice.
* README.CVS: Likewise.
assuan/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README.1st: Add copyright notice.
doc/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am: Change license to LGPL.
(gpgme_TEXINFOS): Replace gpl.texi with lesser.texi.
* gpgme.texi: Change license to LGPL (also for documentation of
GPGME's license).
* lesser.texi: New file.
* gpl.texi: File removed.
gpgme/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* putc_unlocked.c, funopen.c: I just claim copyright on these
files and change their license to LGPL, because they are totally
trivial wrapper functions.
* isascii.c: Change copyright notice to the one from ctype/ctype.h
in the GNU C Library (CVS Head 2004-10-10), where isascii is
defined as a macro doing exactly the same as the function in this
file.
* memrchr.c: Update from the GNU C Library (CVS Head 2001-07-06).
* stpcpy.c: Update from the GNU C Library (CVS Head 2004-10-10).
* ath.c, ath-compat.c, ath.h, ath-pth.c, ath-pth-compat.c,
ath-pthread.c, ath-pthread-compat.c, context.h, conversion.c,
data.c, data-compat.c, data-fd.c, data.h, data-mem.c,
data-stream.c, data-user.c, debug.c, debug.h, decrypt.c,
decrypt-verify.c, delete.c, edit.c, encrypt.c, encrypt-sign.c,
engine-backend.h, engine.c, engine-gpgsm.c, engine.h, error.c,
export.c, genkey.c, get-env.c, gpgme.c, gpgme.h, import.c, io.h,
key.c, keylist.c, mkstatus, Makefile.am, ops.h, op-support.c,
passphrase.c, posix-io.c, posix-sema.c, posix-util.c, progress.c,
rungpg.c, sema.h, sign.c, signers.c, trust-item.c, trustlist.c,
util.h, verify.c, version.c, w32-io.c, w32-sema.c, w32-util.c,
wait.c, wait-global.c, wait.h, wait-private.c, wait-user.c: Change
license to LGPL.
tests/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* gpg/mkdemodirs: Add copyright notice.
* gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c,
gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c,
gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c,
gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c,
gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c,
gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c,
gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c,
gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c,
gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c,
gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c,
t-version.c: Change license to LGPL.
2004-12-07 21:13:39 +00:00
|
|
|
|
Copyright (C) 2001, 2003, 2004 g10 Code GmbH
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GPGME.
|
|
|
|
|
|
|
|
|
|
GPGME is free software; you can redistribute it and/or modify it
|
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README: Refer to COPYING.LESSER and "each file" instead of
COPYING.
* COPYING.LESSER: New file.
* gpgme.spec.in (%doc): Add COPYING.LESSER.
* acinclude.m4, configure.ac, Makefile.am: Change license to LGPL
2.1 or later.
* TODO: Add copyright notice.
* README.CVS: Likewise.
assuan/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README.1st: Add copyright notice.
doc/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am: Change license to LGPL.
(gpgme_TEXINFOS): Replace gpl.texi with lesser.texi.
* gpgme.texi: Change license to LGPL (also for documentation of
GPGME's license).
* lesser.texi: New file.
* gpl.texi: File removed.
gpgme/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* putc_unlocked.c, funopen.c: I just claim copyright on these
files and change their license to LGPL, because they are totally
trivial wrapper functions.
* isascii.c: Change copyright notice to the one from ctype/ctype.h
in the GNU C Library (CVS Head 2004-10-10), where isascii is
defined as a macro doing exactly the same as the function in this
file.
* memrchr.c: Update from the GNU C Library (CVS Head 2001-07-06).
* stpcpy.c: Update from the GNU C Library (CVS Head 2004-10-10).
* ath.c, ath-compat.c, ath.h, ath-pth.c, ath-pth-compat.c,
ath-pthread.c, ath-pthread-compat.c, context.h, conversion.c,
data.c, data-compat.c, data-fd.c, data.h, data-mem.c,
data-stream.c, data-user.c, debug.c, debug.h, decrypt.c,
decrypt-verify.c, delete.c, edit.c, encrypt.c, encrypt-sign.c,
engine-backend.h, engine.c, engine-gpgsm.c, engine.h, error.c,
export.c, genkey.c, get-env.c, gpgme.c, gpgme.h, import.c, io.h,
key.c, keylist.c, mkstatus, Makefile.am, ops.h, op-support.c,
passphrase.c, posix-io.c, posix-sema.c, posix-util.c, progress.c,
rungpg.c, sema.h, sign.c, signers.c, trust-item.c, trustlist.c,
util.h, verify.c, version.c, w32-io.c, w32-sema.c, w32-util.c,
wait.c, wait-global.c, wait.h, wait-private.c, wait-user.c: Change
license to LGPL.
tests/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* gpg/mkdemodirs: Add copyright notice.
* gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c,
gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c,
gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c,
gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c,
gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c,
gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c,
gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c,
gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c,
gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c,
gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c,
t-version.c: Change license to LGPL.
2004-12-07 21:13:39 +00:00
|
|
|
|
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.
|
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
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
|
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README: Refer to COPYING.LESSER and "each file" instead of
COPYING.
* COPYING.LESSER: New file.
* gpgme.spec.in (%doc): Add COPYING.LESSER.
* acinclude.m4, configure.ac, Makefile.am: Change license to LGPL
2.1 or later.
* TODO: Add copyright notice.
* README.CVS: Likewise.
assuan/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* README.1st: Add copyright notice.
doc/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* Makefile.am: Change license to LGPL.
(gpgme_TEXINFOS): Replace gpl.texi with lesser.texi.
* gpgme.texi: Change license to LGPL (also for documentation of
GPGME's license).
* lesser.texi: New file.
* gpl.texi: File removed.
gpgme/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* putc_unlocked.c, funopen.c: I just claim copyright on these
files and change their license to LGPL, because they are totally
trivial wrapper functions.
* isascii.c: Change copyright notice to the one from ctype/ctype.h
in the GNU C Library (CVS Head 2004-10-10), where isascii is
defined as a macro doing exactly the same as the function in this
file.
* memrchr.c: Update from the GNU C Library (CVS Head 2001-07-06).
* stpcpy.c: Update from the GNU C Library (CVS Head 2004-10-10).
* ath.c, ath-compat.c, ath.h, ath-pth.c, ath-pth-compat.c,
ath-pthread.c, ath-pthread-compat.c, context.h, conversion.c,
data.c, data-compat.c, data-fd.c, data.h, data-mem.c,
data-stream.c, data-user.c, debug.c, debug.h, decrypt.c,
decrypt-verify.c, delete.c, edit.c, encrypt.c, encrypt-sign.c,
engine-backend.h, engine.c, engine-gpgsm.c, engine.h, error.c,
export.c, genkey.c, get-env.c, gpgme.c, gpgme.h, import.c, io.h,
key.c, keylist.c, mkstatus, Makefile.am, ops.h, op-support.c,
passphrase.c, posix-io.c, posix-sema.c, posix-util.c, progress.c,
rungpg.c, sema.h, sign.c, signers.c, trust-item.c, trustlist.c,
util.h, verify.c, version.c, w32-io.c, w32-sema.c, w32-util.c,
wait.c, wait-global.c, wait.h, wait-private.c, wait-user.c: Change
license to LGPL.
tests/
2004-12-07 Marcus Brinkmann <marcus@g10code.de>
* gpg/mkdemodirs: Add copyright notice.
* gpgsm/Makefile.am, gpgsm/t-support.h, gpgsm/t-decrypt.c,
gpgsm/t-encrypt.c, gpgsm/t-export.c, gpgsm/t-genkey.c,
gpgsm/t-import.c, gpgsm/t-keylist.c, gpgsm/t-sign.c,
gpgsm/t-verify.c, gpg/Makefile.am, gpg/t-decrypt.c,
gpg/t-decrypt-verify.c, gpg/t-edit.c, gpg/t-encrypt.c,
gpg/t-encrypt-sign.c, gpg/t-encrypt-sym.c, gpg/t-eventloop.c,
gpg/t-export.c, gpg/t-genkey.c, gpg/t-import.c, gpg/t-keylist.c,
gpg/t-keylist-sig.c, gpg/t-sign.c, gpg/t-signers.c,
gpg/t-support.h, gpg/t-thread1.c, gpg/t-trustlist.c,
gpg/t-verify.c, Makefile.am, t-data.c, t-engine-info.c,
t-version.c: Change license to LGPL.
2004-12-07 21:13:39 +00:00
|
|
|
|
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. */
|
2000-11-10 17:50:24 +00:00
|
|
|
|
|
2004-02-17 17:26:20 +00:00
|
|
|
|
/* We need to include config.h so that we know whether we are building
|
|
|
|
|
with large file system (LFS) support. */
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-11-10 17:50:24 +00:00
|
|
|
|
#include <stdlib.h>
|
2003-04-30 03:02:50 +00:00
|
|
|
|
#include <stdio.h>
|
2000-11-10 17:50:24 +00:00
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2001-11-22 Marcus Brinkmann <marcus@g10code.de>
* gpg/: New directory.
* Makefile.am, t-verify.c, t-encrypt.c, t-signers.c, t-trustlist.c,
t-sign.c, t-keylist.c, t-import.c, t-genkey.c, t-export.c,
t-decrypt-verify.c, t-decrypt.c, t-version.c, t-data.c, mkdemodirs.
cipher-1.asc, cipher-2.asc, geheim.txt, pubdemo.asc, pubkey-1.asc,
secdemo.asc, seckey-1.asc): Move to sub directory gpg/.
* gpg/Makefile.am (INCLUDES): Include gpgme/, not include/ and
intl/.
(LDD): Correct relative path to gpgme library.
(TESTS): Remove t-version and t-data.
* gpg/t-verify.c, gpg/t-encrypt.c, gpg/t-signers.c, gpg/t-trustlist.c,
gpg/t-sign.c, gpg/t-keylist.c, gpg/t-import.c, gpg/t-genkey.c,
gpg/t-export.c, gpg/t-decrypt-verify.c, gpg/t-decrypt.c,
t-version.c, t-data.c): Include gpgme.h, not "../gpgme/gpgme.h".
* Makefile.am: New file.
* gpgsm/: New directory.
* gpgsm/Makefile.am: New file.
2001-11-22 03:01:26 +00:00
|
|
|
|
#include <gpgme.h>
|
2000-11-10 17:50:24 +00:00
|
|
|
|
|
2003-06-05 23:20:29 +00:00
|
|
|
|
#include "t-support.h"
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2005-10-19 08:23:23 +00:00
|
|
|
|
|
|
|
|
|
struct key_info_s
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{
|
|
|
|
|
char *fpr;
|
|
|
|
|
char *sec_keyid;
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
char *name;
|
|
|
|
|
char *comment;
|
|
|
|
|
char *email;
|
|
|
|
|
} uid[3];
|
2005-10-19 08:23:23 +00:00
|
|
|
|
int n_subkeys;
|
|
|
|
|
void (*misc_check)(struct key_info_s *keyinfo, gpgme_key_t key);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void check_whisky (struct key_info_s *keyinfo, gpgme_key_t key);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct key_info_s keys[] =
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{
|
|
|
|
|
{ "A0FF4590BB6122EDEF6E3C542D727CC768697734", "6AE6D7EE46A871F8",
|
2003-05-27 05:07:19 +00:00
|
|
|
|
{ { "Alfa Test", "demo key", "alfa@example.net" },
|
|
|
|
|
{ "Alpha Test", "demo key", "alpha@example.net" },
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ "Alice", "demo key", NULL } }, 1 },
|
|
|
|
|
{ "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", "5381EA4EE29BA37F",
|
|
|
|
|
{ { "Bob", "demo key", NULL },
|
|
|
|
|
{ "Bravo Test", "demo key", "bravo@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C", "E71E72ACBC43DA60",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Charlie Test", "demo key", "charlie@example.net" } }, 1 },
|
|
|
|
|
{ "6560C59C43D031C54D7C588EEBA9F240EB9DC9E6", "06F22880B0C45424",
|
|
|
|
|
{ { "Delta Test", "demo key", "delta@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "3531152DE293E26A07F504BC318C1FAEFAEF6D1B", "B5C79E1A7272144D",
|
|
|
|
|
{ { "Echelon", "demo key", NULL },
|
|
|
|
|
{ "Echo Test", "demo key", "echo@example.net" },
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ "Eve", "demo key", NULL } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "56D33268F7FE693FBB594762D4BF57F37372E243", "0A32EE79EE45198E",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Foxtrot Test", "demo key", "foxtrot@example.net" } }, 1 },
|
|
|
|
|
{ "C9C07DCC6621B9FB8D071B1D168410A48FC282E6", "247491CC9DCAD354",
|
|
|
|
|
{ { "Golf Test", "demo key", "golf@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "9E91CBB11E4D4135583EF90513DB965534C6E3F1", "76E26537D622AD0A",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Hotel Test", "demo key", "hotel@example.net" } }, 1 },
|
|
|
|
|
{ "CD538D6CC9FB3D745ECDA5201FE8FC6F04259677", "C1C8EFDE61F76C73",
|
|
|
|
|
{ { "India Test", "demo key", "india@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "F8F1EDC73995AB739AD54B380C820C71D2699313", "BD0B108735F8F136",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Juliet Test", "demo key", "juliet@example.net" } }, 1 },
|
|
|
|
|
{ "3FD11083779196C2ECDD9594AD1B0FAD43C2D0C7", "86CBB34A9AF64D02",
|
|
|
|
|
{ { "Kilo Test", "demo key", "kilo@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "1DDD28CEF714F5B03B8C246937CAB51FB79103F8", "0363B449FE56350C",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Lima Test", "demo key", "lima@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "2686AA191A278013992C72EBBE794852BE5CF886", "5F600A834F31EAE8",
|
|
|
|
|
{ { "Mallory", "demo key", NULL },
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ "Mike Test", "demo key", "mike@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "5AB9D6D7BAA1C95B3BAA3D9425B00FD430CEC684", "4C1D63308B70E472",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "November Test", "demo key", "november@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "43929E89F8F79381678CAE515F6356BA6D9732AC", "FF0785712681619F",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Oscar Test", "demo key", "oscar@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "6FAA9C201E5E26DCBAEC39FD5D15E01D3FF13206", "2764E18263330D9C",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Papa test", "demo key", "papa@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "A7969DA1C3297AA96D49843F1C67EC133C661C84", "6CDCFC44A029ACF4",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Quebec Test", "demo key", "quebec@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "38FBE1E4BF6A5E1242C8F6A13BDBEDB1777FBED3", "9FAB805A11D102EA",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Romeo Test", "demo key", "romeo@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "045B2334ADD69FC221076841A5E67F7FA3AE3EA1", "93B88B0F0F1B50B4",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Sierra Test", "demo key", "sierra@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "ECAC774F4EEEB0620767044A58CB9A4C85A81F38", "97B60E01101C0402",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Tango Test", "demo key", "tango@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "0DBCAD3F08843B9557C6C4D4A94C0F75653244D6", "93079B915522BDB9",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Uniform Test", "demo key", "uniform@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "E8143C489C8D41124DC40D0B47AF4B6961F04784", "04071FB807287134",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Victor Test", "demo key", "victor@example.org" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE", "D7FBB421FD6E27F6",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Whisky Test", "demo key", "whisky@example.net" } }, 3,
|
|
|
|
|
check_whisky },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", "5CC6F87F41E408BE",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "XRay Test", "demo key", "xray@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "ED9B316F78644A58D042655A9EEF34CD4B11B25F", "5ADFD255F7B080AD",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Yankee Test", "demo key", "yankee@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "23FD347A419429BACCD5E72D6BC4778054ACD246", "EF9DC276A172C881",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
{ { "Zulu Test", "demo key", "zulu@example.net" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", "087DD7E0381701C4",
|
|
|
|
|
{ { "Joe Random Hacker", "test key with passphrase \"x\"",
|
2005-10-19 08:23:23 +00:00
|
|
|
|
"joe@setq.org" } }, 1 },
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{ NULL }
|
|
|
|
|
};
|
2000-11-10 17:50:24 +00:00
|
|
|
|
|
2005-10-19 08:23:23 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
int
|
|
|
|
|
main (int argc, char **argv)
|
2000-11-10 17:50:24 +00:00
|
|
|
|
{
|
2003-05-18 20:45:24 +00:00
|
|
|
|
gpgme_error_t err;
|
|
|
|
|
gpgme_ctx_t ctx;
|
|
|
|
|
gpgme_key_t key;
|
|
|
|
|
gpgme_keylist_result_t result;
|
2003-04-30 03:02:50 +00:00
|
|
|
|
int i = 0;
|
2005-10-19 08:23:23 +00:00
|
|
|
|
int n;
|
|
|
|
|
gpgme_subkey_t subkey;
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
2003-09-14 00:30:53 +00:00
|
|
|
|
init_gpgme (GPGME_PROTOCOL_OpenPGP);
|
2003-04-30 03:02:50 +00:00
|
|
|
|
|
|
|
|
|
err = gpgme_new (&ctx);
|
|
|
|
|
fail_if_err (err);
|
2000-11-10 17:50:24 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
err = gpgme_op_keylist_start (ctx, NULL, 0);
|
2002-09-02 13:01:29 +00:00
|
|
|
|
fail_if_err (err);
|
2000-11-10 20:56:02 +00:00
|
|
|
|
|
2002-09-02 13:01:29 +00:00
|
|
|
|
while (!(err = gpgme_op_keylist_next (ctx, &key)))
|
|
|
|
|
{
|
2003-04-30 03:02:50 +00:00
|
|
|
|
if (!keys[i].fpr)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "More keys returned than expected\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2000-11-10 17:50:24 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
/* Global key flags. */
|
|
|
|
|
if (key->revoked)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly revoked\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->expired)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly expired\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->disabled)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly disabled\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->invalid)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly invalid\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (!key->can_encrypt)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly unusable for encryption\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (!key->can_sign)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly unusable for signing\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (!key->can_certify)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly unusable for certifications\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->secret)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly secret\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->protocol != GPGME_PROTOCOL_OpenPGP)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key has unexpected protocol: %s\n",
|
|
|
|
|
gpgme_get_protocol_name (key->protocol));
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->issuer_serial)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly carries issuer serial: %s\n",
|
|
|
|
|
key->issuer_serial);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->issuer_name)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly carries issuer name: %s\n",
|
|
|
|
|
key->issuer_name);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->chain_id)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key unexpectedly carries chain ID: %s\n",
|
|
|
|
|
key->chain_id);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->owner_trust != GPGME_VALIDITY_UNKNOWN)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key has unexpected owner trust: %i\n",
|
|
|
|
|
key->owner_trust);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2005-10-19 08:23:23 +00:00
|
|
|
|
|
|
|
|
|
for (n=0, subkey = key->subkeys; subkey; subkey = subkey->next)
|
|
|
|
|
n++;
|
|
|
|
|
if (!n || n-1 != keys[i].n_subkeys)
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{
|
2005-10-19 08:23:23 +00:00
|
|
|
|
fprintf (stderr, "Key `%s' has unexpected number of subkeys\n",
|
|
|
|
|
keys[i].uid[0].name);
|
2003-04-30 03:02:50 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2000-11-10 17:50:24 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
/* Primary key. */
|
|
|
|
|
if (key->subkeys->revoked)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key unexpectedly revoked\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->expired)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key unexpectedly expired\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->disabled)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key unexpectedly disabled\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->invalid)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key unexpectedly invalid\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->can_encrypt)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key unexpectedly usable for encryption\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (!key->subkeys->can_sign)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key unexpectedly unusable for signing\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (!key->subkeys->can_certify)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key unexpectedly unusable for certifications\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->secret)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key unexpectedly secret\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2009-02-04 09:51:43 +00:00
|
|
|
|
if (key->subkeys->is_cardkey)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Public key marked as card key\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->card_number)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Public key with card number set\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2003-04-30 03:02:50 +00:00
|
|
|
|
if (key->subkeys->pubkey_algo != GPGME_PK_DSA)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key has unexpected public key algo: %s\n",
|
|
|
|
|
gpgme_pubkey_algo_name (key->subkeys->pubkey_algo));
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->length != 1024)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key has unexpected length: %i\n",
|
|
|
|
|
key->subkeys->length);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (strcmp (key->subkeys->keyid, &keys[i].fpr[40 - 16]))
|
|
|
|
|
{
|
2005-10-19 08:23:23 +00:00
|
|
|
|
fprintf (stderr, "Primary key `%s' has unexpected key ID: %s\n",
|
|
|
|
|
keys[i].uid[0].name, key->subkeys->keyid);
|
2003-04-30 03:02:50 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (strcmp (key->subkeys->fpr, keys[i].fpr))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Primary key has unexpected fingerprint: %s\n",
|
|
|
|
|
key->subkeys->fpr);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->expires)
|
|
|
|
|
{
|
2005-10-19 08:23:23 +00:00
|
|
|
|
fprintf (stderr, "Primary key `%s' unexpectedly expires: %lu\n",
|
|
|
|
|
keys[i].uid[0].name, key->subkeys->expires);
|
2003-04-30 03:02:50 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2002-09-02 13:01:29 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
/* Secondary key. */
|
|
|
|
|
if (key->subkeys->next->revoked)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly revoked\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->expired)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly expired\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->disabled)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly disabled\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->invalid)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly invalid\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (!key->subkeys->next->can_encrypt)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly unusable for encryption\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->can_sign)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly usable for signing\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->can_certify)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly usable for certifications\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->secret)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly secret\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2009-02-04 09:51:43 +00:00
|
|
|
|
if (key->subkeys->next->is_cardkey)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary public key marked as card key\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->card_number)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary public key with card number set\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2003-04-30 03:02:50 +00:00
|
|
|
|
if (key->subkeys->next->pubkey_algo != GPGME_PK_ELG_E)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key has unexpected public key algo: %s\n",
|
|
|
|
|
gpgme_pubkey_algo_name (key->subkeys->next->pubkey_algo));
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->length != 1024)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key has unexpected length: %i\n",
|
|
|
|
|
key->subkeys->next->length);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (strcmp (key->subkeys->next->keyid, keys[i].sec_keyid))
|
|
|
|
|
{
|
2005-10-19 08:23:23 +00:00
|
|
|
|
fprintf (stderr, "Secondary key `%s' has unexpected key ID: %s/%s\n",
|
|
|
|
|
keys[i].uid[0].name,
|
|
|
|
|
key->subkeys->next->keyid, keys[i].sec_keyid );
|
2003-04-30 03:02:50 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2005-12-06 16:30:21 +00:00
|
|
|
|
if (!key->subkeys->next->fpr)
|
2003-04-30 03:02:50 +00:00
|
|
|
|
{
|
2005-12-06 16:30:21 +00:00
|
|
|
|
fprintf (stderr, "Secondary key has unexpectedly no fingerprint\n");
|
2003-04-30 03:02:50 +00:00
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->subkeys->next->expires)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Secondary key unexpectedly expires: %lu\n",
|
|
|
|
|
key->subkeys->next->expires);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
2001-09-17 10:36:05 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
/* FIXME: The below test will crash if we want to check for a
|
|
|
|
|
name, comment or email that doesn't exist in the key's user
|
|
|
|
|
IDs. */
|
|
|
|
|
if (!((!keys[i].uid[0].name && !key->uids)
|
|
|
|
|
|| (keys[i].uid[0].name && !keys[i].uid[1].name
|
|
|
|
|
&& key->uids && !key->uids->next)
|
|
|
|
|
|| (keys[i].uid[0].name && keys[i].uid[1].name
|
|
|
|
|
&& !keys[i].uid[2].name
|
|
|
|
|
&& key->uids && key->uids->next && !key->uids->next->next)
|
|
|
|
|
|| (keys[i].uid[0].name && keys[i].uid[1].name
|
|
|
|
|
&& keys[i].uid[2].name
|
|
|
|
|
&& key->uids && key->uids->next && key->uids->next->next
|
|
|
|
|
&& !key->uids->next->next->next)))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Key has unexpected number of user IDs\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->revoked)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "First user ID unexpectedly revoked\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->invalid)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "First user ID unexpectedly invalid\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->validity != GPGME_VALIDITY_UNKNOWN)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "First user ID has unexpectedly validity: %i\n",
|
|
|
|
|
key->uids->validity);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->signatures)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "First user ID unexpectedly signed\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[0].name
|
|
|
|
|
&& strcmp (keys[i].uid[0].name, key->uids->name))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected name in first user ID: %s\n",
|
|
|
|
|
key->uids->name);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[0].comment
|
|
|
|
|
&& strcmp (keys[i].uid[0].comment, key->uids->comment))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected comment in first user ID: %s\n",
|
|
|
|
|
key->uids->comment);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[0].email
|
|
|
|
|
&& strcmp (keys[i].uid[0].email, key->uids->email))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected email in first user ID: %s\n",
|
|
|
|
|
key->uids->email);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->next && key->uids->next->revoked)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Second user ID unexpectedly revoked\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->next && key->uids->next->invalid)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Second user ID unexpectedly invalid\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->next
|
|
|
|
|
&& key->uids->next->validity != GPGME_VALIDITY_UNKNOWN)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Second user ID has unexpectedly validity: %i\n",
|
|
|
|
|
key->uids->next->validity);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->next && key->uids->next->signatures)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Second user ID unexpectedly signed\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[1].name
|
|
|
|
|
&& strcmp (keys[i].uid[1].name, key->uids->next->name))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected name in second user ID: %s\n",
|
|
|
|
|
key->uids->next->name);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[1].comment
|
|
|
|
|
&& strcmp (keys[i].uid[1].comment, key->uids->next->comment))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected comment in second user ID: %s\n",
|
|
|
|
|
key->uids->next->comment);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[1].email
|
|
|
|
|
&& strcmp (keys[i].uid[1].email, key->uids->next->email))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected email in second user ID: %s\n",
|
|
|
|
|
key->uids->next->email);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->next && key->uids->next->next
|
|
|
|
|
&& key->uids->next->next->revoked)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Third user ID unexpectedly revoked\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->next && key->uids->next->next
|
|
|
|
|
&& key->uids->next->next->invalid)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Third user ID unexpectedly invalid\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->next && key->uids->next->next
|
|
|
|
|
&& key->uids->next->next->validity != GPGME_VALIDITY_UNKNOWN)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Third user ID has unexpectedly validity: %i\n",
|
|
|
|
|
key->uids->next->next->validity);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (key->uids && key->uids->next && key->uids->next->next
|
|
|
|
|
&& key->uids->next->next->signatures)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Third user ID unexpectedly signed\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[2].name
|
|
|
|
|
&& strcmp (keys[i].uid[2].name, key->uids->next->next->name))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected name in third user ID: %s\n",
|
|
|
|
|
key->uids->next->next->name);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[2].comment
|
|
|
|
|
&& strcmp (keys[i].uid[2].comment, key->uids->next->next->comment))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected comment in third user ID: %s\n",
|
|
|
|
|
key->uids->next->next->comment);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (keys[i].uid[2].email
|
|
|
|
|
&& strcmp (keys[i].uid[2].email, key->uids->next->next->email))
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Unexpected email in third user ID: %s\n",
|
|
|
|
|
key->uids->next->next->email);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
2005-10-19 08:23:23 +00:00
|
|
|
|
if (keys[i].misc_check)
|
|
|
|
|
keys[i].misc_check (keys+i, key);
|
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
gpgme_key_unref (key);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
2003-06-05 23:20:29 +00:00
|
|
|
|
if (gpg_err_code (err) != GPG_ERR_EOF)
|
2002-09-02 13:01:29 +00:00
|
|
|
|
fail_if_err (err);
|
2003-04-30 03:02:50 +00:00
|
|
|
|
err = gpgme_op_keylist_end (ctx);
|
|
|
|
|
fail_if_err (err);
|
2002-09-02 13:01:29 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
result = gpgme_op_keylist_result (ctx);
|
|
|
|
|
if (result->truncated)
|
2002-09-02 13:01:29 +00:00
|
|
|
|
{
|
2003-04-30 03:02:50 +00:00
|
|
|
|
fprintf (stderr, "Key listing unexpectedly truncated\n");
|
|
|
|
|
exit (1);
|
2000-11-10 17:50:24 +00:00
|
|
|
|
}
|
2002-09-02 13:01:29 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
if (keys[i].fpr)
|
2002-09-02 13:01:29 +00:00
|
|
|
|
{
|
2003-04-30 03:02:50 +00:00
|
|
|
|
fprintf (stderr, "Less keys returned than expected\n");
|
|
|
|
|
exit (1);
|
2002-09-02 13:01:29 +00:00
|
|
|
|
}
|
2001-09-17 10:36:05 +00:00
|
|
|
|
|
2003-04-30 03:02:50 +00:00
|
|
|
|
gpgme_release (ctx);
|
2002-09-02 13:01:29 +00:00
|
|
|
|
return 0;
|
2000-11-10 17:50:24 +00:00
|
|
|
|
}
|
2005-10-19 08:23:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Check expration of keys. This test assumes three subkeys of which
|
|
|
|
|
2 are expired; it is used with the "Whisky" test key. It has
|
|
|
|
|
already been checked that these 3 subkeys are available. */
|
|
|
|
|
static void
|
|
|
|
|
check_whisky (struct key_info_s *keyinfo, gpgme_key_t key)
|
|
|
|
|
{
|
|
|
|
|
const char *name = keyinfo->uid[0].name;
|
|
|
|
|
gpgme_subkey_t sub1, sub2;
|
|
|
|
|
|
|
|
|
|
sub1 = key->subkeys->next->next;
|
|
|
|
|
sub2 = sub1->next;
|
|
|
|
|
|
|
|
|
|
if (!sub1->expired || !sub2->expired)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Subkey of `%s' not flagged as expired\n", name);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
if (sub1->expires != 1129636886 || sub2->expires != 1129636939)
|
|
|
|
|
{
|
|
|
|
|
fprintf (stderr, "Subkey of `%s' has wrong expiration date\n", name);
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|