From 929e941c10903b80c933e483a1610240bd52286d Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 9 Feb 2021 15:59:53 +0900 Subject: Imported Upstream version 2.1.0 --- tests/openpgp/ChangeLog-2011 | 53 ++++- tests/openpgp/Makefile.am | 123 ++++------ tests/openpgp/armencrypt.test | 2 +- tests/openpgp/armencryptp.test | 2 +- tests/openpgp/armor.test | 3 +- tests/openpgp/armsignencrypt.test | 2 +- tests/openpgp/bug1223-bogus.asc | 21 ++ tests/openpgp/bug1223-good.asc | 20 ++ tests/openpgp/clearsig.test | 13 +- tests/openpgp/conventional-mdc.test | 8 +- tests/openpgp/conventional.test | 12 +- tests/openpgp/decrypt-dsa.test | 2 +- tests/openpgp/decrypt.test | 2 +- tests/openpgp/defs.inc | 99 +++++--- tests/openpgp/ecc.test | 253 +++++++++++++++++++++ tests/openpgp/encrypt-dsa.test | 8 +- tests/openpgp/encrypt.test | 4 +- tests/openpgp/encryptp.test | 2 +- tests/openpgp/finish.test | 17 ++ tests/openpgp/genkey1024.test | 10 +- tests/openpgp/gpg-agent.conf.tmpl | 5 +- tests/openpgp/gpg.conf.tmpl | 2 - tests/openpgp/import.test | 30 ++- tests/openpgp/mds.test | 20 +- tests/openpgp/mkdemodirs | 2 +- tests/openpgp/multisig.test | 4 +- tests/openpgp/pinentry.sh | 28 +++ .../0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255.asc | 12 + .../0DD40284FF992CD24DC4AAC367037E066FCEE26A.asc | 27 +++ .../13FDB8809B17C5547779F9D205C45F47CE0217CE.asc | 17 ++ .../343D8AF79796EE107D645A2787A9D9252F924E6F.asc | 17 ++ .../50B2D4FA4122C212611048BC5FC31BD44393626E.asc | 21 ++ .../76F7E2B35832976B50A27A282D9B87E44577EB66.asc | 21 ++ .../7E201E28B6FEB2927B321F443205F4724EBE637E.asc | 18 ++ .../8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.asc | 14 ++ .../A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD.asc | 20 ++ .../FD692BD59D6640A84C8422573D469F84F3B98E53.asc | 15 ++ tests/openpgp/samplekeys/README | 12 +- tests/openpgp/samplekeys/dda252ebb8ebe1af-1.asc | 29 +++ tests/openpgp/samplekeys/dda252ebb8ebe1af-2.asc | 29 +++ tests/openpgp/samplekeys/ecc-sample-1-pub.asc | 22 ++ tests/openpgp/samplekeys/ecc-sample-1-sec.asc | 25 ++ tests/openpgp/samplekeys/ecc-sample-2-pub.asc | 25 ++ tests/openpgp/samplekeys/ecc-sample-2-sec.asc | 22 ++ tests/openpgp/samplekeys/ecc-sample-3-pub.asc | 28 +++ tests/openpgp/samplekeys/ecc-sample-3-sec.asc | 24 ++ tests/openpgp/samplekeys/eddsa-sample-1-pub.asc | 15 ++ tests/openpgp/samplekeys/eddsa-sample-1-sec.asc | 19 ++ tests/openpgp/seat.test | 4 +- tests/openpgp/signencrypt-dsa.test | 17 +- tests/openpgp/signencrypt.test | 2 +- tests/openpgp/sigs-dsa.test | 18 +- tests/openpgp/sigs.test | 2 +- tests/openpgp/version.test | 96 +++++++- 54 files changed, 1139 insertions(+), 179 deletions(-) create mode 100644 tests/openpgp/bug1223-bogus.asc create mode 100644 tests/openpgp/bug1223-good.asc create mode 100755 tests/openpgp/ecc.test create mode 100755 tests/openpgp/finish.test create mode 100755 tests/openpgp/pinentry.sh create mode 100644 tests/openpgp/privkeys/0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255.asc create mode 100644 tests/openpgp/privkeys/0DD40284FF992CD24DC4AAC367037E066FCEE26A.asc create mode 100644 tests/openpgp/privkeys/13FDB8809B17C5547779F9D205C45F47CE0217CE.asc create mode 100644 tests/openpgp/privkeys/343D8AF79796EE107D645A2787A9D9252F924E6F.asc create mode 100644 tests/openpgp/privkeys/50B2D4FA4122C212611048BC5FC31BD44393626E.asc create mode 100644 tests/openpgp/privkeys/76F7E2B35832976B50A27A282D9B87E44577EB66.asc create mode 100644 tests/openpgp/privkeys/7E201E28B6FEB2927B321F443205F4724EBE637E.asc create mode 100644 tests/openpgp/privkeys/8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.asc create mode 100644 tests/openpgp/privkeys/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD.asc create mode 100644 tests/openpgp/privkeys/FD692BD59D6640A84C8422573D469F84F3B98E53.asc create mode 100644 tests/openpgp/samplekeys/dda252ebb8ebe1af-1.asc create mode 100644 tests/openpgp/samplekeys/dda252ebb8ebe1af-2.asc create mode 100644 tests/openpgp/samplekeys/ecc-sample-1-pub.asc create mode 100644 tests/openpgp/samplekeys/ecc-sample-1-sec.asc create mode 100644 tests/openpgp/samplekeys/ecc-sample-2-pub.asc create mode 100644 tests/openpgp/samplekeys/ecc-sample-2-sec.asc create mode 100644 tests/openpgp/samplekeys/ecc-sample-3-pub.asc create mode 100644 tests/openpgp/samplekeys/ecc-sample-3-sec.asc create mode 100644 tests/openpgp/samplekeys/eddsa-sample-1-pub.asc create mode 100644 tests/openpgp/samplekeys/eddsa-sample-1-sec.asc (limited to 'tests/openpgp') diff --git a/tests/openpgp/ChangeLog-2011 b/tests/openpgp/ChangeLog-2011 index 75246dd..4013a08 100644 --- a/tests/openpgp/ChangeLog-2011 +++ b/tests/openpgp/ChangeLog-2011 @@ -1,13 +1,45 @@ -2011-12-02 Werner Koch +2011-12-01 Werner Koch NB: ChangeLog files are no longer manually maintained. Starting on December 1st, 2011 we put change information only in the GIT commit log, and generate a top-level ChangeLog file from logs at "make dist". See doc/HACKING for details. -2010-05-12 Werner Koch +2011-02-10 Werner Koch + + * ecc.test: New. + * pinentry.sh: New. + * defs.inc: Do not create a log when running tests with envvar + verbose > 1. Add pinentry-program to gpg-agent.conf. + * Makefile.am (sample_keys): New. + (EXTRA_DIST): Add them. + +2010-10-15 Werner Koch + + * Makefile.am (clean-local): New. + +2010-10-14 Werner Koch + + * genkey1024.test: Use the new no-protection option. + + * decrypt-dsa.test: Do not specify an extra keyring. The keyring + has been loaded into pubring.gpg. + * sigs-dsa.test: Ditto. + * encrypt-dsa.test: Ditto. + * signencrypt-dsa.test: Ditto. + + * decrypt.test: Remove passphrase stuff. + * sigs.test: Ditto. - * armor.test: Add test for bug#1179. + * privkeys/: New. + + * Makefile.am: Move most stuff to ... + * version.test: Prepare data files etc. + * finish.test: New. + * defs.inc: Set all envvars. + (usrname1, usrname2, username3): Use full mail address. + +2010-06-07 Werner Koch * Makefile.am (TESTS_ENVIRONMENT): New. Start all scripts under the control of the gpg-agent. @@ -16,6 +48,10 @@ (GNUPGHOME): Check that it is set properly. (GPG_AGENT_INFO): Do not change. +2010-05-12 Werner Koch + + * armor.test (Version): Add test for bug#1179. + 2010-05-11 Werner Koch * genkey1024.test: Use GPG macro. @@ -23,9 +59,14 @@ * gpg-agent.conf.tmpl: New. * defs.inc: Create gpg-agent.conf (GNUPGHOME): Set and export. - (GPG_AGENT_INFO): Unset + (GPG_AGENT_INFO): Unset. * Makefile.am (CLEANFILES): Add S.gpg-agent +2010-05-07 Werner Koch + + * import.test: Add test case for bug#1223. + * bug1223-good.asc, bug1223-bogus.asc: New. + 2009-12-21 Werner Koch * Makefile.am (required_pgms): New. @@ -377,3 +418,7 @@ Mon May 18 15:40:02 1998 Werner Koch (wk@isil.d.shuttle.de) 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. + +Local Variables: +buffer-read-only: t +End: diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index bd57e25..a6eda61 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -1,4 +1,6 @@ -# Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. +# Makefile.am - For tests/openpgp +# Copyright (C) 1998, 1999, 2000, 2001, 2003, +# 2010 Free Software Foundation, Inc. # # This file is part of GnuPG. # @@ -16,18 +18,15 @@ # along with this program; if not, see . # Process this file with automake to create Makefile.in -GPG_IMPORT = ../../g10/gpg2 --homedir . \ - --quiet --yes --no-permission-warning --import # Programs required before we can run these tests. required_pgms = ../../g10/gpg2 ../../agent/gpg-agent \ - ../../tools/gpg-connect-agent - - -TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= LC_ALL=C \ - ../../agent/gpg-agent --quiet --daemon sh + ../../tools/gpg-connect-agent ../../tools/mk-tdata +TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= LC_ALL=C +# Note: version.test needs to be the first test to run and finish.test +# the last one TESTS = version.test mds.test \ decrypt.test decrypt-dsa.test \ sigs.test sigs-dsa.test \ @@ -39,86 +38,54 @@ TESTS = version.test mds.test \ armdetachm.test detachm.test genkey1024.test \ conventional.test conventional-mdc.test \ multisig.test verify.test armor.test \ - import.test + import.test ecc.test finish.test TEST_FILES = pubring.asc secring.asc plain-1o.asc plain-2o.asc plain-3o.asc \ plain-1.asc plain-2.asc plain-3.asc plain-1-pgp.asc \ pubring.pkr.asc secring.skr.asc secdemo.asc pubdemo.asc \ gpg.conf.tmpl gpg-agent.conf.tmpl \ - bug537-test.data.asc bug894-test.asc - -DATA_FILES = data-500 data-9000 data-32000 data-80000 plain-large - -EXTRA_DIST = defs.inc $(TESTS) $(TEST_FILES) ChangeLog-2011 \ - mkdemodirs signdemokey - -# Note that removing S.gpg-agent forces a running gpg-agent to -# terminate after some time. -CLEANFILES = prepared.stamp x y yy z out err $(DATA_FILES) \ + bug537-test.data.asc bug894-test.asc \ + bug1223-good.asc bug1223-bogus.asc + +data_files = data-500 data-9000 data-32000 data-80000 plain-large + +priv_keys = privkeys/50B2D4FA4122C212611048BC5FC31BD44393626E.asc \ + privkeys/7E201E28B6FEB2927B321F443205F4724EBE637E.asc \ + privkeys/13FDB8809B17C5547779F9D205C45F47CE0217CE.asc \ + privkeys/343D8AF79796EE107D645A2787A9D9252F924E6F.asc \ + privkeys/8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.asc \ + privkeys/0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255.asc \ + privkeys/FD692BD59D6640A84C8422573D469F84F3B98E53.asc \ + privkeys/76F7E2B35832976B50A27A282D9B87E44577EB66.asc \ + privkeys/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD.asc \ + privkeys/0DD40284FF992CD24DC4AAC367037E066FCEE26A.asc + +sample_keys = samplekeys/ecc-sample-1-pub.asc \ + samplekeys/ecc-sample-2-pub.asc \ + samplekeys/ecc-sample-3-pub.asc \ + samplekeys/ecc-sample-1-sec.asc \ + samplekeys/ecc-sample-2-sec.asc \ + samplekeys/ecc-sample-3-sec.asc \ + samplekeys/eddsa-sample-1-pub.asc \ + samplekeys/eddsa-sample-1-sec.asc \ + samplekeys/dda252ebb8ebe1af-1.asc \ + samplekeys/dda252ebb8ebe1af-2.asc + +EXTRA_DIST = defs.inc pinentry.sh $(TESTS) $(TEST_FILES) ChangeLog-2011 \ + mkdemodirs signdemokey $(priv_keys) $(sample_keys) + +CLEANFILES = prepared.stamp x y yy z out err $(data_files) \ plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \ *.test.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \ - pubring.gpg secring.gpg pubring.pkr secring.skr + pubring.gpg pubring.gpg~ pubring.kbx pubring.kbx~ \ + secring.gpg pubring.pkr secring.skr \ + gnupg-test.stop random_seed gpg-agent.log -DISTCLEANFILES = pubring.gpg~ random_seed - - -all-local: prepared.stamp - -distclean-local: - $(srcdir)/mkdemodirs --clean - -prepared.stamp: ./pubring.gpg ./secring.gpg ./plain-1 ./plain-2 ./plain-3 \ - ./pubring.pkr ./secring.skr ./gpg_dearmor $(DATA_FILES) - $(GPG_IMPORT) $(srcdir)/pubdemo.asc - cat $(srcdir)/gpg-agent.conf.tmpl > gpg-agent.conf - echo timestamp >./prepared.stamp +clean-local: + -rm -rf private-keys-v1.d openpgp-revocs.d # We need to depend on a couple of programs so that the tests don't # start before all programs are built. -./gpg_dearmor: $(required_pgms) - echo '#!/bin/sh' >./gpg_dearmor - echo "../../g10/gpg2 --homedir . --no-options --no-greeting \ - --no-secmem-warning --batch --dearmor" >>./gpg_dearmor - chmod 755 ./gpg_dearmor - -./pubring.gpg: $(srcdir)/pubring.asc $(srcdir)/pubdemo.asc ./gpg_dearmor - ./gpg_dearmor > ./pubring.gpg < $(srcdir)/pubring.asc - -./secring.gpg: $(srcdir)/secring.asc ./gpg_dearmor - ./gpg_dearmor > ./secring.gpg < $(srcdir)/secring.asc - -./pubring.pkr: $(srcdir)/pubring.pkr.asc ./gpg_dearmor - ./gpg_dearmor > ./pubring.pkr < $(srcdir)/pubring.pkr.asc - -./secring.skr: $(srcdir)/secring.skr.asc ./gpg_dearmor - ./gpg_dearmor > ./secring.skr < $(srcdir)/secring.skr.asc - -./plain-1: $(srcdir)/plain-1o.asc ./gpg_dearmor - ./gpg_dearmor > ./plain-1 < $(srcdir)/plain-1o.asc - -./plain-2: $(srcdir)/plain-2o.asc ./gpg_dearmor - ./gpg_dearmor > ./plain-2 < $(srcdir)/plain-2o.asc - -./plain-3: $(srcdir)/plain-3o.asc ./gpg_dearmor - ./gpg_dearmor > ./plain-3 < $(srcdir)/plain-3o.asc - - -data-500: - ../../tools/mk-tdata 500 >data-500 -data-9000: - ../../tools/mk-tdata 9000 >data-9000 -data-32000: - ../../tools/mk-tdata 32000 >data-32000 -data-80000: - ../../tools/mk-tdata 80000 >data-80000 -plain-large: - cat $(srcdir)/../../doc/HACKING \ - $(srcdir)/../../doc/DETAILS \ - $(srcdir)/../../doc/gpg.texi >plain-large - -# To speed up key generation we create a dummy random seed file -random_seed: - ../../tools/mk-tdata 600 - +all-local: $(required_pgms) diff --git a/tests/openpgp/armencrypt.test b/tests/openpgp/armencrypt.test index df37294..ce1067e 100755 --- a/tests/openpgp/armencrypt.test +++ b/tests/openpgp/armencrypt.test @@ -12,7 +12,7 @@ #info Checking armored encryption for i in $plain_files $data_files ; do - $GPG --always-trust -ea -o x --yes -r "$usrname2" $i + $GPG ${opt_always} -ea -o x --yes -r "$usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/armencryptp.test b/tests/openpgp/armencryptp.test index 9246b6d..dfebb48 100755 --- a/tests/openpgp/armencryptp.test +++ b/tests/openpgp/armencryptp.test @@ -12,7 +12,7 @@ #info Checking armored encryption with a pipe for i in $plain_files $data_files ; do - $GPG --always-trust -ea --yes -r "$usrname2" < $i | tee x | $GPG -o y --yes + $GPG ${opt_always} -ea --yes -r "$usrname2" < $i | tee x | $GPG -o y --yes cmp $i y || error "$i: mismatch" $GPG --yes < x > y cmp $i y || error "$i: mismatch" diff --git a/tests/openpgp/armor.test b/tests/openpgp/armor.test index cb3c892..ce5939c 100755 --- a/tests/openpgp/armor.test +++ b/tests/openpgp/armor.test @@ -755,10 +755,9 @@ $GPG --import x || true i=nopad_armored_msg info "checking: $i" eval "(IFS=; echo \"\$$i\")" >x -if echo "abc" | $GPG --passphrase-fd 0 -o - x > /dev/null ; then +if $GPG -o - x > /dev/null ; then : else error "bug#1179 is back in town" fi - diff --git a/tests/openpgp/armsignencrypt.test b/tests/openpgp/armsignencrypt.test index 5b392df..c50a12d 100755 --- a/tests/openpgp/armsignencrypt.test +++ b/tests/openpgp/armsignencrypt.test @@ -13,7 +13,7 @@ #info Checking armored signing and encryption for i in $plain_files $data_files ; do - echo "$usrpass1" | $GPG --passphrase-fd 0 --always-trust \ + echo "$usrpass1" | $GPG --passphrase-fd 0 ${opt_always} \ -sae -o x --yes -r "$usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" diff --git a/tests/openpgp/bug1223-bogus.asc b/tests/openpgp/bug1223-bogus.asc new file mode 100644 index 0000000..469e6b9 --- /dev/null +++ b/tests/openpgp/bug1223-bogus.asc @@ -0,0 +1,21 @@ +Bogus test key for bug 1223 (Designated revoker sigs are not properly merged) +Thanks to Daniel Kahn Gillmor for providing the test keys. + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.10 (GNU/Linux) + +mI0ES+OoSQEEAJUZ/+fC6DXN2X7Wxl4Huud/+i2qP1hcq+Qnbr7hVCKEnn0edYl+ +6xfsKmAMBjl+qTZxPSDSx4r3ciMiIbnvXFtlBAQmji86kqoR6fm9s8BN7LTq7+2/ +c2FHVF67D7zES7WgHc4i7CfiZnwXgkLvi5b1jBt+MTAOrFhdobxoy6/XABEBAAGI +twQfAQIAIQUCS+OsRRcMgAEAAAAAAAAAAAAAAAAAAAAAAAAAAQIHAAAKCRA0t9EL +wQjoOrRXBACBqhigTcj8pJY14AkjV+ZzUbm55kJRDPdU7NQ1PSvczm7HZaL3b8Lr +Psa5c5+caVLjsGWkQycQl7lUIGU84KoUfwACQKVVLkqJz8LkL54lLcwkG70+1NH5 +xoSNcHHVbYtqDLNeCOq5jEIoXuz44wiWVEfF+/B115PvgwZ63pjH1rRGVGVzdCBL +ZXkgRGVtb25zdHJhdGluZyBSZXZva2VyIFRyb3VibGUgKERPIE5PVCBVU0UpIDx0 +ZXN0QGV4YW1wbGUubmV0Poi+BBMBAgAoBQJL46hJAhsDBQkACTqABgsJCAcDAgYV +CAIJCgsEFgIDAQIeAQIXgAAKCRA0t9ELwQjoOgLpA/9/si2QYmietY9a6VlAmMri +mhZeqo6zyn8zrO9RGU7+8jmeb5nVnXw1YmZcw2fiJgI9+tTMkTfomyR6k0EDvcEu +2Mg3USkVnJfrrkPjSL9EajW6VpOUNxlox3ZT1oyEo3OOnVF1gC1reWYfy7Ns9zIB +1leLXbMr86zYdCoXp0Xu4g== +=YV5g +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/bug1223-good.asc b/tests/openpgp/bug1223-good.asc new file mode 100644 index 0000000..5622cb3 --- /dev/null +++ b/tests/openpgp/bug1223-good.asc @@ -0,0 +1,20 @@ +Good test key for bug 1223 (Designated revoker sigs are not properly merged) + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.10 (GNU/Linux) + +mI0ES+OoSQEEAJUZ/+fC6DXN2X7Wxl4Huud/+i2qP1hcq+Qnbr7hVCKEnn0edYl+ +6xfsKmAMBjl+qTZxPSDSx4r3ciMiIbnvXFtlBAQmji86kqoR6fm9s8BN7LTq7+2/ +c2FHVF67D7zES7WgHc4i7CfiZnwXgkLvi5b1jBt+MTAOrFhdobxoy6/XABEBAAGI +twQfAQIAIQUCS+OsRRcMgAEO5b6XkoLYC591QPHM0u2U0hc56QIHAAAKCRA0t9EL +wQjoOrRXBACBqhigTcj8pJY14AkjV+ZzUbm55kJRDPdU7NQ1PSvczm7HZaL3b8Lr +Psa5c5+caVLjsGWkQycQl7lUIGU84KoUfwACQKVVLkqJz8LkL54lLcwkG70+1NH5 +xoSNcHHVbYtqDLNeCOq5jEIoXuz44wiWVEfF+/B115PvgwZ63pjH1rRGVGVzdCBL +ZXkgRGVtb25zdHJhdGluZyBSZXZva2VyIFRyb3VibGUgKERPIE5PVCBVU0UpIDx0 +ZXN0QGV4YW1wbGUubmV0Poi+BBMBAgAoBQJL46hJAhsDBQkACTqABgsJCAcDAgYV +CAIJCgsEFgIDAQIeAQIXgAAKCRA0t9ELwQjoOgLpA/9/si2QYmietY9a6VlAmMri +mhZeqo6zyn8zrO9RGU7+8jmeb5nVnXw1YmZcw2fiJgI9+tTMkTfomyR6k0EDvcEu +2Mg3USkVnJfrrkPjSL9EajW6VpOUNxlox3ZT1oyEo3OOnVF1gC1reWYfy7Ns9zIB +1leLXbMr86zYdCoXp0Xu4g== +=xsEd +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/clearsig.test b/tests/openpgp/clearsig.test index 74631e1..bf67916 100755 --- a/tests/openpgp/clearsig.test +++ b/tests/openpgp/clearsig.test @@ -23,17 +23,6 @@ for i in $plain_files plain-large ; do done -# ====================================== -# and once more to check rfc1991 -# ====================================== - -if have_pubkey_algo "RSA"; then - for i in $plain_files plain-large ; do - $GPG -u $usrname3 --rfc1991 --digest-algo md5 --clearsign -o x --yes $i - $GPG --verify x - done -fi - # ====================================== # and one with long lines # ====================================== @@ -100,7 +89,7 @@ cat >y <sigs_only ) { -+ if( c->sigs_only ) ++ if( c->sigs_only ) rc = hash_datafiles( c->mfx.md, NULL, c->signed_data, c->sigfilename, n1? (n1->pkt->pkt.onepass_sig->sig_class == 0x01):0 ); diff --git a/tests/openpgp/conventional-mdc.test b/tests/openpgp/conventional-mdc.test index 15b525f..744e11e 100755 --- a/tests/openpgp/conventional-mdc.test +++ b/tests/openpgp/conventional-mdc.test @@ -10,6 +10,10 @@ . $srcdir/defs.inc || exit 3 +# We use use a lower than default value for the S2K count to run the +# tests faster. We used a fixed value of 65536 already the past. +s2k="--s2k-count=65536" + #info Checking conventional encryption for ciph in `all_cipher_algos`; do progress "$ciph" @@ -20,9 +24,9 @@ for ciph in `all_cipher_algos`; do else dd if=data-80000 of=z bs=1 count=$i 2>/dev/null fi - echo "Hier spricht HAL" | $GPG --passphrase-fd 0 \ + echo "Hier spricht HAL" | $GPG --passphrase-fd 0 $s2k \ --force-mdc --cipher $ciph -c -o x --yes z - echo "Hier spricht HAL" | $GPG --passphrase-fd 0 \ + echo "Hier spricht HAL" | $GPG --passphrase-fd 0 $s2k \ -o y --yes x cmp z y || error "$ciph/$i: mismatch" done diff --git a/tests/openpgp/conventional.test b/tests/openpgp/conventional.test index 5028b29..30c9ba0 100755 --- a/tests/openpgp/conventional.test +++ b/tests/openpgp/conventional.test @@ -10,19 +10,23 @@ . $srcdir/defs.inc || exit 3 +# We use use a lower than default value for the S2K count to run the +# tests faster. We used a fixed value of 65536 already the past. +s2k="--s2k-count=65536" + #info Checking conventional encryption for i in plain-2 data-32000 ; do - echo "Hier spricht HAL" | $GPG --passphrase-fd 0 -c -o x --yes $i - echo "Hier spricht HAL" | $GPG --passphrase-fd 0 -o y --yes x + echo "Hier spricht HAL" | $GPG --passphrase-fd 0 $s2k -c -o x --yes $i + echo "Hier spricht HAL" | $GPG --passphrase-fd 0 $s2k -o y --yes x cmp $i y || error "$i: mismatch" done for a in `all_cipher_algos`; do progress "$a" for i in plain-1 data-80000 ; do - echo "Hier spricht HAL" | $GPG --passphrase-fd 0 \ + echo "Hier spricht HAL" | $GPG --passphrase-fd 0 $s2k \ --cipher-algo $a -c -o x --yes $i - echo "Hier spricht HAL" | $GPG --passphrase-fd 0 -o y --yes x + echo "Hier spricht HAL" | $GPG --passphrase-fd 0 $s2k -o y --yes x cmp $i y || error "$i: ($a) mismatch" done done diff --git a/tests/openpgp/decrypt-dsa.test b/tests/openpgp/decrypt-dsa.test index 7220f8a..ba83fea 100755 --- a/tests/openpgp/decrypt-dsa.test +++ b/tests/openpgp/decrypt-dsa.test @@ -12,7 +12,7 @@ #info Checking decryption of supplied DSA encrypted file for i in "plain-1" ; do - $GPG $dsa_keyrings -o y --yes $srcdir/$i-pgp.asc + $GPG -o y --yes $srcdir/$i-pgp.asc cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/decrypt.test b/tests/openpgp/decrypt.test index d3b5ddf..370dc96 100755 --- a/tests/openpgp/decrypt.test +++ b/tests/openpgp/decrypt.test @@ -12,7 +12,7 @@ #info Checking decryption of supplied files for i in $plain_files ; do - echo "$usrpass1" | $GPG --passphrase-fd 0 -o y --yes $srcdir/$i.asc + $GPG -o y --yes $srcdir/$i.asc cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/defs.inc b/tests/openpgp/defs.inc index 5d5e03d..941f786 100755 --- a/tests/openpgp/defs.inc +++ b/tests/openpgp/defs.inc @@ -12,22 +12,21 @@ #------ constants --------------- #-------------------------------- -# Note that usrpass1 is also used in Makefile.am -usrname1="one" +usrname1="one@example.com" usrpass1="def" -usrname2="two" +usrname2="two@example.com" usrpass2="" -usrname3="three" +usrname3="three@example.com" usrpass3="" dsa_usrname1="pgp5" -# we use the sub key because we do not yet have the logic to -# to derive the first encryption key from a keyblock (I guess) +# we use the sub key because we do not yet have the logic to to derive +# the first encryption key from a keyblock (I guess) (Well of course +# we have this by now and the notation below will lookup the primary +# first and then search for the encryption subkey.) dsa_usrname2="0xCB879DE9" -dsa_keyrings="--keyring ./pubring.pkr --secret-keyring ./secring.skr" - plain_files="plain-1 plain-2 plain-3" data_files="data-500 data-9000 data-32000 data-80000" @@ -59,6 +58,7 @@ fatal () { progress_cancel echo "$pgmname: fatal:" $* >&2 echo "$pgmname: fatal:" $* >&5 + echo stop >gnupg-test.stop exit 1; } @@ -148,7 +148,7 @@ progress () { #} have_pubkey_algo () { - if ../../g10/gpg2 --homedir . --version | grep "Pubkey:.*$1" >/dev/null + if $GPG --version | grep "Pubkey:.*$1" >/dev/null then true else @@ -157,7 +157,7 @@ have_pubkey_algo () { } have_cipher_algo () { - if ../../g10/gpg2 --homedir . --version | grep "Cipher:.*$1" >/dev/null + if $GPG --version | grep "Cipher:.*$1" >/dev/null then true else @@ -166,7 +166,7 @@ have_cipher_algo () { } have_hash_algo () { - if ../../g10/gpg2 --homedir . --version | grep "Hash:.*$1" >/dev/null + if $GPG --version | grep "Hash:.*$1" >/dev/null then true else @@ -175,11 +175,13 @@ have_hash_algo () { } all_cipher_algos () { - ../../g10/gpg2 --homedir . --with-colons --list-config ciphername | sed 's/^cfg:ciphername://; s/;/ /g' + $GPG --with-colons --list-config ciphername \ + | sed 's/^cfg:ciphername://; s/;/ /g' } all_hash_algos () { - ../../g10/gpg2 --homedir . --with-colons --list-config digestname | sed 's/^cfg:digestname://; s/;/ /g' + $GPG --with-colons --list-config digestname \ + | sed 's/^cfg:digestname://; s/;/ /g' } set -e @@ -188,33 +190,76 @@ pgmname=`basename $0` [ -z "$srcdir" ] && fatal "not called from make" -# Make sure we have a valid option file even with VPATH builds. -for f in gpg.conf ; do - if [ -f ./$f ]; then - : - elif [ -f $srcdir/$f.tmpl ]; then - cat $srcdir/$f.tmpl >$f - fi -done +# +if [ -f gnupg-test.stop ]; then + if [ $pgmname = "version.test" ]; then + rm gnupg-test.stop + else + # Skip the rest of the tests. + exit 77 + fi +fi # Always work in the current directory. We set GNUPGHOME only if it # has not been set already. Usually it is set through the Makefile's # TESTS_ENVIRONMENT macro. if [ -z "$GNUPGHOME" ]; then - GNUPGHOME=`pwd` + GNUPGHOME=`/bin/pwd` export GNUPGHOME -elif [ "$GNUPGHOME" != `pwd` ]; then +elif [ "$GNUPGHOME" != `/bin/pwd` ]; then echo "$pgmname: GNUPGHOME not set to the cwd" $* >&2 exit 1 fi +# We don't use GPG_AGENT_INFO anymore - better reset it. +unset GPG_AGENT_INFO +# (--no-permission-warning makes only sense on the commandline) GPG="../../g10/gpg2 --no-permission-warning " +# (We may not use a relative name for gpg-agent.) +GPG_AGENT="$(cd ../../agent && /bin/pwd)/gpg-agent" +GPG_CONNECT_AGENT="../../tools/gpg-connect-agent" +GPGCONF="../../tools/gpgconf" +GPG_PRESET_PASSPHRASE="../../agent/gpg-preset-passphrase" +MKTDATA="../../tools/mk-tdata" +PINENTRY="$(cd $srcdir && /bin/pwd)/pinentry.sh" +# Default to empty passphrase for pinentry.sh +PINENTRY_USER_DATA= + +# If --check-trustdb is not an option, GPG has been build without +# trust model support. Thus we can't use --always-trust and some +# other options. +if $GPG --dump-options | grep '^--check-trustdb$' >/dev/null ; then + opt_always="--always-trust" +else + opt_always= +fi -echo "Test: $pgmname" > ${pgmname}.log -echo "GNUPGHOME=$GNUPGHOME" >> ${pgmname}.log -echo "GPG_AGENT_INFO=$GPG_AGENT_INFO" >> ${pgmname}.log -exec 5>&2 2>>${pgmname}.log +# Make sure we have a valid option files even with VPATH builds. +for f in gpg.conf gpg-agent.conf ; do + if [ -f ./$f ]; then + : + elif [ -f $srcdir/$f.tmpl ]; then + cat $srcdir/$f.tmpl >$f + case "$f" in + gpg.conf) + [ -n "${opt_always}" ] && echo "no-auto-check-trustdb" >>"$f" + echo "agent-program ${GPG_AGENT}|--debug-quick-random" >>"$f" + echo "allow-weak-digest-algos" >>"$f" + ;; + gpg-agent.conf) + echo "pinentry-program $PINENTRY" >>"$f" + ;; + esac + fi +done +if [ "${verbose:-0}" -gt "1" ]; then + exec 5>/dev/null +else + echo "Test: $pgmname" > ${pgmname}.log + echo "GNUPGHOME=$GNUPGHOME" >> ${pgmname}.log + exec 5>&2 2>>${pgmname}.log +fi : # end diff --git a/tests/openpgp/ecc.test b/tests/openpgp/ecc.test new file mode 100755 index 0000000..58fd251 --- /dev/null +++ b/tests/openpgp/ecc.test @@ -0,0 +1,253 @@ +#!/bin/sh +# Copyright 2011 Free Software Foundation, Inc. +# 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. + +. $srcdir/defs.inc || exit 3 + +keygrips='8E06A180EFFE4C65B812150CAF19BF30C0689A4C + E4403F3FD7A443FAC29FEF288FA0D20AC212851E + 0B7554421FFB14A06CB9F63FB49A85A58E97ABAC + 303ACC892C2D786C8A789677C0BE54DA8538F903 + 9FE5C36985351524B6AFA19FDCBC1A3A750B6F5F + 145A52CC7ED3FD41C5B0A26BE220FEED36AF24DE' +mainkeyids='BAA59D9C + 0F54719F + 45AF2FFE' + + +if have_pubkey_algo "ECDH"; then + : +else + info "No ECC support due to an old Libgcrypt" + exit 77 +fi + + +# +# Setup for ECC testing +# +info "Preparing for ECC test." +for i in $keygrips ; do + rm private-keys-v1.d/$i.key 2>/dev/null || true + $GPG_PRESET_PASSPHRASE --preset -P ecc $i +done + + +# +# Import the sample keys +# +info "Importing ECC public keys." +for k in $mainkeyids ; do + $GPG --delete-key --batch --yes $k 2>/dev/null || true +done +for i in 1 2 3; do + k="ecc-sample-$i-pub.asc" + if $GPG --import $srcdir/samplekeys/$k; then + : + else + error "$k: import failed" + fi +done + + +# +# Check a few sample signature +# +info "Checking ECC signatures." +tests="" + +# The following is an opaque ECDSA signature on a message "This is one +# line\n" (17 byte long) by the primary 256 bit key: +tests="$tests msg_opaque_signed_256" +msg_opaque_signed_256='-----BEGIN PGP MESSAGE----- +Version: GnuPG v2.1.0-ecc (GNU/Linux) + +owGbwMvMwCHMvVT3w66lc+cwrlFK4k5N1k3KT6nUK6ko8Zl8MSEkI7NYAYjy81IV +cjLzUrk64lgYhDkY2FiZQNIMXJwCMO31rxgZ+tW/zesUPxWzdKWrtLGW/LkP5rXL +V/Yvnr/EKjBbQuvZSYa/klsum6XFmTze+maVgclT6Rc6hzqqxNy6o6qdTTmLJuvp +AQA= +=GDv4 +-----END PGP MESSAGE----' + +# The following is an opaque ECDSA signature on a message "This is one +# line\n" (17 byte long) by the primary 384 bit key: +tests="$tests msg_opaque_signed_384" +msg_opaque_signed_384='-----BEGIN PGP MESSAGE----- +Version: PGP Command Line v10.0.0 (Linux) + +qANQR1DIqwE7wsvMwCnM2WDcwR9SOJ/xtFISd25qcXFieqpeSUUJAxCEZGQWKwBR +fl6qQk5mXirXoXJmVgbfYC5xmC5hzsDPjHXqbDLzpXpTBXSZV3L6bAgP3Kq7Ykmo +7Ds1v4UfBS+3CSSon7Pzq79WLjzXXEH54MkjPxnrw+8cfMVnY7Bi18J702Nnsa7a +9lMv/PM0/ao9CZ3KX7Q+Tv1rllTZ5Hj4V1frw431QnHfAA== +=elKT +-----END PGP MESSAGE-----' + +# The following is an opaque ECDSA signature on a message "This is one +# line\n" (17 byte long) by the primary 521 bit key: +tests="$tests msg_opaque_signed_521" +msg_opaque_signed_521='-----BEGIN PGP MESSAGE----- +Version: PGP Command Line v10.0.0 (Linux) + +qANQR1DIwA8BO8LLzMAlnO3Y8tB1vf4/xtNKSdy5qcXFiempeiUVJQxAEJKRWawA +RPl5qQo5mXmpXIdmMLMy+AaLnoLpEubatpeJY2Lystd7Qt32q2UcvRS5kNPWtDB7 +ryufvcrWtFM7Jx8qXKDxZuqr7b9PGv1Ssk+I8TzB2O9dZC+n/jv+PAdbuu7mLe33 +Gf9pLd3weV3Qno6FOqxGa5ZszQx+uer2xH3/El9x/2pVeO4l15ScsL7qWMTmffmG +Ic1RdzgeCfosMF+l/zVRchcLKzenEQA= +=ATtX +-----END PGP MESSAGE-----' + +echo 'This is one line' >z +for msg in $tests; do + info "checking: $msg" + eval "(IFS=; echo \"\$$msg\")" >x + $GPG --verify x || error "verify(1) of $msg failed" + $GPG -o y --yes x || error "verify(2) of $msg failed" + cmp y z || error "$msg: mismatch" +done + + +# +# Import the secret keys so that we now can sign and decrypt. +# +# Note that the PGP generated secret keys are not self-signed, thus we +# need to pass an appropriate option. +# +info "Importing ECC secret keys." +for i in 1 2 3; do + k="ecc-sample-$i-sec.asc" + if [ "$i" -gt "1" ]; then + extraopts="--allow-non-selfsigned-uid" + else + extraopts="" + fi + if PINENTRY_USER_DATA=ecc $GPG $extraopts --import $srcdir/samplekeys/$k; then + : + else + error "$k: import failed" + fi +done + + +# +# Check a few sample encrtpted messages. +# +info "Checking ECC encryption." +tests="" + +# The following block encrypts the text "This is one line\n", 17 bytes, +# with the subkey 4089AB73. +tests="$tests msg_encrypted_256" +msg_encrypted_256='-----BEGIN PGP MESSAGE----- +Version: GnuPG v2.1.0-ecc (GNU/Linux) + +hH4Dd863o0CJq3MSAgMEHdIYZQx+rV1cjy7qitIOEICFFzp4cjsRX4r+rDdMcQUs +h7VZmbP1c9C0s9sgCKwubWfkcYUl2ZOju4gy+s4MYTBb4/j8JjnJ9Bqn6LWutTXJ +zwsdP13VIJLnhiNqISdR3/6xWQ0ICRYzwb95nUZ1c1DSVgFpjPgUvi4pgYbTpcDB +jzILKWBfBDT/jck169XE8vgtbcqVQYZ7lZpaY9CzEbC+4dXZmV1gm5MafpTyFWgH +VnyrZB4gad9Lp9e0RKHHcOOE7s/NeLuu +=odUZ +-----END PGP MESSAGE-----' + +# The following block encrypts the text "This is one line\n", 17 bytes, +# with the subkey 9A201946: +tests="$tests msg_encrypted_384" +msg_encrypted_384='-----BEGIN PGP MESSAGE----- +Version: PGP Command Line v10.0.0 (Linux) + +qANQR1DBngOqi5OPmiAZRhIDAwQqIr/00cJyf+QP+VA4QKVkk77KMHdz9OVaR2XK +0VYu0F/HPm89vL2orfm2hrAZxY9G2R0PG4Wk5Lg04UjKca/O72uWtjdPYulFidmo +uB0QpzXFz22ZZinxeVPLPEr19Pow0EwCc95cg4HAgrD0nV9vRcTJ/+juVfvsJhAO +isMKqrFNMvwnK5A1ECeyVXe7oLZl0lUBRhLr59QTtvf85QJjg/m5kaGy8XCJvLv3 +61pZa6KUmw89PjtPak7ebcjnINL01vwmyeg1PAyW/xjeGGvcO+R4P1b4ewyFnJyR +svzIJcP7d4DqYOw7 +=oiTJ +-----END PGP MESSAGE-----' + +# The following block encrypts the text "This is one line\n", 17 bytes, +# with the subkey A81C4838: +tests="$tests msg_encrypted_521" +msg_encrypted_521='-----BEGIN PGP MESSAGE----- +Version: PGP Command Line v10.0.0 (Linux) + +qANQR1DBwAIDB+qqSKgcSDgSBCMEAKpzTUxB4c56C7g09ekD9I+ttC5ER/xzDmXU +OJmFqU5w3FllhFj4TgGxxdH+8fv4W2Ag0IKoJvIY9V1V7oUCClfqAR01QbN7jGH/ +I9GFFnH19AYEgMKgFmh14ZwN1BS6/VHh+H4apaYqapbx8/09EL+DV9zWLX4GRLXQ +VqCR1N2rXE29MJFzGmDOCueQNkUjcbuenoCSKcNT+6xhO27U9IYVCg4BhRUDGfD6 +dhfRzBLxL+bKR9JVAe46+K8NLjRVu/bd4Iounx4UF5dBk8ERy+/8k9XantDoQgo6 +RPqCad4Dg/QqkpbK3y574ds3VFNJmc4dVpsXm7lGV5w0FBxhVNPoWNhhECMlTroX +Rg== +=5GqW +-----END PGP MESSAGE-----' + +echo 'This is one line' >z +for msg in $tests; do + info "checking: $msg" + eval "(IFS=; echo \"\$$msg\")" >x + PINENTRY_USER_DATA=ecc $GPG -o y --yes x || error "decryption of $msg failed" + cmp y z || error "$msg: mismatch" +done + + +# +# Now check that we can encrypt and decrypt our own messages. +# +# Note that we don't need to provide a passppharse because we already +# preset the passphrase into the gpg-agent. +# +info "Checking ECC encryption and decryption." +for i in $plain_files $data_files ; do + for k in $mainkeyids ; do + info "file: $i key: $k" + $GPG ${opt_always} -e -o x --yes -r $k $i + PINENTRY_USER_DATA=ecc $GPG -o y --yes x + cmp $i y || error "$i,$k: mismatch" + done +done + + +# +# Now check that we can sign and verify our own messages. +# +info "Checking ECC signing and verifiction." +for i in $plain_files $data_files ; do + for k in $mainkeyids ; do + info "file: $i key: $k" + PINENTRY_USER_DATA=ecc $GPG -s -o x --yes -u $k $i + $GPG -o y --yes x || error "verify of $i,$k failed" + cmp $i y || error "$i,$k: mismatch" + done +done + + +# +# Let us also try to import the keys only from a secret keyblock. +# +# Because PGP does not sign the UID, it is not very useful to work +# with this key unless we go into the trouble of adding the +# self-signature. +# +info "Importing ECC secret keys directly." +for i in $keygrips ; do + rm private-keys-v1.d/$i.key 2>/dev/null || true +done +for k in $mainkeyids ; do + $GPG --delete-key --batch --yes $k 2>/dev/null || true +done +for i in 1 2 3; do + k="ecc-sample-$i-sec.asc" + if [ "$i" -gt "1" ]; then + extraopts="--allow-non-selfsigned-uid" + else + extraopts="" + fi + if PINENTRY_USER_DATA=ecc $GPG $extraopts --import $srcdir/samplekeys/$k; then + : + else + error "$k: import failed" + fi +done diff --git a/tests/openpgp/encrypt-dsa.test b/tests/openpgp/encrypt-dsa.test index 320fbd8..7ce670e 100755 --- a/tests/openpgp/encrypt-dsa.test +++ b/tests/openpgp/encrypt-dsa.test @@ -12,17 +12,17 @@ #info Checking encryption for i in $plain_files $data_files ; do - $GPG $dsa_keyrings --always-trust -e -o x --yes -r "$dsa_usrname2" $i - $GPG $dsa_keyrings -o y --yes x + $GPG ${opt_always} -e -o x --yes -r "$dsa_usrname2" $i + $GPG -o y --yes x cmp $i y || error "$i: mismatch" done for ca in `all_cipher_algos` ; do progress "$ca" for i in $plain_files $data_files ; do - $GPG $dsa_keyrings --always-trust --cipher-algo $ca -e \ + $GPG ${opt_always} --cipher-algo $ca -e \ -o x --yes -r "$dsa_usrname2" $i - $GPG $dsa_keyrings -o y --yes x + $GPG -o y --yes x cmp $i y || error "$i: mismatch" done done diff --git a/tests/openpgp/encrypt.test b/tests/openpgp/encrypt.test index 5ef5196..295a6c3 100755 --- a/tests/openpgp/encrypt.test +++ b/tests/openpgp/encrypt.test @@ -12,7 +12,7 @@ #info Checking encryption for i in $plain_files $data_files ; do - $GPG --always-trust -e -o x --yes -r "$usrname2" $i + $GPG ${opt_always} -e -o x --yes -r "$usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done @@ -21,7 +21,7 @@ echo_n " > " for ca in `all_cipher_algos` ; do echo_n "$ca " for i in $plain_files $data_files ; do - $GPG --always-trust -e -o x --yes -r "$usrname2" --cipher-algo $ca $i + $GPG ${opt_always} -e -o x --yes -r "$usrname2" --cipher-algo $ca $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/encryptp.test b/tests/openpgp/encryptp.test index 984f56a..3ad7119 100755 --- a/tests/openpgp/encryptp.test +++ b/tests/openpgp/encryptp.test @@ -12,7 +12,7 @@ #info Checking encryption with a pipe for i in $plain_files $data_files ; do - $GPG --always-trust -e --yes -r "$usrname2" <$i | $GPG --yes > y + $GPG ${opt_always} -e --yes -r "$usrname2" <$i | $GPG --yes > y cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/finish.test b/tests/openpgp/finish.test new file mode 100755 index 0000000..fced570 --- /dev/null +++ b/tests/openpgp/finish.test @@ -0,0 +1,17 @@ +#!/bin/sh +# Copyright 2010 Free Software Foundation, Inc. +# 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. + +. $srcdir/defs.inc || exit 3 + +if $GPG_AGENT --quiet; then + $GPG_CONNECT_AGENT killagent /bye >/dev/null +fi + +exit 0 + diff --git a/tests/openpgp/genkey1024.test b/tests/openpgp/genkey1024.test index 835b4c8..99a0d5d 100755 --- a/tests/openpgp/genkey1024.test +++ b/tests/openpgp/genkey1024.test @@ -10,7 +10,7 @@ . $srcdir/defs.inc || exit 3 -$GPG --quiet --batch --debug-quick-random --gen-key </dev/null || true +$GPG --import $boguskey || true +$GPG --import $goodkey || true +if $GPG --list-keys --with-colons $keyid \ + | grep '^rvk:.*:0EE5BE979282D80B9F7540F1CCD2ED94D21739E9:' >/dev/null; then + : +else + error "$goodkey: import failed (bug 1223)" +fi - - - - +key1=$srcdir/samplekeys/dda252ebb8ebe1af-1.asc +key2=$srcdir/samplekeys/dda252ebb8ebe1af-2.asc +fpr1=9E669861368BCA0BE42DAF7DDDA252EBB8EBE1AF +fpr2=A55120427374F3F7AA5F1166DDA252EBB8EBE1AF +info "Checking import of two keys with colliding long key ids." +$GPG --delete-key --batch --yes $fpr1 $fpr2 2>/dev/null || true +$GPG --import $key1 || true +$GPG --import $key2 || true +n=$($GPG --list-keys --with-colons $fpr1 $fpr2 2>/dev/null \ + | grep '^pub:.:4096:1:DDA252EBB8EBE1AF:' | wc -l) +if [ $n -ne 2 ] ; then + error "Importing keys with long id collision failed" +fi diff --git a/tests/openpgp/mds.test b/tests/openpgp/mds.test index a4583a1..944f535 100755 --- a/tests/openpgp/mds.test +++ b/tests/openpgp/mds.test @@ -23,11 +23,19 @@ failed="" #info Checking message digests cat /dev/null | $GPG --with-colons --print-mds >y # MD5 -test_one ":1:" "D41D8CD98F00B204E9800998ECF8427E" +if have_hash_algo "MD5"; then + test_one ":1:" "D41D8CD98F00B204E9800998ECF8427E" +else + echo "Hash algorithm MD5 is not installed (not an error)" +fi # SHA-1 test_one ":2:" "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709" # RMD160 -test_one ":3:" "9C1185A5C5E9FC54612808977EE8F548B2258D31" +if have_hash_algo "RIPEMD160"; then + test_one ":3:" "9C1185A5C5E9FC54612808977EE8F548B2258D31" +else + echo "Hash algorithm RIPEMD160 is not installed (not an error)" +fi # SHA-224 if have_hash_algo "SHA224"; then test_one ":11:" "D14A028C2A3A2BC9476102BB288234C415A2B01F828EA62AC5B3E42F" @@ -56,9 +64,13 @@ fi [ "$failed" != "" ] && error "$failed failed for empty string" echo_n "abcdefghijklmnopqrstuvwxyz" | $GPG --with-colons --print-mds >y -test_one ":1:" "C3FCD3D76192E4007DFB496CCA67E13B" +if have_hash_algo "MD5"; then + test_one ":1:" "C3FCD3D76192E4007DFB496CCA67E13B" +fi test_one ":2:" "32D10C7B8CF96570CA04CE37F2A19D84240D3A89" -test_one ":3:" "F71C27109C692C1B56BBDCEB5B9D2865B3708DBC" +if have_hash_algo "RIPEMD160"; then + test_one ":3:" "F71C27109C692C1B56BBDCEB5B9D2865B3708DBC" +fi if have_hash_algo "SHA224"; then test_one ":11:" "45A5F72C39C5CFF2522EB3429799E49E5F44B356EF926BCF390DCCC2" fi diff --git a/tests/openpgp/mkdemodirs b/tests/openpgp/mkdemodirs index 7e6ec2c..a381681 100755 --- a/tests/openpgp/mkdemodirs +++ b/tests/openpgp/mkdemodirs @@ -4,7 +4,7 @@ set -e # We need to use --no-options so that a gpg.conf from an older version # of gpg is not used. -GPG="../g10/gpg2 --no-options --batch --quiet +GPG="../../g10/gpg2 --no-options --batch --quiet --no-secmem-warning --allow-secret-key-import" NAMES='Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India diff --git a/tests/openpgp/multisig.test b/tests/openpgp/multisig.test index 908b578..9ad8676 100755 --- a/tests/openpgp/multisig.test +++ b/tests/openpgp/multisig.test @@ -132,7 +132,7 @@ cnksIEkgY2FuJ3QgZG8gdGhhdAo= for i in sig_sl_valid ; do - eval "(IFS=; echo \"\$$i\")" | ./gpg_dearmor >x + eval "(IFS=; echo \"\$$i\")" | $GPG --dearmor >x $GPG --verify x 2>/dev/null || error "valid is invalid ($i)" linefeed done @@ -145,7 +145,7 @@ done for i in sig_1ls1ls_valid sig_ls_valid \ sig_1lsls_invalid sig_lsls_invalid \ sig_lss_invalid sig_slsl_invalid ; do - eval "(IFS=; echo \"\$$i\")" | ./gpg_dearmor >x + eval "(IFS=; echo \"\$$i\")" | $GPG --dearmor >x $GPG --verify /dev/null && error "invalid is valid ($i)" linefeed done diff --git a/tests/openpgp/pinentry.sh b/tests/openpgp/pinentry.sh new file mode 100755 index 0000000..b4b12fc --- /dev/null +++ b/tests/openpgp/pinentry.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Copyright 2011 Free Software Foundation, Inc. +# 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. + +echo "OK - what's up?" +while read cmd rest; do + echo "cmd=$cmd rest=$rest" >&2 + case "$cmd" in + \#*) + ;; + GETPIN) + echo "D ${PINENTRY_USER_DATA}" + echo "OK" + ;; + BYE) + echo "OK" + exit 0 + ;; + *) + echo "OK" + ;; + esac +done diff --git a/tests/openpgp/privkeys/0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255.asc b/tests/openpgp/privkeys/0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255.asc new file mode 100644 index 0000000..ddf0fb9 --- /dev/null +++ b/tests/openpgp/privkeys/0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255.asc @@ -0,0 +1,12 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDExOnByaXZhdGUta2V5KDM6ZWxnKDE6cDk3OgD/BWuU2w+pPFZltSIytQ3wyNMV +HbFSG5PDdx29GCJU9RP+rWXX4jcKmilUHH9e4CSDmwcHzTNzqlmDrnZgVXd0uhNx +5LuuJ1vmTbewdraFkYJ5OjoB3Eg7LneCII8M/0UpKDE6ZzE6AikoMTp5OTY6Toef +zlcVKiPuobKfXHDhIUQPTfGic2Az47wkMoYHo9j9ZE7AWaliMdPz4jLyLfqqoU9m +H8g+vJhyAc7UnAF2Sk5466FDypdPm5F9PTW3cqqIwJM4WgkSlM8J2hxH4YtlKSgx +OngyOTob6nEVc0W4M+ZyrqMvp26DaKRnuFwcsDLsN11JLykpKQ== +=Ghie +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/0DD40284FF992CD24DC4AAC367037E066FCEE26A.asc b/tests/openpgp/privkeys/0DD40284FF992CD24DC4AAC367037E066FCEE26A.asc new file mode 100644 index 0000000..49d4413 --- /dev/null +++ b/tests/openpgp/privkeys/0DD40284FF992CD24DC4AAC367037E066FCEE26A.asc @@ -0,0 +1,27 @@ +This is the unprotected private key for + +pub ed25519/97965A9A 2014-08-19 + Key fingerprint = C959 BDBA FA32 A2F8 9A15 3B67 8CFD E121 9796 5A9A + Keygrip = 0DD40284FF992CD24DC4AAC367037E066FCEE26A +uid [ unknown] EdDSA sample key 1 (draft-koch-eddsa-for-openpgp-00) + +The human readable version of the armored s-expression below is: + +(private-key + (ecc + (curve Ed25519) + (flags eddsa) + (q #403F098994BDD916ED4053197934E4A87C80733A1280D62F8010992E43EE3B2406#) + (d #1A8B1FF05DED48E18BF50166C664AB023EA70003D78D9E41F5758A91D850F8D2#) + ) + ) + +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v2 +Comment: Use "gpg --dearmor" for unpacking + +KDExOnByaXZhdGUta2V5KDM6ZWNjKDU6Y3VydmU3OkVkMjU1MTkpKDU6ZmxhZ3M1 +OmVkZHNhKSgxOnEzMzpAPwmJlL3ZFu1AUxl5NOSofIBzOhKA1i+AEJkuQ+47JAYp +KDE6ZDMyOhqLH/Bd7Ujhi/UBZsZkqwI+pwAD142eQfV1ipHYUPjSKSkp +=SS8V +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/13FDB8809B17C5547779F9D205C45F47CE0217CE.asc b/tests/openpgp/privkeys/13FDB8809B17C5547779F9D205C45F47CE0217CE.asc new file mode 100644 index 0000000..0c15f8c --- /dev/null +++ b/tests/openpgp/privkeys/13FDB8809B17C5547779F9D205C45F47CE0217CE.asc @@ -0,0 +1,17 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDExOnByaXZhdGUta2V5KDM6cnNhKDE6bjEyOToAqFJWduzk11/m0Ac/K/mab0kz +zr3UUor1bkxh4vcxJHOTZF3a9Y6t1WUpwlOXeCNkY98tRYUg6A40wFgkKz/4jdOa +iDtHW2bOqrvJmJ/wH/5zdmDpthu53JEgXUKP/+j2dfrvYTZYxy2m11DA68QK9iPS +BmksglFMQE2IJatwEAEpKDE6ZTI6AQEpKDE6ZDEyODoAvKABRIX7dtUOm2y6VyGs +ESE5D4YI1AhL0EWodt84EPEUvC1o61UuYbAe28JIHwjIKDLgDiedZ6hTBV3K5cI1 +aFHL421hDE0qtD+mVZhcRGnR2RHhr9gX6qX+4P8mV0w1nhdShwUhlFO1GuwQ2/dW +KwYdXGbDW7P58LIiudGWuSkoMTpwNjU6AMM8WAY5lr1ZdSqr39rNqntLZqoXVO4N +ibd5Tw3o/3JMVJ/xEqMykrude87nlPCAJMPlX9gjP1B57UmRxN8mGNkpKDE6cTY1 +OgDctZRfAPGvQ4vUwxG4uso9nbCtFlGYZTQgMPHfMFflUyxH9Y0zA8ujyKKYFPYX +t7Pe6Y+qqu6BG0mPqvIXe3dpKSgxOnU2NDop+y32myNaSakGsQ732PgarqitgefN +3h9Kec4kS/j85t1esYEbC9XlFluVcIUDaQHdKFpijCl6eC2oFXOkPRwJKSkp +=nyLM +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/343D8AF79796EE107D645A2787A9D9252F924E6F.asc b/tests/openpgp/privkeys/343D8AF79796EE107D645A2787A9D9252F924E6F.asc new file mode 100644 index 0000000..c674b65 --- /dev/null +++ b/tests/openpgp/privkeys/343D8AF79796EE107D645A2787A9D9252F924E6F.asc @@ -0,0 +1,17 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDExOnByaXZhdGUta2V5KDM6ZHNhKDE6cDEyOToArHGqWD0rP0Nn/c3nYELTD4m1 +gqR7f2+l1ZUMdHcweYwn/fVjaJKmbR+9GzeHWP398FWYs5mCU1DIfrZLF0nJnAJ6 +WRnN9TL+oub1BqqLvCmDSngRuZZ2gUX8DVmD8xTsPnDnG74QDUnvtnpDIAs32sg5 +dnusstrriXD8xXgt0g8pKDE6cTIxOgC449htJbbp5rkJHvBDs4YxEIkk5ykoMTpn +MTI4Ol+ITxpSMOT5R67Bu4XWoYU7nVeYURpb6LJ8LK2CV7ygECwFdRFdukiGFB+a +TP8nF6xtuXalaBuerkKp4QXVKqOIkp7MWN2TAOOg9eERHPT//whryf49meNYMPLv +KAe60udHY76Glm+Zso+24WnEwXX2od1PHVV3CItWRb7YmhgGKSgxOnkxMjg6AgXt +40h2lpiIHTjbu6fiCBzbr5j2eQX3cNoydkRphJ66bqD+DsPW/Ag0WBCQxgRaLgMr +db64fQT+fyjbTBLbC8ytt5hpCbm/q5x3TTXDAUNjoB3CnA/tQItBy7qqq/A0d3FZ +grr6AixK58uZ4wauy8LRZCph67UZ8akcgwJkmVkpKDE6eDIwOn/Y1rjZASGMK9IG +b1y/ZDKT0zkTKSkp +=muRa +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/50B2D4FA4122C212611048BC5FC31BD44393626E.asc b/tests/openpgp/privkeys/50B2D4FA4122C212611048BC5FC31BD44393626E.asc new file mode 100644 index 0000000..6233524 --- /dev/null +++ b/tests/openpgp/privkeys/50B2D4FA4122C212611048BC5FC31BD44393626E.asc @@ -0,0 +1,21 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDIxOnByb3RlY3RlZC1wcml2YXRlLWtleSgzOmRzYSgxOnAxMjk6AL8pJ97q5V8O +ADcGsak0uFXFP/K3BcykEjykR1OJjSNaditv9i7zC0J5n0YC7H9kD+1537ul2Jsd +d9fk/MN+BRNnCsglrns5SlbAjzvwDNnE2ydW/Ug/q58bIRIowTg9RA7mF4qHABvS +BDAXACtLe/ih5isSWOEnv2Sm3fX0kQATKSgxOnEyMToA+hTknylYwYGT/PEVQ4Jl +LPoWmqUpKDE6ZzEyOToAmfUdfU53m3Kgrg4QAzkb7AfPdIGPgUyidk1azUi3Tcko +egzm6VDYWARaYFUg9MpIOb+NBc9gCnPkOnGmgZhtMJoSjrN8TfYATOhcOYYBkT3R +eGr/BwQ34lwekfK0AD+f6FhpHexh6BDnaZYxH691330o7RXSMtFxySAEDtnaOUUp +KDE6eTEyODp8cyy2nYt0QI5Tf+t/d4WBeib2yNWVtZH/j7XpDqHLZDgVAYkazCA6 +ZF7BvLddBEqVAh1X5tqua4AXX9L4SGYb7B0LRV72alhYiWWHez126KjVgwRTUxtE +J4EnHmYJRReLlXosPIRhXSz7HFAqalPXJ0DvC9kzTQnnjPOylyMPTSkoOTpwcm90 +ZWN0ZWQyNTpvcGVucGdwLXMyazMtc2hhMS1hZXMtY2JjKCg0OnNoYTE4OnBnEA/u +YyreNzo0OTMzNjMyKTE2OtXuvrOxsl1/bOm+6zBEQZ0pODA6XEPa+d4D7F2jof/+ +sJvtf22PzAgN/qZ93eIKlJaHxQFQeOyLrghCAUyZLIBzR8dlNBG+uWhg7DBJMVnR +MhH24nqzdivp+SxlMO0XdnkmkBspKDEyOnByb3RlY3RlZC1hdDE1OjIwMTAxMDE0 +VDEyMDgxMSkpKQ== +=ZfqD +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/76F7E2B35832976B50A27A282D9B87E44577EB66.asc b/tests/openpgp/privkeys/76F7E2B35832976B50A27A282D9B87E44577EB66.asc new file mode 100644 index 0000000..79699a2 --- /dev/null +++ b/tests/openpgp/privkeys/76F7E2B35832976B50A27A282D9B87E44577EB66.asc @@ -0,0 +1,21 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDIxOnByb3RlY3RlZC1wcml2YXRlLWtleSgzOmRzYSgxOnAxMjk6ALZlsUNfTCYk +jzIsNhB0iJl4C4cuZ/IeypdosZQxm1aIC+f+E2ly3BqGbMqbmheKcdS9SQs5DSzy +s6W7XmeHDhrNzfStM/UuwiSfnM5E2cV2BgLpErKE56Kb/rf7/Ia12dObj2VV9oKr +CwSYEISRdp5YMar6J7Vvz0nz1Pqf8mq7KSgxOnEyMToAoQkjVeVGG+B/SzJ6+yif +dHWQVkcpKDE6ZzEyODoVw8i11+Plhxj9mnredV5SqI1hsLGZnPSzz2IcFP0XFDu3 +HtUEG9FxZVFRQYWNCUKTP7cv5DYvmhlhc4oG0PhwFmZFLwPPlSAFZ3jfqfkh4RiM +i01yqQGE6uOgML5ZWeQqb39Ngqf/ltWlcgNKpwVjMniMV5kfRzoupccZ+XI2oyko +MTp5MTI4OlVm585daoJeQG/Pg7LdDkVuNBDT/63LysOfw5NqI+LjUXJScSLos76r +IFLT0WOdmP74+RxFxdb31I3GYQlFjsy40e3nAi8QfaM0Q4n2WzPNkUENu7CyNccr +fn6U9sYTLr3EI/bqIRp/KwoptFcmETUL62TxKcr4abrayK+Yr/lqKSg5OnByb3Rl +Y3RlZDI1Om9wZW5wZ3AtczJrMy1zaGExLWFlcy1jYmMoKDQ6c2hhMTg6ndF2xFqT +19k3OjUyNDI4ODApMTY6QB3EeZz7Zs2uIRmjRj/ocyk4MDoN3zs2+IgNNxe0pZQ9 +XzwAAgAA0MhK4ypYOdDc2fvfvCsjrhQyUW5ZQVVxFmf7hgY6YZzAlldXF9bD9DMC +JtcJmap6Xk5D7VClxR97yHK+ASkoMTI6cHJvdGVjdGVkLWF0MTU6MjAxMDEwMTRU +MTU0MzUyKSkp +=8r3/ +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/7E201E28B6FEB2927B321F443205F4724EBE637E.asc b/tests/openpgp/privkeys/7E201E28B6FEB2927B321F443205F4724EBE637E.asc new file mode 100644 index 0000000..7ec0448 --- /dev/null +++ b/tests/openpgp/privkeys/7E201E28B6FEB2927B321F443205F4724EBE637E.asc @@ -0,0 +1,18 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDIxOnByb3RlY3RlZC1wcml2YXRlLWtleSgzOmVsZygxOnAxMjk6AOgCS1p47zcd +ec0UvVC0phewalHUU6f7mulWr0j0ZY1RU0IOP18HAeT7INcwPcUaUvC9KYenXmYb +vO1i7sNNUCOsKUamwg+oSNMcbM3AwNwxlggTyJS1N6WzIX7MjRLUlUqtbLRhPDGl +Cltt6yeAjS0pZT646TANaBDiRIgk94ADKSgxOmcxOgUpKDE6eTEyODpGh2X1Sy+4 +Ip/RtMJDPZOY+Y6sWUN7OiM2BkdUmCLOmaOVfgrsEevKdSBBj0oVWN81U02i7jQz +hhAI3tZMFJmP/hlF7AlS5HSaLj2+t1nHAKKy70QhskINR41CCv9sHAc5gN1WrY5N +DpeI12GmqsWMPQVPUHsTTe0QsT6XbHzvCykoOTpwcm90ZWN0ZWQyNTpvcGVucGdw +LXMyazMtc2hhMS1hZXMtY2JjKCg0OnNoYTE4Or78V63MKf6HNzo0OTMzNjMyKTE2 +OkxDOAnTGrRgVCyb5u0UbCYpOTY6tghO175Vpfia/wJGrOUT0hgS3Es/EaEHv+bn +jYBeErvROJrKtUboxoGox/Qa2xxpFFhFWtR3IX6rjmqS1a5RhwEmYxFb/IzVESuZ +Kf00wS+lmJuR14ACnuAOfVF6OQP5KSgxMjpwcm90ZWN0ZWQtYXQxNToyMDEwMTAx +NFQxMjA4MTIpKSk= +=a0Os +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.asc b/tests/openpgp/privkeys/8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.asc new file mode 100644 index 0000000..370e862 --- /dev/null +++ b/tests/openpgp/privkeys/8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.asc @@ -0,0 +1,14 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDExOnByaXZhdGUta2V5KDM6ZWxnKDE6cDEyOToAzNix+drHTYCMxS8NiUZNpVTG +nWfzMjxCqVyZYt9CEm7A4JcfSbgRUppqKunwreuDmmNGFc1W+lT1oLfvJaDi/oQ/ +oubgIcq0EZ5gOUydaj961PV3ltNmaaUSZsJ6jRxaa0FB1cgx6EVB88gR6JB4mAM4 +KV+Ct/f9QzPv2TMS8qspKDE6ZzE6BikoMTp5MTI4OjdzptnsiJ124yTW5ewhvUVp +mDGuT9CuA3ggW65bjOhfravX5rfHMCXLPXMNXFgpA012vghVwun/ekkj7/rxapZm +lE28YpSDj8Pwn/lkqNAjy466My+wUeoCgg7mEg/75is2ogKzx1L52nay7BGmfS41 +5m7BBjWHsiUA6KRtFXt1KSgxOngzMTppFcbO0lgUP4k3sTNfSIfwBCt8YwBTmPk5 +a7hTI4y2KSkp +=miH9 +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD.asc b/tests/openpgp/privkeys/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD.asc new file mode 100644 index 0000000..616c697 --- /dev/null +++ b/tests/openpgp/privkeys/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD.asc @@ -0,0 +1,20 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDIxOnByb3RlY3RlZC1wcml2YXRlLWtleSgzOmVsZygxOnAxMjk6AJyN1x9X9Lsj +fX2Z8O9s7BzMO9OoOxFtvZw+FA0BuDs0WVYkq1GuZ9/XiO0K30zvtZnlb7NMvBfz +7xbLeYx+vKzy5xkq18+LE5dU+HKKdRQZKrrwgCsDy8tJRO447QsiLTksCDqPMaE3 +2OCRBF5nKrG5vih7/cmEhf2CuAn+2yM3KSgxOmcxOgcpKDE6eTEyODoZ5eYysaLn +AwPeqQ9vNvUyrCxUEmrvl4svG7zkkg3ZcgAbDpDQUmnijt3gEBCoAzO3c41TU5wJ +aUNBEPGPWfKcTlmBEGJWjK50QQuA2diGncxIS5SDs+QVaf434a6/KFVQcCmV7K8/ +T2S8/nuGJ/rIlFL5XovW6A/S9mYEjh2pDykoOTpwcm90ZWN0ZWQyNTpvcGVucGdw +LXMyazMtc2hhMS1hZXMtY2JjKCg0OnNoYTE4OkuRjUFO6YIJNzo0NjYwMjI0KTE2 +Or7L9Ekww4C0lZz3g61PzJEpMTkyOk7ezAcv7simMXQw+afvqUlhdoyVM4QQuhj8 +KzqjNP3IC2fSHoFECWxGfC1fNcuqzRnzs98TqAy5BDnNXSW+e+CpenWtLpID/dvb +azkeATfhMf/2KMd2Mahi6rnQ6IBnxhq1d5jLhYg00Ba1HbojEYOkCPKQlFV01bQw +mUsyQ7sMr42JvdFTI4lDmQlHfqoexpFpLCDv4eUKjvG/K7xs0uLiF4vyMLVH5H/k +6EF9HEP9sUF+aTDJXrrfHOUG1LR6/CkoMTI6cHJvdGVjdGVkLWF0MTU6MjAxMDEw +MTRUMTUzNTM4KSkp +=soiR +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/privkeys/FD692BD59D6640A84C8422573D469F84F3B98E53.asc b/tests/openpgp/privkeys/FD692BD59D6640A84C8422573D469F84F3B98E53.asc new file mode 100644 index 0000000..7b25b7a --- /dev/null +++ b/tests/openpgp/privkeys/FD692BD59D6640A84C8422573D469F84F3B98E53.asc @@ -0,0 +1,15 @@ +-----BEGIN PGP ARMORED FILE----- +Version: GnuPG v1.4.8 (GNU/Linux) +Comment: Use "gpg --dearmor" for unpacking + +KDExOnByaXZhdGUta2V5KDM6ZHNhKDE6cDk3OgDbbxWAbWsheUJprK6VryMTpwDi +YwMfL+92nrHqSfPqlpMWgDTia8qnpRSXbyEmSppp/6/Ygp+N3n32Kznq7PjHXiuW +LlZGvZMtzmvaMA17y0GY6oLBxS7rhASXIKa9hEUpKDE6cTIxOgD/igRZcqjTHbCv +I/mTtAPK5yJhqykoMTpnOTc6ALV10OZ7mJkWRMRYeGu1T3uwS7YYORJAHwd1fwKh +Fys7P8HZaWIXqp8EqFxk8VUEiEo3ONN9jtIRgBmTbNywKbx6WfBItoYTPEoU0UGo +oM1c/5rfmylyqwdIbMNXDhW4oykoMTp5OTc6AJNnAP6skpHlhVAmecLZT9eRzVoO +q1ivUIntK2Mh47qsL74q6BBwz2sviPU2Y3pDlbb6Ed0qJAXvdCT24hlfoGoXzkoD +InkPJTJeL0gCnwmQPjvXFFd71Cvg5LaL4lIQLSkoMTp4MjA6cZuCxaj7sT+FZqTO +y2lNfMjaQMgpKSk= +=s5nv +-----END PGP ARMORED FILE----- diff --git a/tests/openpgp/samplekeys/README b/tests/openpgp/samplekeys/README index d386169..6f8f916 100644 --- a/tests/openpgp/samplekeys/README +++ b/tests/openpgp/samplekeys/README @@ -1,4 +1,12 @@ no-creation-time.gpg A key with a zero creation time. - - +ecc-sample-1-pub.asc A NIST P-256 ECC sample key. +ecc-sample-1-sec.asc Ditto, but the secret keyblock. +ecc-sample-2-pub.asc A NIST P-384 ECC sample key. +ecc-sample-2-sec.asc Ditto, but the secret keyblock. +ecc-sample-3-pub.asc A NIST P-521 ECC sample key. +ecc-sample-3-sec.asc Ditto, but the secret keyblock. +eddsa-sample-1-pub.asc An Ed25519 sample key. +eddsa-sample-1-sec.asc Ditto, but as protected secret keyblock. +dda252ebb8ebe1af-1.asc rsa4096 key 1 +dda252ebb8ebe1af-2.asc rsa4096 key 2 with a long keyid collision. diff --git a/tests/openpgp/samplekeys/dda252ebb8ebe1af-1.asc b/tests/openpgp/samplekeys/dda252ebb8ebe1af-1.asc new file mode 100644 index 0000000..ddae954 --- /dev/null +++ b/tests/openpgp/samplekeys/dda252ebb8ebe1af-1.asc @@ -0,0 +1,29 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + + +mQINBFJtd/UBEACpw/psXoGNM8RHczviD7FnGdjMQPEJQ+nuWQ2AEGYouulg5hFv +0ChuSQVLiqQht2k5K2liyW1MeXoJ8tr9nSn/Zi9nttc0Wo6K7pvrDD40r2HNg305 +qLCzItr5st3x8cq2cIXvN4LOm2rqpBLZ/sqMmNiW2Y7/aAQqV1xtR35joHqamWHD +UPOmzBMs07YSUjXgC1EMx8kWQSV6cuARj93kxWj8R6eoYHHfrWCEGR313wov6QST +zIfVU7FqQqOmdLW3LaPHxcrI/TjsnkUN99qdlpjJH/YW925LDPJHAkliqPP5AvhU +F9KbY2F8mcIZBCDd8TH+xXynuN3BbIU4kCwVbdx/tcpO1npuJcKB1Go/udyow/Ei +Z3nHzJsCVkezvopek77wnwPaP0nAb7f4iIY3gJCoGirOx6N075TgF6MBe00q9oFE +y4rvnUnU9/QzOOes95eUMhM+9eK1cuLFEV5t47DfxRdq+fQip3FJ2l6v19sZvQ0G +j06pjYqg0of273rG8oXcDrFjb1Zqhj8x1mLl6u7d/ide5wTm9HylBWcYKQjIJJAi +WIScxEPIOINDJKgsKTuKtoyNvISJ3xUeS1yzxiIb3YGLIyPgFFx0vFyqJfbkXq70 +m1n2xnJlkTidfzbZvc6EA7vRGSDYK6FqqhlGhc7UypUEVW8FM/jZNAOS6QARAUGt +tCg5RTY2OTg2MTM2OEJDQTBCRTQyREFGN0REREEyNTJFQkI4RUJFMUFGiQI3BBMB +CgAhBQJSg/uTAhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEN2iUuu46+Gv ++Z0P+wQhkLwm+WGcEsS98Lei9O7hit/k4g/VkLUUQV7BOR3n8uRZIFkdOtpvrFU3 +aKf246uCy6GM48Oh+1U2cv5InX/WEuKaFo5uF6t79wyt18BUn1weDcU+DQdOSG4f +fSnNa55wkN0l0svW4fGIthjmDTz6HZFntYD+9A20wZAqpPIs+vyG9Jp+e9E9Y/W/ +EFQbNlxHHb9+BMT2+DtNP+HSl3MPFlQPKOLZxyLAU5uzT0Sa0LxhrQy5FgkW6Jog +sbAJVM9z0pZw+grzGPciM66ZW1rxeICvbYsdWLytRjqxpY8GS8XudyseUGd+dZim +ptarsrE5yfSMg2gW5Z1PTc0tEMXJLUwtpyzQjpFpbb7dPuo2TUp09LgZKX63WCbS +Nb1RTaGfkeYudOTo2rh4Jfg+Tb/JRpO6clo0rxAq8nPH2WmG+9TB8Zbb7YRzGWuV +/e5SeVNR+zY8tXZKnmUIH1HIprc+BtT6Bupdvd0CT14Mg9MmsFvUXofwHLa4gahr +8/iG9y3uHSA6Rhz++yOpyOmNvO1LDxsYNaRCIXQJbqgNwF5YNYlMPsEeY/CG7FOb +Afv7rHiYtRRQfz2P4OF900DJO7QL9gdNXJ1+Hajy/5Lvvl7qwqMG4GvVQEsgFc5O +jjFCUhE2i20j2kEMxvA5RLBH/fOoGARn87tiKSfb+pqLNZQb +=fDJ8 +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/dda252ebb8ebe1af-2.asc b/tests/openpgp/samplekeys/dda252ebb8ebe1af-2.asc new file mode 100644 index 0000000..8547463 --- /dev/null +++ b/tests/openpgp/samplekeys/dda252ebb8ebe1af-2.asc @@ -0,0 +1,29 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + + +mQINBFKD+38BEADSv5l4xOx9hCRJVcybq6yK5hTpGSFf3xo1bkhoMvyC62ehb4jD +MDLwwNRyzCBEWQJLbq/LLizPFN2qXFJpXJcsuqsHNYRtDqDBEjtriRQwSqHnqTXt +c0K46FYHldCJQ4/tBXxPI+WwtXjcNRWaV7n2BvR/Jk+B5e4Zz3LPnN0C4w5vORHs +hN1jil8A3Hs/F+OmlQYrU8ZtNwTpSo2EXxe2fVgSDCsKRyNsPZj++OyujPzW+yaN +lJ9I/q6s9gvX9o9o7nwZbqBETipWsdRK6RfBdTKpnyLNordbWwWTk6GxN8T5Ppit +P6a3UlQ71VuflcswCTmEQ1pEfZrlRFKa9psBOW+cZLNxT9h0jGFMh6/B3w48Sag+ +cFcPBFWParC+cAXBIURDxT9G6bzNLogg7YKoaPsyiXnLDH2VJUCXs27D2wPJL24Q +S7npvsg63MPPssWgG5cauLznmNR4y5pQi6oH/C10v0zrUJy6FPJzQhYRhWOvhtz6 +j88RGMrFNNCdB2VACtn699D+ixu3nRlXHIKCT+xLSfgslVYifmJOCNljBLGHOQ1e +FJxQuNVpmmxjvk/8kqK+pHLB9Qn6M1ZYzip7OyUL3OAWabCabgEw2bQmUhiBWD3u +buv0WAVOJEAFvBCAeYNQzrQMY+Rc3RnvynG4pI6Tbo8wC6/IJcDOw516JwARASB3 +tChBNTUxMjA0MjczNzRGM0Y3QUE1RjExNjZEREEyNTJFQkI4RUJFMUFGiQI3BBMB +CgAhBQJSg/uTAhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEN2iUuu46+Gv +9L0P/3tFu0LOZ/dAPjUNfKJCZqcIuVnD5xShMTsUbVx+QoXMy7rt4iRLD7ofGi/I +vTAZehxk3sk/Slx5nbews+3NItyw6mcaP9HlmwKNr6k7BC2kJHcCxH4DNzhmIx1H +3T/CggtHX42JBYKlGf22y+M8jAbvsPOUfTznx96mYNrOY6s1dJyn0kRleqJ8+tGj +/5+0y90iZnGCa0FtacQkKUPkXwVodeZVxk8z5OEipShYKc+8dl+5WsvOzHqLC/KY +xCGRb4JaqEMwouLNg8dTNAXXUvFGqJNDX4+andggogmI1hdD9xExfSU9cAGegg2t +vvveC4S+CCHd+zt88iK5ze6F61RxwYhhNbkuFGjdgNGCpHtG/BQhKnYJuKEbq3oi +mgNyxJERlfgaWXveiMG0AmACXN+jCkTtqZjQnsg2N2QDL3tjY7usmuiwRL1aVOFG +Kw5/Cc+2nDeANS3Xi1403Ni269b1c6kNSoLe4zd0WsbO3Kouds8F8EQfeheXQe97 +ZxuvBOMsR9wHC3f0sl/vfxCGdUC+khmKk5taKnUeUFJmVmh5ghlVy8FySHGB0QHO +zd8GUl59rFpQJNpNFQW2YKDhrcjxIr2AeJrdoDI6NsQ02+Qtep/bbq53hqtAD4jF +t3S8vBbTXtRk6g2qn4ojF4SOIc8SAiZcURgVFuSJX8ngFbO4 +=OEw/ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/ecc-sample-1-pub.asc b/tests/openpgp/samplekeys/ecc-sample-1-pub.asc new file mode 100644 index 0000000..478fc3a --- /dev/null +++ b/tests/openpgp/samplekeys/ecc-sample-1-pub.asc @@ -0,0 +1,22 @@ +The key has been generated by the first GnuPG ECC version at +http://code.google.com/p/gnupg-ecc. + +The sample key has ECDSA top key 0xBAA59D9C and a single ECDH +encryption subkey 0x4089AB73. ECDH subkey uses SHA-256 and AES-128 +with KDF. + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v2.1.0-ecc (GNU/Linux) + +mFIETJPQrRMIKoZIzj0DAQcCAwQLx6e669XwjHTHe3HuROe7C1oYMXuZbaU5PjOs +xSkyxtL2D00e/jWgufuNN4ftS+6XygEtB7j1g1vnCTVF1TLmtCRlY19kc2FfZGhf +MjU2IDxvcGVucGdwQGJyYWluaHViLm9yZz6IegQTEwgAIgUCTJPQrQIbAwYLCQgH +AwIGFQgCCQoLBBYCAwECHgECF4AACgkQC6Ut8LqlnZzmXQEAiKgiSzPSpUOJcX9d +JtLJ5As98Alit2oFwzhxG7mSVmQA/RP67yOeoUtdsK6bwmRA95cwf9lBIusNjehx +XDfpHj+/uFYETJPQrRIIKoZIzj0DAQcCAwR/cMCoGEzcrqXbILqP7Rfke977dE1X +XsRJEwrzftreZYrn7jXSDoiXkRyfVkvjPZqUvB5cknsaoH/3UNLRHClxAwEIB4hh +BBgTCAAJBQJMk9CtAhsMAAoJEAulLfC6pZ2c1yYBAOSUmaQ8rkgihnepbnpK7tNz +3QEocsLEtsTCDUBGNYGyAQDclifYqsUChXlWKaw3md+yHJPcWZXzHt37c4q/MhIm +oQ== +=hMzp +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/ecc-sample-1-sec.asc b/tests/openpgp/samplekeys/ecc-sample-1-sec.asc new file mode 100644 index 0000000..5ff5555 --- /dev/null +++ b/tests/openpgp/samplekeys/ecc-sample-1-sec.asc @@ -0,0 +1,25 @@ +The key has been generated by the first GnuPG ECC version at +http://code.google.com/p/gnupg-ecc. + +The sample key has ECDSA top key 0xBAA59D9C and a single ECDH +encryption subkey 0x4089AB73. ECDH subkey uses SHA-256 and AES-128 +with KDF. The password for the key is "ecc". + +-----BEGIN PGP PRIVATE KEY BLOCK----- +Version: GnuPG v2.1.0-ecc (GNU/Linux) + +lJ0ETJPQrRMIKoZIzj0DAQcCAwQLx6e669XwjHTHe3HuROe7C1oYMXuZbaU5PjOs +xSkyxtL2D00e/jWgufuNN4ftS+6XygEtB7j1g1vnCTVF1TLm/gMDAmHomSLb9NbE +oyWUoqgKTbZzbFR/SWmiCcuiQEhREcTyvyU1hAglj7FsBJoQ6/pbeAEQZ3bVzlNM +8F0nF8KPLPuEADF1+4CntCRlY19kc2FfZGhfMjU2IDxvcGVucGdwQGJyYWluaHVi +Lm9yZz6IegQTEwgAIgUCTJPQrQIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AA +CgkQC6Ut8LqlnZzmXQEAiKgiSzPSpUOJcX9dJtLJ5As98Alit2oFwzhxG7mSVmQA +/RP67yOeoUtdsK6bwmRA95cwf9lBIusNjehxXDfpHj+/nKEETJPQrRIIKoZIzj0D +AQcCAwR/cMCoGEzcrqXbILqP7Rfke977dE1XXsRJEwrzftreZYrn7jXSDoiXkRyf +VkvjPZqUvB5cknsaoH/3UNLRHClxAwEIB/4DAwJh6Jki2/TWxKO7gHKWIcOcxYZp +CRWjlUghbKb6Q83p8GLPjKRN0USl/U1tObWdksqMXhUO0ePLWUnrbwoWYfYXg9Er +ADTgCYhhBBgTCAAJBQJMk9CtAhsMAAoJEAulLfC6pZ2c1yYA/3eJRirPQZmBno+Z +P/HOBSFWmFt4cUBGUx3oqiUd5loOAP480pb+vXx9ipljJWCJDSl/boRSuqB4hePP +qt9Rd5gNdQ== +=O8Dg +-----END PGP PRIVATE KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/ecc-sample-2-pub.asc b/tests/openpgp/samplekeys/ecc-sample-2-pub.asc new file mode 100644 index 0000000..f898012 --- /dev/null +++ b/tests/openpgp/samplekeys/ecc-sample-2-pub.asc @@ -0,0 +1,25 @@ +ECC NIST P-384 key taken from +https://sites.google.com/site/brainhub/pgpecckeys + +The sample key has ECDSA top key 0x098033880F54719F and a single ECDH +encryption subkey 0xAA8B938F9A201946. ECDH subkey uses SHA-384 and +AES-256 with KDF. + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: PGP Command Line v10.0.0 (Linux) + +mQBvBE1TBZITBSuBBAAiAwME9rjFrO1bhO+fSiCdsuSp37cNKMuMEOzVdnSp+lpn +OJlCti1eUTZ99Me/0/jlAP7s8H7SZaYhqOu75T6UfseMZ366FDvRUzwrNQ4cKfgj +E+HhEI66Bjvh5ksQ5pUOeZwttCRlY19kc2FfZGhfMzg0IDxvcGVucGdwQGJyYWlu +aHViLm9yZz6JAMsEEBMJAFMFAk1TBZIwFIAAAAAAIAAHcHJlZmVycmVkLWVtYWls +LWVuY29kaW5nQHBncC5jb21wZ3BtaW1lBAsJCAcCGQEFGwMAAAACFgIFHgEAAAAE +FQkKCAAKCRAJgDOID1Rxn8orAYCqNzUJaL1fEVr9jOe8exA4IhUtv/BtCvzag1Mp +UQkFuYy0abogj6q4fHQSt5nntjMBf1g2TqSA6KGj8lOgxfIsRG6L6an85iEBNu4w +gRq71JE53ii1vfjcNtBq50hXnp/1A7kAcwRNUwWSEgUrgQQAIgMDBC+qhAJKILZz +XEiX76W/tBv4W37v6rXKDLn/yOoEpGrLJVNKV3aU+eJTQKSrUiOp3R7aUwyKouZx +jbENfmclWMdzb+CTaepXOaKjVUvxbUH6pQVi8RxtObvV3/trmp7JGAMBCQmJAIQE +GBMJAAwFAk1TBZIFGwwAAAAACgkQCYAziA9UcZ+AlwGA7uem2PzuQe5PkonfF/m8 ++dlV3KJcWDuUM286Ky1Jhtxc9Be40tyG90Gp4abSNsDjAX0cdldUWKDPuTroorJ0 +/MZc7s16ke7INla6EyGZafBpRbSMVr0EFSw6BVPF8vS9Emc= +=I76R +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/ecc-sample-2-sec.asc b/tests/openpgp/samplekeys/ecc-sample-2-sec.asc new file mode 100644 index 0000000..b163f63 --- /dev/null +++ b/tests/openpgp/samplekeys/ecc-sample-2-sec.asc @@ -0,0 +1,22 @@ +ECC NIST P-384 key taken from +https://sites.google.com/site/brainhub/pgpecckeys + +The sample key has ECDSA top key 0x098033880F54719F and a single ECDH +encryption subkey 0xAA8B938F9A201946. ECDH subkey uses SHA-384 and +AES-256 with KDF. The password for the key is "ecc". + +-----BEGIN PGP PRIVATE KEY BLOCK----- +Version: PGP Command Line v10.0.0 (Linux) + +lQDSBE1TBZITBSuBBAAiAwME9rjFrO1bhO+fSiCdsuSp37cNKMuMEOzVdnSp+lpn +OJlCti1eUTZ99Me/0/jlAP7s8H7SZaYhqOu75T6UfseMZ366FDvRUzwrNQ4cKfgj +E+HhEI66Bjvh5ksQ5pUOeZwt/gcDAkrFTsfF6LKsqD/tW6Eot2DDE8znJjnQQ/Nr +H98XT1WQ9V0ED8l9DDIIj7z80ED3NR8XMSI8Ew/A/0w6NDPL978BX0MGvpaeBaWV +tEuH1EPAxiA+hFALwftY+a8s1zLktCRlY19kc2FfZGhfMzg0IDxvcGVucGdwQGJy +YWluaHViLm9yZz6dANYETVMFkhIFK4EEACIDAwQvqoQCSiC2c1xIl++lv7Qb+Ft+ +7+q1ygy5/8jqBKRqyyVTSld2lPniU0Ckq1Ijqd0e2lMMiqLmcY2xDX5nJVjHc2/g +k2nqVzmio1VL8W1B+qUFYvEcbTm71d/7a5qeyRgDAQkJ/gkDAqqmkngPLoJGqI4O +rHyyU3wrrPzDDDURkseoUEZlDZINjyto26A8N825mqLqeFytJuuABYH1UnLs4d2x +ZJZIYjEoFMPcFPuUtx+IZnECa1Vcyq2aRFCixVO0G/xrSFar +=a4k3 +-----END PGP PRIVATE KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/ecc-sample-3-pub.asc b/tests/openpgp/samplekeys/ecc-sample-3-pub.asc new file mode 100644 index 0000000..14b49d3 --- /dev/null +++ b/tests/openpgp/samplekeys/ecc-sample-3-pub.asc @@ -0,0 +1,28 @@ +ECC NIST P-521 key taken from +https://sites.google.com/site/brainhub/pgpecckeys + +The sample key has ECDSA top key 0x6B4184E145AF2FFE and a single ECDH +encryption subkey 0x07EAAA48A81C4838. ECDH subkey uses SHA-512 and +AES-256 with KDF. + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: PGP Command Line v10.0.0 (Linux) + +mQCTBE1TFQITBSuBBAAjBCMEAWuwULfE2XoQmJhSQZ8rT5Ecr/kooudn4043gXHy +NZEdTeFfY2G7kwEaxj8TXfd1U1b4PkEoqhzKxhz/MHK/lwi2ARzW1XQiJ1/kFPsv +IUnQI1CUS099WKKQhD8JMPPyje1dKfjFjm2gzyF3TOMX1Cyy8wFyF0MiHVgB3ezb +w7C6jY+3tCRlY19kc2FfZGhfNTIxIDxvcGVucGdwQGJyYWluaHViLm9yZz6JAO0E +EBMKAFMFAk1TFQIwFIAAAAAAIAAHcHJlZmVycmVkLWVtYWlsLWVuY29kaW5nQHBn +cC5jb21wZ3BtaW1lBAsJCAcCGQEFGwMAAAACFgIFHgEAAAAEFQoJCAAKCRBrQYTh +Ra8v/sm3Agjl0YO73iEpu1z1wGtlUnACi21ti2PJNGlyi84yvDQED0+mxhhTRQYz +3ESaS1s/+4psP4aH0jeVQhce15a9RqfX+AIHam7i8K/tiKFweEjpyMCB594zLzY6 +lWbUf1/1a+tNv3B6yuIwFB1LY1B4HNrze5DUnngEOkmQf2esw/4nQGB87Rm5AJcE +TVMVAhIFK4EEACMEIwQBsRFES0RLIOcCyO18cq2GaphSGXqZtyvtHQt7PKmVNrSw +UuxNClntOe8/DLdq5mYDwNsbT8vi08PyQgiNsdJkcIgAlAayAGB556GKHEmP1JC7 +lCUxRi/2ecJS0bf6iTTqTqZWEFhYs2aXESwFFt3V4mga/OyTGXOpnauHZ22pVLCz +6kADAQoJiQCoBBgTCgAMBQJNUxUCBRsMAAAAAAoJEGtBhOFFry/++p0CCQFJgUCn +kiTKCNfP8Q/MO2BCp1QyESk53GJlCgIBAoa7U6X2fQxe2+OU+PNCjicJmZiSrV6x +6nYfGJ5Jx753sqJWtwIJAc9ZxCQhj4V52FmbPYexZPPneIdeCDjtowD6KUZxiS0K +eD8EzdmeJQWBQsnPtJC/JJL4zz6JyYMXf4jIb5JyGNQC +=5yaB +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/ecc-sample-3-sec.asc b/tests/openpgp/samplekeys/ecc-sample-3-sec.asc new file mode 100644 index 0000000..6552e7a --- /dev/null +++ b/tests/openpgp/samplekeys/ecc-sample-3-sec.asc @@ -0,0 +1,24 @@ +ECC NIST P-521 key taken from +https://sites.google.com/site/brainhub/pgpecckeys + +The sample key has ECDSA top key 0x6B4184E145AF2FFE and a single ECDH +encryption subkey 0x07EAAA48A81C4838. ECDH subkey uses SHA-512 and +AES-256 with KDF. The password for the key is "ecc". + +-----BEGIN PGP PRIVATE KEY BLOCK----- +Version: PGP Command Line v10.0.0 (Linux) + +lQEIBE1TFQITBSuBBAAjBCMEAWuwULfE2XoQmJhSQZ8rT5Ecr/kooudn4043gXHy +NZEdTeFfY2G7kwEaxj8TXfd1U1b4PkEoqhzKxhz/MHK/lwi2ARzW1XQiJ1/kFPsv +IUnQI1CUS099WKKQhD8JMPPyje1dKfjFjm2gzyF3TOMX1Cyy8wFyF0MiHVgB3ezb +w7C6jY+3/gcDAv+CotECRPpSqGkqKrz+xAhAqswHXzFIBprFF0XiDooWktZSTAUR +JVB2U6m28wC4rE3RkqFeR1B+kg4nxEAJ9k6BI8oDE0iyOY5aklF2TxPpTs/BA+N2 +O4hnXb1l5qXfuyd3bSwDeyfq3CdFe4TeKp7vtCRlY19kc2FfZGhfNTIxIDxvcGVu +cGdwQGJyYWluaHViLm9yZz6dAQwETVMVAhIFK4EEACMEIwQBsRFES0RLIOcCyO18 +cq2GaphSGXqZtyvtHQt7PKmVNrSwUuxNClntOe8/DLdq5mYDwNsbT8vi08PyQgiN +sdJkcIgAlAayAGB556GKHEmP1JC7lCUxRi/2ecJS0bf6iTTqTqZWEFhYs2aXESwF +Ft3V4mga/OyTGXOpnauHZ22pVLCz6kADAQoJ/gkDAki71k/zBW2qqGyScDNNuWaA +9A5aWhpNNyRrFembt7f/W+b591G3twdNmdCIh29VoOmQw3fO8wwgsPTUxQFgd8J3 +ncft0zciEcDZi/ztLZA3+rIIP2myZLIs9xLG+k+gf3nXpeED4uYqQX3GL+32PKwg +=Qnd8 +-----END PGP PRIVATE KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/eddsa-sample-1-pub.asc b/tests/openpgp/samplekeys/eddsa-sample-1-pub.asc new file mode 100644 index 0000000..5a65453 --- /dev/null +++ b/tests/openpgp/samplekeys/eddsa-sample-1-pub.asc @@ -0,0 +1,15 @@ +pub ed25519/97965A9A 2014-08-19 + Key fingerprint = C959 BDBA FA32 A2F8 9A15 3B67 8CFD E121 9796 5A9A + Keygrip = 0DD40284FF992CD24DC4AAC367037E066FCEE26A +uid [ unknown] EdDSA sample key 1 (draft-koch-eddsa-for-openpgp-00) + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v2 + +mDMEU/NfCxYJKwYBBAHaRw8BAQdAPwmJlL3ZFu1AUxl5NOSofIBzOhKA1i+AEJku +Q+47JAa0NEVkRFNBIHNhbXBsZSBrZXkgMSAoZHJhZnQta29jaC1lZGRzYS1mb3It +b3BlbnBncC0wMCmIeQQTFggAIQUCU/NfCwIbAwULCQgHAgYVCAkKCwIEFgIDAQIe +AQIXgAAKCRCM/eEhl5ZamnNOAP9pKn5wz3jPsgy9p65zxz1+xJEr/cczFQx/tYkk +49tkeAD+P9jJE4SFD2lVofxn1e22H7YLvcVyHDOA9gpYWTNXiAU= +=Jbi7 +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/eddsa-sample-1-sec.asc b/tests/openpgp/samplekeys/eddsa-sample-1-sec.asc new file mode 100644 index 0000000..4b5fbcc --- /dev/null +++ b/tests/openpgp/samplekeys/eddsa-sample-1-sec.asc @@ -0,0 +1,19 @@ +sec ed25519/97965A9A 2014-08-19 + Key fingerprint = C959 BDBA FA32 A2F8 9A15 3B67 8CFD E121 9796 5A9A + Keygrip = 0DD40284FF992CD24DC4AAC367037E066FCEE26A +uid [ unknown] EdDSA sample key 1 (draft-koch-eddsa-for-openpgp-00) + +The passphrase is "abc". + +-----BEGIN PGP PRIVATE KEY BLOCK----- +Version: GnuPG v2 + +lIYEU/NfCxYJKwYBBAHaRw8BAQdAPwmJlL3ZFu1AUxl5NOSofIBzOhKA1i+AEJku +Q+47JAb+BwMCeZTNZ5R2udDknlhWE5VnJaHe+HFieLlfQA+nibymcJS5lTYL7NP+ +3CY63ylHwHoS7PuPLpdbEvROJ60u6+a/bSe86jRcJODR6rN2iG9v5LQ0RWREU0Eg +c2FtcGxlIGtleSAxIChkcmFmdC1rb2NoLWVkZHNhLWZvci1vcGVucGdwLTAwKYh5 +BBMWCAAhBQJT818LAhsDBQsJCAcCBhUICQoLAgQWAgMBAh4BAheAAAoJEIz94SGX +llqac04A/2kqfnDPeM+yDL2nrnPHPX7EkSv9xzMVDH+1iSTj22R4AP4/2MkThIUP +aVWh/GfV7bYftgu9xXIcM4D2ClhZM1eIBQ== +=+9EF +-----END PGP PRIVATE KEY BLOCK----- diff --git a/tests/openpgp/seat.test b/tests/openpgp/seat.test index 28e6925..b400e72 100755 --- a/tests/openpgp/seat.test +++ b/tests/openpgp/seat.test @@ -11,8 +11,8 @@ . $srcdir/defs.inc || exit 3 for i in $plain_files ; do - echo "$usrpass1" | $GPG --passphrase-fd 0 --always-trust -seat \ - -r two -o x --yes $i + echo "$usrpass1" | $GPG --passphrase-fd 0 ${opt_always} -seat \ + -r two@example.com -o x --yes $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/signencrypt-dsa.test b/tests/openpgp/signencrypt-dsa.test index 77ded12..2fb2bb1 100755 --- a/tests/openpgp/signencrypt-dsa.test +++ b/tests/openpgp/signencrypt-dsa.test @@ -12,17 +12,24 @@ #info Checking signing and encryption for DSA for i in $plain_files $data_files ; do - $GPG $dsa_keyrings --always-trust -se -o x --yes \ + $GPG ${opt_always} -se -o x --yes \ -u "$dsa_usrname1" -r "$dsa_usrname2" $i - $GPG $dsa_keyrings -o y --yes x + $GPG -o y --yes x cmp $i y || error "$i: mismatch" done -for da in ripemd160 sha1; do +algos="sha1" +if have_hash_algo "RIPEMD160"; then + algos="ripemd160 $algos" +else + echo "Hash algorithm RIPEMD160 is not installed (not an error)" +fi + +for da in $algos; do for i in $plain_files; do - $GPG $dsa_keyrings --always-trust -se -o x --yes --digest-algo $da \ + $GPG ${opt_always} -se -o x --yes --digest-algo $da \ -u "$dsa_usrname1" -r "$dsa_usrname2" $i - $GPG $dsa_keyrings -o y --yes x + $GPG -o y --yes x cmp $i y || error "$i: mismatch" # process only the first one break diff --git a/tests/openpgp/signencrypt.test b/tests/openpgp/signencrypt.test index 8ccbaf7..5644bef 100755 --- a/tests/openpgp/signencrypt.test +++ b/tests/openpgp/signencrypt.test @@ -13,7 +13,7 @@ info "Checking signing and encryption" for i in $plain_files $data_files ; do - echo "$usrpass1" | $GPG --passphrase-fd 0 --always-trust \ + echo "$usrpass1" | $GPG --passphrase-fd 0 ${opt_always} \ -se -o x --yes -r "$usrname2" $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" diff --git a/tests/openpgp/sigs-dsa.test b/tests/openpgp/sigs-dsa.test index 8b3b14f..4ba43ac 100755 --- a/tests/openpgp/sigs-dsa.test +++ b/tests/openpgp/sigs-dsa.test @@ -12,16 +12,22 @@ #info Checking DSA signatures (default digest algo) for i in $plain_files $data_files; do - $GPG $dsa_keyrings -s -o x --yes -u $dsa_usrname1 $i - $GPG $dsa_keyrings -o y --yes x + $GPG -s -o x --yes -u $dsa_usrname1 $i + $GPG -o y --yes x cmp $i y || error "$i: mismatch" done -for da in ripemd160 sha1; do +algos="sha1" +if have_hash_algo "RIPEMD160"; then + algos="ripemd160 $algos" +else + echo "Hash algorithm RIPEMD160 is not installed (not an error)" +fi + +for da in $algos; do for i in $plain_files; do - $GPG $dsa_keyrings --digest-algo $da \ - -s -o x --yes -u $dsa_usrname1 $i - $GPG $dsa_keyrings -o y --yes x + $GPG --digest-algo $da -s -o x --yes -u $dsa_usrname1 $i + $GPG -o y --yes x cmp $i y || error "$i: mismatch" # process only the first one break diff --git a/tests/openpgp/sigs.test b/tests/openpgp/sigs.test index a4bf76c..d6d8898 100755 --- a/tests/openpgp/sigs.test +++ b/tests/openpgp/sigs.test @@ -11,7 +11,7 @@ . $srcdir/defs.inc || exit 3 for i in $plain_files $data_files; do - echo "$usrpass1" | $GPG --passphrase-fd 0 -s -o x --yes $i + $GPG -s -o x --yes $i $GPG -o y --yes x cmp $i y || error "$i: mismatch" done diff --git a/tests/openpgp/version.test b/tests/openpgp/version.test index 34733e2..057bcf0 100755 --- a/tests/openpgp/version.test +++ b/tests/openpgp/version.test @@ -10,8 +10,98 @@ . $srcdir/defs.inc || exit 3 -# print the GPG version -$GPG --version +# This is the first test run by "make check". First kill a possible +# gpg-agent process from a previous test run. +if $GPG_AGENT --quiet; then + echo "$pgmname: killing leftover gpg-agent process" >&2 + $GPG_CONNECT_AGENT killagent /bye >/dev/null + sleep 2 +fi + + +info "Deleting old files" +if [ -f Makefile -a -f $srcdir/decrypt-dsa.test ]; then + : +else + fatal "not running in the test directory" + exit 1 +fi +if [ -d private-keys-v1.d ]; then + rm private-keys-v1.d/* 2>/dev/null || true + rmdir private-keys-v1.d +fi +for i in pubring.gpg pubring.gpg~ trustdb.gpg trustdb.gpg~ ; do + [ -d "$i" ] && rm "$i" +done + +# Now start the agent right away, so that there is only one place +# where starting the agent may fail. To speed up key generation we +# create a faked random seed file. Note that we need to set the +# agent-program so that gpg-connect-agent is able to start the agent +# we are currently testing and not an already installed one. +# The "|--debug-quick-random" is a hack to start gpg-agent with +# that option on the command line. +info "Starting the agent" +$MKTDATA 600 >random_seed +if $GPG_CONNECT_AGENT -v \ + --agent-program="${GPG_AGENT}|--debug-quick-random" /bye; then + : +else + error "starting the gpg-agent failed" + exit 1 +fi + + +info "Creating sample data files" +for i in 500 9000 32000 80000; do + $MKTDATA $i >data-$i +done +cat $srcdir/../../doc/HACKING \ + $srcdir/../../doc/DETAILS \ + $srcdir/../../doc/gpg.texi >plain-large + +info "Unpacking samples" +$GPG --dearmor < $srcdir/plain-1o.asc > ./plain-1 +$GPG --dearmor < $srcdir/plain-2o.asc > ./plain-2 +$GPG --dearmor < $srcdir/plain-3o.asc > ./plain-3 + +info "Storing private keys" +for i in 50B2D4FA4122C212611048BC5FC31BD44393626E \ + 7E201E28B6FEB2927B321F443205F4724EBE637E \ + 13FDB8809B17C5547779F9D205C45F47CE0217CE \ + 343D8AF79796EE107D645A2787A9D9252F924E6F \ + 8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34 \ + 0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255 \ + FD692BD59D6640A84C8422573D469F84F3B98E53 \ + 76F7E2B35832976B50A27A282D9B87E44577EB66 \ + A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD ; do + $GPG --dearmor < $srcdir/privkeys/$i.asc > private-keys-v1.d/$i.key +done -#fixme: check that the output is correct +info "Importing public demo and test keys" +$GPG --yes --import $srcdir/pubdemo.asc $srcdir/pubring.asc +$GPG --dearmor < $srcdir/pubring.pkr.asc | $GPG --yes --import + + +info "Preset passphrases" +# one@example.com +$GPG_PRESET_PASSPHRASE --preset -P def 50B2D4FA4122C212611048BC5FC31BD44393626E +$GPG_PRESET_PASSPHRASE --preset -P def 7E201E28B6FEB2927B321F443205F4724EBE637E +# alpha@example.net +$GPG_PRESET_PASSPHRASE --preset -P abc 76F7E2B35832976B50A27A282D9B87E44577EB66 +$GPG_PRESET_PASSPHRASE --preset -P abc A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD + + +# Note: secring.asc and secring.skr.asc are the original secrings for +# our test files. We don't support this as storage format anymore but +# keep the files here for reference. The actual keys have been +# extracted and put in gpg-agent's format unter privkeys/. Because +# the current gpg's import feature does not support storing of +# unprotected keys in the new gpg-agent format, we had to resort to +# some trickery to convert them. + + +info "Printing the GPG version" +$GPG --version +#fixme: check that the output is as expected -- cgit v1.2.3