From 9ce77aad3037fd39d6320798e1ffad22e419d79c Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Mon, 11 Sep 2017 17:22:44 +0100 Subject: [PATCH 1/7] Add TODO.md --- TODO.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..747d878 --- /dev/null +++ b/TODO.md @@ -0,0 +1,7 @@ +# TODO list + +- Introduce gnupg_geterrorinfo with more info about the error + - including error message from gpgme +- Allow setting engine info on object construction + - Add __construct / res init with gpgme_ctx_set_engine_info +- Return decrypt result if extra param supplied From 730cd697a170a78606f9bcbd397d90c3b698f458 Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Mon, 11 Sep 2017 17:23:06 +0100 Subject: [PATCH 2/7] Ignore configure.ac --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6fa69f9..fba9777 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ config.nice config.status config.sub configure +configure.ac configure.in extras include From 6f46b406e9082a297520f3d9049e6fc6e0b7ca60 Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Mon, 11 Sep 2017 17:23:17 +0100 Subject: [PATCH 3/7] Fix small CS issue --- gnupg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnupg.c b/gnupg.c index eb6a7f0..204d594 100644 --- a/gnupg.c +++ b/gnupg.c @@ -729,7 +729,7 @@ PHP_FUNCTION(gnupg_seterrormode) */ PHP_FUNCTION(gnupg_setsignmode) { - phpc_long_t signmode; + phpc_long_t signmode; GNUPG_GETOBJ(); From 2b3d5b5a295766983c60147f6b0d4e8dc469893d Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Tue, 12 Sep 2017 18:45:40 +0100 Subject: [PATCH 4/7] Prefix static functions --- gnupg.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/gnupg.c b/gnupg.c index 204d594..c77ea96 100644 --- a/gnupg.c +++ b/gnupg.c @@ -82,8 +82,8 @@ PHPC_OBJ_DEFINE_HANDLER_VAR(gnupg); } while (0) /* }}} */ -/* {{{ gnupg_free_encryptkeys */ -static void gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) +/* {{{ php_gnupg_free_encryptkeys */ +static void php_gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) { if (PHPC_THIS) { int idx; @@ -102,8 +102,8 @@ static void gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) } /* }}} */ -/* {{{ gnupg_free_resource_ptr */ -static void gnupg_free_resource_ptr(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) +/* {{{ php_gnupg_free_resource_ptr */ +static void php_gnupg_free_resource_ptr(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) { if (PHPC_THIS) { if (PHPC_THIS->ctx) { @@ -113,7 +113,7 @@ static void gnupg_free_resource_ptr(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) PHPC_THIS->ctx = NULL; } /* basic cleanup */ - gnupg_free_encryptkeys(PHPC_THIS TSRMLS_CC); + php_gnupg_free_encryptkeys(PHPC_THIS TSRMLS_CC); zend_hash_destroy(PHPC_THIS->signkeys); FREE_HASHTABLE(PHPC_THIS->signkeys); zend_hash_destroy(PHPC_THIS->decryptkeys); @@ -122,17 +122,17 @@ static void gnupg_free_resource_ptr(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) } /* }}} */ -/* {{{ gnupg_res_dtor */ -static void gnupg_res_dtor(phpc_res_entry_t *rsrc TSRMLS_DC) /* {{{ */ +/* {{{ php_gnupg_res_dtor */ +static void php_gnupg_res_dtor(phpc_res_entry_t *rsrc TSRMLS_DC) /* {{{ */ { PHPC_THIS_DECLARE(gnupg) = rsrc->ptr; - gnupg_free_resource_ptr(PHPC_THIS TSRMLS_CC); + php_gnupg_free_resource_ptr(PHPC_THIS TSRMLS_CC); efree(PHPC_THIS); } /* }}} */ -/* {{{ gnupg_res_init */ -static void gnupg_res_init(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) +/* {{{ php_gnupg_res_init */ +static void php_gnupg_res_init(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) { /* init the gpgme-lib and set the default values */ gpgme_ctx_t ctx; @@ -165,7 +165,7 @@ PHPC_OBJ_HANDLER_FREE(gnupg) { PHPC_OBJ_HANDLER_FREE_INIT(gnupg); - gnupg_free_resource_ptr(PHPC_THIS TSRMLS_CC); + php_gnupg_free_resource_ptr(PHPC_THIS TSRMLS_CC); PHPC_OBJ_HANDLER_FREE_DESTROY(); } @@ -175,7 +175,7 @@ PHPC_OBJ_HANDLER_CREATE_EX(gnupg) { PHPC_OBJ_HANDLER_CREATE_EX_INIT(gnupg); - gnupg_res_init(PHPC_THIS TSRMLS_CC); + php_gnupg_res_init(PHPC_THIS TSRMLS_CC); PHPC_OBJ_HANDLER_CREATE_EX_RETURN(gnupg); } @@ -456,7 +456,7 @@ PHP_MINIT_FUNCTION(gnupg) /* register resource */ le_gnupg = zend_register_list_destructors_ex( - gnupg_res_dtor, NULL, "ctx", module_number); + php_gnupg_res_dtor, NULL, "ctx", module_number); if (SUCCESS != gnupg_keylistiterator_init()) { return FAILURE; @@ -651,7 +651,7 @@ PHP_FUNCTION(gnupg_init) { PHPC_THIS_DECLARE(gnupg); PHPC_THIS = emalloc(sizeof(PHPC_OBJ_STRUCT_NAME(gnupg))); - gnupg_res_init(PHPC_THIS TSRMLS_CC); + php_gnupg_res_init(PHPC_THIS TSRMLS_CC); PHPC_RES_RETURN(PHPC_RES_REGISTER(PHPC_THIS, le_gnupg)); } /* }}} */ @@ -1065,7 +1065,7 @@ PHP_FUNCTION(gnupg_clearencryptkeys) } GNUPG_RES_FETCH(); } - gnupg_free_encryptkeys(PHPC_THIS TSRMLS_CC); + php_gnupg_free_encryptkeys(PHPC_THIS TSRMLS_CC); RETURN_TRUE; } From 3bb4d28798079c73840d15c10dd4b1e4889447cf Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Tue, 12 Sep 2017 18:50:50 +0100 Subject: [PATCH 5/7] Remove hack for PHP 4 in freeing encryptkeys and fix CS --- gnupg.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/gnupg.c b/gnupg.c index c77ea96..8cc84d4 100644 --- a/gnupg.c +++ b/gnupg.c @@ -88,14 +88,10 @@ static void php_gnupg_free_encryptkeys(PHPC_THIS_DECLARE(gnupg) TSRMLS_DC) if (PHPC_THIS) { int idx; /* loop through all encryptkeys and unref them in the gpgme-lib */ - for (idx=0; idx < PHPC_THIS->encrypt_size; idx++) { + for (idx = 0; idx < PHPC_THIS->encrypt_size; idx++) { gpgme_key_unref(PHPC_THIS->encryptkeys[idx]); } - /* it's an odd-thing, but other solutions makes problems : - * erealloc(x,0) gives a segfault with PHP 4 and debug enabled - * efree(x) alone ends in a segfault - */ - efree(erealloc(PHPC_THIS->encryptkeys, 0)); + efree(PHPC_THIS->encryptkeys); PHPC_THIS->encryptkeys = NULL; PHPC_THIS->encrypt_size = 0; } From 4aabe3c9664a728cf5226c42e293053c6eaf38a6 Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Thu, 17 May 2018 20:15:14 +0100 Subject: [PATCH 6/7] Refactore all test to be independent --- tests/gnupg_oo_deletekey.phpt | 21 ++++++++++++++ tests/gnupg_oo_encrypt.phpt | 22 +++++++++----- tests/gnupg_oo_encryptsign.phpt | 25 +++++++++------- tests/gnupg_oo_export.phpt | 14 ++++++--- ..._0001_import.phpt => gnupg_oo_import.phpt} | 17 +++++++---- tests/gnupg_oo_keyinfo.phpt | 13 +++++++-- tests/gnupg_oo_listsignatures.phpt | 15 +++++++--- tests/gnupg_oo_sign_clear.phpt | 19 ++++++++---- tests/gnupg_oo_sign_detach.phpt | 19 ++++++++---- tests/gnupg_oo_sign_detach_nonarmor.phpt | 23 ++++++++++----- tests/gnupg_oo_sign_normal.phpt | 21 +++++++++----- tests/gnupg_oo_sign_normal_noarmor.phpt | 29 +++++++++++-------- tests/gnupg_oo_zzz_deletekey.phpt | 14 --------- tests/gnupg_res_0001_import.phpt | 15 +++++++--- ...eletekey.phpt => gnupg_res_deletekey.phpt} | 11 ++++++- tests/gnupg_res_encrypt.phpt | 11 ++++++- tests/gnupg_res_encryptsign.phpt | 11 ++++++- tests/gnupg_res_export.phpt | 12 ++++++-- tests/gnupg_res_keyinfo.phpt | 11 ++++++- tests/gnupg_res_listsignatures.phpt | 11 ++++++- tests/gnupg_res_sign_clear.phpt | 13 +++++++-- tests/gnupg_res_sign_detach.phpt | 13 +++++++-- tests/gnupg_res_sign_detach_nonarmor.phpt | 11 ++++++- tests/gnupg_res_sign_normal.phpt | 11 ++++++- tests/gnupg_res_sign_normal_noarmor.phpt | 11 ++++++- tests/gnupgt.inc | 21 ++++++++++++++ 26 files changed, 306 insertions(+), 108 deletions(-) create mode 100644 tests/gnupg_oo_deletekey.phpt rename tests/{gnupg_oo_0001_import.phpt => gnupg_oo_import.phpt} (68%) delete mode 100644 tests/gnupg_oo_zzz_deletekey.phpt rename tests/{gnupg_res_zzz_deletekey.phpt => gnupg_res_deletekey.phpt} (53%) create mode 100644 tests/gnupgt.inc diff --git a/tests/gnupg_oo_deletekey.phpt b/tests/gnupg_oo_deletekey.phpt new file mode 100644 index 0000000..6366752 --- /dev/null +++ b/tests/gnupg_oo_deletekey.phpt @@ -0,0 +1,21 @@ +--TEST-- +delete a key from the keyring +--SKIPIF-- + +--FILE-- +seterrormode(gnupg::ERROR_WARNING); +$ret = $gpg->deletekey($fingerprint,true); +var_dump($ret); +?> +--EXPECT-- +bool(true) +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_encrypt.phpt b/tests/gnupg_oo_encrypt.phpt index be415af..b32be83 100644 --- a/tests/gnupg_oo_encrypt.phpt +++ b/tests/gnupg_oo_encrypt.phpt @@ -4,18 +4,24 @@ encrypt and decrypt a text --FILE-- seterrormode(gnupg::ERROR_WARNING); -$gpg -> addencryptkey($fingerprint); -$enc = $gpg -> encrypt($plaintext); -$gpg = NULL; +require_once "gnupgt.inc"; +gnupgt::import_key(); $gpg = new gnupg(); -$gpg -> adddecryptkey($fingerprint, $passphrase); -$ret = $gpg -> decrypt ($enc); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$gpg->addencryptkey($fingerprint); +$enc = $gpg->encrypt($plaintext); + +$gpg = new gnupg(); +$gpg->adddecryptkey($fingerprint, $passphrase); +$ret = $gpg->decrypt($enc); var_dump($ret); ?> --EXPECTF-- string(7) "foo bar" +--CLEAN-- + diff --git a/tests/gnupg_oo_encryptsign.phpt b/tests/gnupg_oo_encryptsign.phpt index 801697b..d0de745 100644 --- a/tests/gnupg_oo_encryptsign.phpt +++ b/tests/gnupg_oo_encryptsign.phpt @@ -4,19 +4,19 @@ encryptsign and decryptverify a text --FILE-- seterrormode(gnupg::ERROR_WARNING); -$gpg -> addencryptkey($fingerprint); -$gpg -> addsignkey($fingerprint, $passphrase); -$enc = $gpg -> encryptsign($plaintext); +require_once "gnupgt.inc"; +gnupgt::import_key(); + +$gpg = new gnupg(); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$gpg->addencryptkey($fingerprint); +$gpg->addsignkey($fingerprint, $passphrase); +$enc = $gpg->encryptsign($plaintext); -$gpg = NULL; $plaintext = false; - $gpg = new gnupg(); -$gpg -> adddecryptkey($fingerprint, $passphrase); -$ret = $gpg -> decryptverify ($enc, $plaintext); +$gpg->adddecryptkey($fingerprint, $passphrase); +$ret = $gpg->decryptverify ($enc, $plaintext); var_dump($ret); var_dump($plaintext); @@ -38,3 +38,8 @@ array(1) { } } string(7) "foo bar" +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_export.phpt b/tests/gnupg_oo_export.phpt index d94117f..cf0630b 100644 --- a/tests/gnupg_oo_export.phpt +++ b/tests/gnupg_oo_export.phpt @@ -4,15 +4,16 @@ export a key --FILE-- seterrormode(gnupg::ERROR_WARNING); -$ret = $gpg -> export($fingerprint); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$ret = $gpg->export($fingerprint); var_dump($ret); ?> --EXPECTF-- string(%d) "-----BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 mQGiBENQAKwRBADpy828KU+0SuoetJTrJ5dR86PiO3CsH8K6QRP7wY82Eh/9NTJ3 afRj0FNPaVSP0NciPeM4G4uFoQ3lsIf+FBEPXH1D97/XigWObU8K6ha2/s8wU98z @@ -36,3 +37,8 @@ drhhPQJw1AY6GEpSbK0JtACeJuewK8C1wO1l5OYkGzFpb4VgquI= =twR+ -----END PGP PUBLIC KEY BLOCK----- " +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_0001_import.phpt b/tests/gnupg_oo_import.phpt similarity index 68% rename from tests/gnupg_oo_0001_import.phpt rename to tests/gnupg_oo_import.phpt index 2c866d0..66f0e03 100644 --- a/tests/gnupg_oo_0001_import.phpt +++ b/tests/gnupg_oo_import.phpt @@ -1,15 +1,15 @@ ---TEST--n +--TEST-- import a new key into the keyring --SKIPIF-- --FILE-- seterrormode(gnupg::ERROR_WARNING); -$ret = $gpg -> import($testkey); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$ret = $gpg->import($testkey); var_dump($ret); ?> --EXPECT-- @@ -33,3 +33,8 @@ array(9) { ["fingerprint"]=> string(40) "64DF06E42FCF2094590CDEEE2E96F141B3DD2B2E" } +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_keyinfo.phpt b/tests/gnupg_oo_keyinfo.phpt index 9beb553..79ad9c6 100644 --- a/tests/gnupg_oo_keyinfo.phpt +++ b/tests/gnupg_oo_keyinfo.phpt @@ -4,10 +4,12 @@ get keyinfo --FILE-- seterrormode(gnupg::ERROR_WARNING); -$ret = $gpg -> keyinfo($fingerprint); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$ret = $gpg->keyinfo($fingerprint); var_dump($ret); ?> --EXPECT-- @@ -99,3 +101,8 @@ array(1) { } } } +--CLEAN-- + diff --git a/tests/gnupg_oo_listsignatures.phpt b/tests/gnupg_oo_listsignatures.phpt index e8ea9ca..19db17b 100644 --- a/tests/gnupg_oo_listsignatures.phpt +++ b/tests/gnupg_oo_listsignatures.phpt @@ -1,13 +1,15 @@ ---TEST--n +--TEST-- list signatures --SKIPIF-- --FILE-- seterrormode(gnupg::ERROR_WARNING); -$ret = $gpg -> listsignatures($fingerprint); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$ret = $gpg->listsignatures($fingerprint); var_dump($ret); ?> --EXPECT-- @@ -35,3 +37,8 @@ array(1) { } } } +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_sign_clear.phpt b/tests/gnupg_oo_sign_clear.phpt index 2caefc9..40b3e84 100644 --- a/tests/gnupg_oo_sign_clear.phpt +++ b/tests/gnupg_oo_sign_clear.phpt @@ -4,18 +4,20 @@ sign a text with sigmode SIG_MODE_CLEAR --FILE-- seterrormode(gnupg::ERROR_WARNING); -$gpg -> setsignmode(gnupg::SIG_MODE_CLEAR); -$gpg -> addsignkey($fingerprint, $passphrase); -$ret = $gpg -> sign($plaintext); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$gpg->setsignmode(gnupg::SIG_MODE_CLEAR); +$gpg->addsignkey($fingerprint, $passphrase); +$ret = $gpg->sign($plaintext); $gpg = NULL; $gpg = new gnupg(); $tmp = false; -$ret = $gpg -> verify($ret, false, $tmp); +$ret = $gpg->verify($ret, false, $tmp); var_dump($ret); var_dump($tmp); @@ -38,3 +40,8 @@ array(1) { } string(8) "foo bar " +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_sign_detach.phpt b/tests/gnupg_oo_sign_detach.phpt index 79f81f2..feb9e30 100644 --- a/tests/gnupg_oo_sign_detach.phpt +++ b/tests/gnupg_oo_sign_detach.phpt @@ -4,18 +4,20 @@ sign a text with mode SIG_MODE_DETACH --FILE-- seterrormode(gnupg::ERROR_WARNING); -$gpg -> setsignmode(gnupg::SIG_MODE_DETACH); -$gpg -> addsignkey($fingerprint, $passphrase); -$ret = $gpg -> sign($plaintext); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$gpg->setsignmode(gnupg::SIG_MODE_DETACH); +$gpg->addsignkey($fingerprint, $passphrase); +$ret = $gpg->sign($plaintext); $gpg = NULL; $gpg = new gnupg(); $tmp = false; -$ret = $gpg -> verify($plaintext, $ret); +$ret = $gpg->verify($plaintext, $ret); var_dump($ret); var_dump($plaintext); @@ -37,3 +39,8 @@ array(1) { } } string(7) "foo bar" +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_sign_detach_nonarmor.phpt b/tests/gnupg_oo_sign_detach_nonarmor.phpt index 60f4e00..4642aaf 100644 --- a/tests/gnupg_oo_sign_detach_nonarmor.phpt +++ b/tests/gnupg_oo_sign_detach_nonarmor.phpt @@ -1,22 +1,24 @@ ---TEST--n +--TEST-- sign a text with mode SIG_MODE_DETACH and without armored output --SKIPIF-- --FILE-- seterrormode(gnupg::ERROR_WARNING); -$gpg -> setarmor(0); -$gpg -> setsignmode(gnupg::SIG_MODE_DETACH); -$gpg -> addsignkey($fingerprint, $passphrase); -$ret = $gpg -> sign($plaintext); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$gpg->setarmor(0); +$gpg->setsignmode(gnupg::SIG_MODE_DETACH); +$gpg->addsignkey($fingerprint, $passphrase); +$ret = $gpg->sign($plaintext); $gpg = NULL; $gpg = new gnupg(); $tmp = false; -$ret = $gpg -> verify($plaintext, $ret); +$ret = $gpg->verify($plaintext, $ret); var_dump($ret); var_dump($plaintext); @@ -38,3 +40,8 @@ array(1) { } } string(7) "foo bar" +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_sign_normal.phpt b/tests/gnupg_oo_sign_normal.phpt index 4faf400..58d0117 100644 --- a/tests/gnupg_oo_sign_normal.phpt +++ b/tests/gnupg_oo_sign_normal.phpt @@ -1,22 +1,24 @@ ---TEST--n +--TEST-- sign a text with mode SIG_MODE_NORMAL --SKIPIF-- --FILE-- seterrormode(gnupg::ERROR_WARNING); -$gpg -> setsignmode(gnupg::SIG_MODE_NORMAL); -$gpg -> addsignkey($fingerprint, $passphrase); -$ret = $gpg -> sign($plaintext); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$gpg->setsignmode(gnupg::SIG_MODE_NORMAL); +$gpg->addsignkey($fingerprint, $passphrase); +$ret = $gpg->sign($plaintext); $gpg = NULL; $gpg = new gnupg(); $tmp = false; $plaintext = false; -$ret = $gpg -> verify($ret, false, $plaintext); +$ret = $gpg->verify($ret, false, $plaintext); var_dump($ret); var_dump($plaintext); @@ -38,3 +40,8 @@ array(1) { } } string(7) "foo bar" +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_sign_normal_noarmor.phpt b/tests/gnupg_oo_sign_normal_noarmor.phpt index 0651ce8..ee42f47 100644 --- a/tests/gnupg_oo_sign_normal_noarmor.phpt +++ b/tests/gnupg_oo_sign_normal_noarmor.phpt @@ -1,23 +1,23 @@ ---TEST--n +--TEST-- sign a text with mode SIG_MODE_NORMAL and without armored output --SKIPIF-- --FILE-- seterrormode(gnupg::ERROR_WARNING); -$gpg -> setarmor(0); -$gpg -> setsignmode(gnupg::SIG_MODE_NORMAL); -$gpg -> addsignkey($fingerprint, $passphrase); -$ret = $gpg -> sign($plaintext); - -$gpg = NULL; +require_once "gnupgt.inc"; +gnupgt::import_key(); $gpg = new gnupg(); -//$ret = $gpg -> verify($plaintext, $ret); +$gpg->seterrormode(gnupg::ERROR_WARNING); +$gpg->setarmor(0); +$gpg->setsignmode(gnupg::SIG_MODE_NORMAL); +$gpg->addsignkey($fingerprint, $passphrase); +$ret = $gpg->sign($plaintext); + +$gpg = new gnupg(); +//$ret = $gpg->verify($plaintext, $ret); $plaintext = false; -$ret = $gpg -> verify($ret, false, $plaintext); +$ret = $gpg->verify($ret, false, $plaintext); var_dump($ret); var_dump($plaintext); @@ -39,3 +39,8 @@ array(1) { } } string(7) "foo bar" +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_oo_zzz_deletekey.phpt b/tests/gnupg_oo_zzz_deletekey.phpt deleted file mode 100644 index 46f6da0..0000000 --- a/tests/gnupg_oo_zzz_deletekey.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST--n -delete a key from the keyring ---SKIPIF-- - ---FILE-- - seterrormode(gnupg::ERROR_WARNING); -$ret = $gpg -> deletekey($fingerprint,true); -var_dump($ret); -?> ---EXPECT-- -bool(true) diff --git a/tests/gnupg_res_0001_import.phpt b/tests/gnupg_res_0001_import.phpt index 7eb5160..6c6e672 100644 --- a/tests/gnupg_res_0001_import.phpt +++ b/tests/gnupg_res_0001_import.phpt @@ -1,10 +1,12 @@ ---TEST--n +--TEST-- import a new key into the keyring +--SKIPIF-- + --FILE-- string(40) "64DF06E42FCF2094590CDEEE2E96F141B3DD2B2E" } +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_res_zzz_deletekey.phpt b/tests/gnupg_res_deletekey.phpt similarity index 53% rename from tests/gnupg_res_zzz_deletekey.phpt rename to tests/gnupg_res_deletekey.phpt index 460a2d0..0718809 100644 --- a/tests/gnupg_res_zzz_deletekey.phpt +++ b/tests/gnupg_res_deletekey.phpt @@ -1,8 +1,12 @@ --TEST--n delete a key from the keyring +--SKIPIF-- + --FILE-- --EXPECT-- bool(true) +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_res_encrypt.phpt b/tests/gnupg_res_encrypt.phpt index f8fc809..fe5b155 100644 --- a/tests/gnupg_res_encrypt.phpt +++ b/tests/gnupg_res_encrypt.phpt @@ -1,8 +1,12 @@ --TEST-- encrypt and decrypt a text +--SKIPIF-- + --FILE-- --EXPECTF-- string(7) "foo bar" +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_res_encryptsign.phpt b/tests/gnupg_res_encryptsign.phpt index 553c4d1..b6df88e 100644 --- a/tests/gnupg_res_encryptsign.phpt +++ b/tests/gnupg_res_encryptsign.phpt @@ -1,8 +1,12 @@ --TEST-- encryptsign and decryptverify a text +--SKIPIF-- + --FILE-- \ No newline at end of file diff --git a/tests/gnupg_res_export.phpt b/tests/gnupg_res_export.phpt index ddfe58e..1fb879a 100644 --- a/tests/gnupg_res_export.phpt +++ b/tests/gnupg_res_export.phpt @@ -1,8 +1,12 @@ --TEST-- export a key +--SKIPIF-- + --FILE-- --EXPECTF-- string(%d) "-----BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 mQGiBENQAKwRBADpy828KU+0SuoetJTrJ5dR86PiO3CsH8K6QRP7wY82Eh/9NTJ3 afRj0FNPaVSP0NciPeM4G4uFoQ3lsIf+FBEPXH1D97/XigWObU8K6ha2/s8wU98z @@ -34,3 +37,8 @@ drhhPQJw1AY6GEpSbK0JtACeJuewK8C1wO1l5OYkGzFpb4VgquI= =twR+ -----END PGP PUBLIC KEY BLOCK----- " +--CLEAN-- + \ No newline at end of file diff --git a/tests/gnupg_res_keyinfo.phpt b/tests/gnupg_res_keyinfo.phpt index 7decec3..5644f5f 100644 --- a/tests/gnupg_res_keyinfo.phpt +++ b/tests/gnupg_res_keyinfo.phpt @@ -1,8 +1,12 @@ --TEST--n get keyinfo +--SKIPIF-- + --FILE-- \ No newline at end of file diff --git a/tests/gnupg_res_listsignatures.phpt b/tests/gnupg_res_listsignatures.phpt index af11391..ee7b4ad 100644 --- a/tests/gnupg_res_listsignatures.phpt +++ b/tests/gnupg_res_listsignatures.phpt @@ -1,8 +1,12 @@ --TEST--n list signatures +--SKIPIF-- + --FILE-- \ No newline at end of file diff --git a/tests/gnupg_res_sign_clear.phpt b/tests/gnupg_res_sign_clear.phpt index 6314c36..19d02c8 100644 --- a/tests/gnupg_res_sign_clear.phpt +++ b/tests/gnupg_res_sign_clear.phpt @@ -1,16 +1,18 @@ --TEST--n sign a text with sigmode SIG_MODE_CLEAR +--SKIPIF-- + --FILE-- \ No newline at end of file diff --git a/tests/gnupg_res_sign_detach.phpt b/tests/gnupg_res_sign_detach.phpt index 6583ef7..8bf0a63 100644 --- a/tests/gnupg_res_sign_detach.phpt +++ b/tests/gnupg_res_sign_detach.phpt @@ -1,16 +1,18 @@ --TEST--n sign a text with mode SIG_MODE_DETACH +--SKIPIF-- + --FILE-- \ No newline at end of file diff --git a/tests/gnupg_res_sign_detach_nonarmor.phpt b/tests/gnupg_res_sign_detach_nonarmor.phpt index 0055a5a..19785e1 100644 --- a/tests/gnupg_res_sign_detach_nonarmor.phpt +++ b/tests/gnupg_res_sign_detach_nonarmor.phpt @@ -1,8 +1,12 @@ --TEST--n sign a text with mode SIG_MODE_DETACH and without armored output +--SKIPIF-- + --FILE-- \ No newline at end of file diff --git a/tests/gnupg_res_sign_normal.phpt b/tests/gnupg_res_sign_normal.phpt index 8333ff7..825cc0d 100644 --- a/tests/gnupg_res_sign_normal.phpt +++ b/tests/gnupg_res_sign_normal.phpt @@ -1,8 +1,12 @@ --TEST--n sign a text with mode SIG_MODE_NORMAL +--SKIPIF-- + --FILE-- \ No newline at end of file diff --git a/tests/gnupg_res_sign_normal_noarmor.phpt b/tests/gnupg_res_sign_normal_noarmor.phpt index 324eef8..8cee2a9 100644 --- a/tests/gnupg_res_sign_normal_noarmor.phpt +++ b/tests/gnupg_res_sign_normal_noarmor.phpt @@ -1,8 +1,12 @@ --TEST--n sign a text with mode SIG_MODE_NORMAL and without armored output +--SKIPIF-- + --FILE-- \ No newline at end of file diff --git a/tests/gnupgt.inc b/tests/gnupgt.inc new file mode 100644 index 0000000..7b3363f --- /dev/null +++ b/tests/gnupgt.inc @@ -0,0 +1,21 @@ +import($testkey); + } + + static function delete_key() + { + @unlink(__DIR__ . "/pubring.gpg"); + @unlink(__DIR__ . "/secring.gpg"); + } +} \ No newline at end of file From 4d61cf07c34ab3b7b74f5ac66c636cd6f1d223d1 Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Thu, 17 May 2018 20:15:28 +0100 Subject: [PATCH 7/7] Fix typo in UPGRADING --- UPGRADING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING b/UPGRADING index 9f09c78..f60cfe3 100644 --- a/UPGRADING +++ b/UPGRADING @@ -3,7 +3,7 @@ PHP GNUPG UPGRADING NOTES This document lists backward incompatible change in the extension 1.4.0 -- gnupg_decryptverify $plaintext reference cannot be longer passed in +- gnupg_decryptverify $plaintext reference can no longer be passed in call_user_func_array which is conformant to user space code. See https://github.com/php-gnupg/php-gnupg/issues/4 for more details.