diff options
-rw-r--r-- | PHPINFO | 2 | ||||
-rw-r--r-- | REFLECTION | 2 | ||||
-rw-r--r-- | gnupg-build.patch | 73 | ||||
-rw-r--r-- | gnupgt.inc | 211 | ||||
-rw-r--r-- | php-pecl-gnupg.spec | 13 | ||||
-rw-r--r-- | vars.inc | 69 |
6 files changed, 7 insertions, 363 deletions
@@ -3,4 +3,4 @@ gnupg gnupg support => enabled GPGme Version => 1.14.0 -Extension Version => 1.5.0RC1 +Extension Version => 1.5.0RC2 @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #120 gnupg version 1.5.0RC1 ] { +Extension [ <persistent> extension #119 gnupg version 1.5.0RC2 ] { - Constants [36] { Constant [ int GNUPG_SIG_MODE_NORMAL ] { 0 } diff --git a/gnupg-build.patch b/gnupg-build.patch deleted file mode 100644 index cedea9f..0000000 --- a/gnupg-build.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 618e7ffc698f948dfe4feef38258e42a7c24130e Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Mon, 15 Feb 2021 08:04:31 +0100 -Subject: [PATCH] fix build with libgpgme 1.3 - ---- - gnupg.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - -diff --git a/gnupg.c b/gnupg.c -index 3ec2f07..67e8c7f 100644 ---- a/gnupg.c -+++ b/gnupg.c -@@ -170,7 +170,9 @@ static void php_gnupg_this_make(PHPC_THIS_DECLARE(gnupg), zval *options TSRMLS_D - ctx, GPGME_PROTOCOL_OpenPGP, file_name, home_dir); - } - gpgme_set_armor(ctx, 1); -+#if GPGME_VERSION_NUMBER >= 0x010400 /* GPGME >= 1.4.0 */ - gpgme_set_pinentry_mode(ctx, GPGME_PINENTRY_MODE_LOOPBACK); -+#endif - } - } - /* }}} */ -@@ -591,10 +593,8 @@ PHP_MINIT_FUNCTION(gnupg) - #if GPGME_VERSION_NUMBER >= 0x010500 /* GPGME >= 1.5.0 */ - PHP_GNUPG_SET_CLASS_CONST("PK_ECC", GPGME_PK_ECC); - #endif /* gpgme >= 1.5.0 */ --#if GPGME_VERSION_NUMBER >= 0x010300 /* GPGME >= 1.3.0 */ - PHP_GNUPG_SET_CLASS_CONST("PK_ECDSA", GPGME_PK_ECDSA); - PHP_GNUPG_SET_CLASS_CONST("PK_ECDH", GPGME_PK_ECDH); --#endif /* gpgme >= 1.3.0 */ - #if GPGME_VERSION_NUMBER >= 0x010700 /* GPGME >= 1.7.0 */ - PHP_GNUPG_SET_CLASS_CONST("PK_EDDSA", GPGME_PK_EDDSA); - #endif /* gpgme >= 1.7.0 */ -@@ -633,10 +633,8 @@ PHP_MINIT_FUNCTION(gnupg) - #if GPGME_VERSION_NUMBER >= 0x010500 /* GPGME >= 1.5.0 */ - PHP_GNUPG_REG_CONST("GNUPG_PK_ECC", GPGME_PK_ECC); - #endif /* gpgme >= 1.5.0 */ --#if GPGME_VERSION_NUMBER >= 0x010300 /* GPGME >= 1.3.0 */ - PHP_GNUPG_REG_CONST("GNUPG_PK_ECDSA", GPGME_PK_ECDSA); - PHP_GNUPG_REG_CONST("GNUPG_PK_ECDH", GPGME_PK_ECDH); --#endif /* gpgme >= 1.3.0 */ - #if GPGME_VERSION_NUMBER >= 0x010700 /* GPGME >= 1.7.0 */ - PHP_GNUPG_REG_CONST("GNUPG_PK_EDDSA", GPGME_PK_EDDSA); - #endif /* gpgme >= 1.7.0 */ -@@ -1099,9 +1097,7 @@ PHP_FUNCTION(gnupg_keyinfo) - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, revoked, gpgme_subkey); - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, can_certify, gpgme_subkey); - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, can_authenticate, gpgme_subkey); --#if GPGME_VERSION_NUMBER >= 0x010100 /* GPGME >= 1.1.0 */ - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, is_qualified, gpgme_subkey); --#endif /* gpgme >= 1.1.0 */ - #if GPGME_VERSION_NUMBER >= 0x010900 /* GPGME >= 1.9.0 */ - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, is_de_vs, gpgme_subkey); - #endif /* gpgme >= 1.9.0 */ -@@ -1117,15 +1113,15 @@ PHP_FUNCTION(gnupg_keyinfo) - PHP_GNUPG_ARRAY_ADD_ASSOC_CSTR(subkey, keygrip, gpgme_subkey); - } - #endif /* gpgme >= 1.7.0 */ --#if GPGME_VERSION_NUMBER >= 0x010200 /* GPGME >= 1.2.0 */ - PHP_GNUPG_ARRAY_ADD_ASSOC_BOOL(subkey, is_cardkey, gpgme_subkey); - if (gpgme_subkey->card_number) { - PHP_GNUPG_ARRAY_ADD_ASSOC_CSTR(subkey, card_number, gpgme_subkey); - } --#endif /* gpgme >= 1.2.0 */ -+#if GPGME_VERSION_NUMBER >= 0x010403 /* GPGME >= 1.4.3 */ - if (gpgme_subkey->curve) { - PHP_GNUPG_ARRAY_ADD_ASSOC_CSTR(subkey, curve, gpgme_subkey); - } -+#endif - - PHPC_ARRAY_ADD_NEXT_INDEX_ZVAL( - PHPC_VAL_CAST_TO_PZVAL(subkeys), diff --git a/gnupgt.inc b/gnupgt.inc deleted file mode 100644 index c31415d..0000000 --- a/gnupgt.inc +++ /dev/null @@ -1,211 +0,0 @@ -<?php - -require_once __DIR__ . "/vars.inc"; - -class gnupgt { - /** - * Import all keys - */ - static public function import_key() - { - global $testkey; - - self::reset_key(); - - $gpg = new gnupg(); - $gpg->import($testkey); - } - - /** - * Delete all keys. - * @param null|string $homeDir - */ - static public function delete_key($homeDir = null) - { - if (is_null($homeDir)) { - $homeDir = self::get_home_dir(); - } - if (!is_dir($homeDir)) { - return; - } - foreach (glob($homeDir . '/*') as $filename) { - if (!is_dir($filename)) { - unlink($filename); - } - } - $privKeyDir = self::get_priv_key_dir($homeDir); - if (is_dir($privKeyDir)) { - foreach (glob($privKeyDir . '/*') as $key) { - unlink($key); - } - rmdir($privKeyDir); - } - rmdir($homeDir); - } - - /** - * Initialize key directory. - */ - static public function init_key_dir() - { - mkdir(self::get_home_dir()); - mkdir(self::get_priv_key_dir(), 0700); - } - - /** - * Reset all keys. - */ - static public function reset_key() - { - self::delete_key(); - self::init_key_dir(); - } - - /** - * Get home directory. - * - * @return string - */ - static private function get_home_dir() - { - return __DIR__ . '/home'; - } - - /** - * Get private key directory (for GPG2). - * @param null|string $homeDir - * @return string - */ - static private function get_priv_key_dir($homeDir = null) - { - if (is_null($homeDir)) { - $homeDir = self::get_home_dir(); - } - return $homeDir . '/private-keys-v1.d'; - } - - /** - * Print error message and return false. - * - * @param string $msg - * @return bool - */ - static private function error($msg) - { - echo "ERROR: " . $msg; - return false; - } - - /** - * Check single array value. - * - * @param mixed $expected - * @param array $a - * @param string $key1 - * @return bool - */ - static public function check_array($expected, $a, $key1) - { - $args = func_get_args(); - $keys = array_splice($args, 2); - $value = $a; - foreach ($keys as $key) { - if (!isset($value[$key])) { - return self::error("key $key not found in the array"); - } - $value = $value[$key]; - } - if ($value !== $expected) { - - return self::error( - sprintf( - "key %s value %s does not match expected %s\n", - $key, - var_export($value, true), - var_export($expected, true) - ) - ); - } - - return true; - } - - /** - * Check single array value but only for GpgME version higher than supplied. - * - * @param mixed $expected - * @param array $a - * @param string $key1 - * @return bool - */ - static public function check_array_from_version($version, $expected, $a, $key1) - { - if (version_compare(GNUPG_GPGME_VERSION, $version) < 0) { - return true; - } - - $args = func_get_args(); - return call_user_func_array('gnupgt::check_array', array_splice($args, 1)); - } - - /** - * Check keyinfo for var key - * - * @param $ret - * @param $secret_only - */ - static public function check_keyinfo($ret, $secret_only) { - self::check_array(false, $ret, 0, 'disabled'); - self::check_array(false, $ret, 0, 'expired'); - self::check_array(false, $ret, 0, 'revoked'); - self::check_array($secret_only, $ret, 0, 'is_secret'); - self::check_array(true, $ret, 0, 'can_sign'); - self::check_array(true, $ret, 0, 'can_encrypt'); - // uid - self::check_array('PHP GnuPG', $ret, 0, 'uids', 0, 'name'); - self::check_array('', $ret, 0, 'uids', 0, 'comment'); - self::check_array('gnupg@php.net', $ret, 0, 'uids', 0, 'email'); - self::check_array('PHP GnuPG <gnupg@php.net>', $ret, 0, 'uids', 0, 'uid'); - self::check_array(false, $ret, 0, 'uids', 0, 'revoked'); - self::check_array(false, $ret, 0, 'uids', 0, 'invalid'); - self::check_array(false, $ret, 0, 'uids', 0, 'invalid'); - // subkey 1 - self::check_array("2DF0DD02DC9B70B7F64F572E669E775E0A6284B3", $ret, 0, 'subkeys', 0, 'fingerprint'); - self::check_array("669E775E0A6284B3", $ret, 0, 'subkeys', 0, 'keyid'); - self::check_array(1567958444, $ret, 0, 'subkeys', 0, 'timestamp'); - self::check_array(0, $ret, 0, 'subkeys', 0, 'expires'); - self::check_array($secret_only, $ret, 0, 'subkeys', 0, 'is_secret'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'can_encrypt'); - self::check_array(true, $ret, 0, 'subkeys', 0, 'can_sign'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'disabled'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'expired'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'revoked'); - self::check_array(true, $ret, 0, 'subkeys', 0, 'can_certify'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'can_authenticate'); - self::check_array(false, $ret, 0, 'subkeys', 0, 'is_qualified'); - // TODO: The is_de_vs seems to differ between gpg2 (true) and gpg1 (false) - differenatiate the test - //self::check_array_from_version('1.9.0', true, $ret, 0, 'subkeys', 0, 'is_de_vs'); - self::check_array(GNUPG_PK_RSA, $ret, 0, 'subkeys', 0, 'pubkey_algo'); - self::check_array(2048, $ret, 0, 'subkeys', 0, 'length'); - self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 0, 'is_cardkey'); - // subkey 2 - self::check_array("9E84AE800874DFF647B6062B46DCA9B3662C7DFC", $ret, 0, 'subkeys', 1, 'fingerprint'); - self::check_array("46DCA9B3662C7DFC", $ret, 0, 'subkeys', 1, 'keyid'); - self::check_array(1567958444, $ret, 0, 'subkeys', 1, 'timestamp'); - self::check_array(0, $ret, 0, 'subkeys', 1, 'expires'); - self::check_array($secret_only, $ret, 0, 'subkeys', 1, 'is_secret'); - self::check_array(true, $ret, 0, 'subkeys', 1, 'can_encrypt'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'can_sign'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'disabled'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'expired'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'revoked'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'can_certify'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'can_authenticate'); - self::check_array(false, $ret, 0, 'subkeys', 1, 'is_qualified'); - // TODO: The is_de_vs seems to differ between gpg2 (true) and gpg1 (false) - differenatiate the test - // self::check_array_from_version('1.9.0', true, $ret, 0, 'subkeys', 1, 'is_de_vs'); - self::check_array(GNUPG_PK_RSA, $ret, 0, 'subkeys', 1, 'pubkey_algo'); - self::check_array(2048, $ret, 0, 'subkeys', 1, 'length'); - self::check_array_from_version('1.7.0', false, $ret, 0, 'subkeys', 1, 'is_cardkey'); - } -} diff --git a/php-pecl-gnupg.spec b/php-pecl-gnupg.spec index f3624ea..428b201 100644 --- a/php-pecl-gnupg.spec +++ b/php-pecl-gnupg.spec @@ -20,7 +20,7 @@ %global ini_name 40-%{pecl_name}.ini %endif %global upstream_version 1.5.0 -%global upstream_prever RC1 +%global upstream_prever RC2 Summary: Wrapper around the gpgme library Name: %{?sub_prefix}php-pecl-gnupg @@ -31,10 +31,6 @@ License: BSD URL: https://pecl.php.net/package/gnupg Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz -Source1: https://raw.githubusercontent.com/php-gnupg/php-gnupg/master/tests/gnupgt.inc -Source2: https://raw.githubusercontent.com/php-gnupg/php-gnupg/master/tests/vars.inc -Patch0: gnupg-build.patch - BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel @@ -103,9 +99,6 @@ EOF mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS cd NTS -cp %{SOURCE1} %{SOURCE2} tests/ -%patch0 -p1 - # Check extension version extver=$(sed -n '/#define PHP_GNUPG_VERSION/{s/.* "//;s/".*$//;p}' php_gnupg.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then @@ -242,6 +235,10 @@ cd ../ZTS %changelog +* Mon Mar 8 2021 Remi Collet <remi@remirepo.net> - 1.5.0~RC2-1 +- Update to 1.5.0RC2 +- drop patch merged upstream + * Mon Feb 15 2021 Remi Collet <remi@remirepo.net> - 1.5.0~RC1-1 - Update to 1.5.0RC1 - open https://github.com/php-gnupg/php-gnupg/pull/25 diff --git a/vars.inc b/vars.inc deleted file mode 100644 index 02d2819..0000000 --- a/vars.inc +++ /dev/null @@ -1,69 +0,0 @@ -<?php -putenv("GNUPGHOME=".dirname(__FILE__) . '/home'); -error_reporting (E_ALL); -$fingerprint = "2DF0DD02DC9B70B7F64F572E669E775E0A6284B3"; -$passphrase = "blabla"; - -$plaintext = "foo bar"; - -$testkey =<<<EOF ------BEGIN PGP PRIVATE KEY BLOCK----- - -lQPGBF11JawBCAC6bWTtKtAj1dBih/UHR9iH1iADEmZde52aKyd7EXKtjs4Q2aXJ -kbn9R+kcJNx+AlnTSePQBkNz5brmEAQgk93rOsHaPUEROkfBR2C6AkjaJNnk0E43 -pbUy6bWhmGR4kmpbvRnR/7kxVyplb5zSFAcio1I8RQ3ql0HkF//zLUouYzrMJn6e -GvffHw1revlSxo0leCcOsNE7AHGVgMxvUWYO0JT4Fs+JcpsTxG8MFE6I6SLZoY5W -XmtOsO0vMNJoTaXdqfJoLTkviPkRUZuF0DtzuT1oQLUTTaKvWxx2+33YF5HYrlNy -eepLFLh5mZ1/2HFWoQo2X1gFfb1R9EJPbFtJABEBAAH+BwMCTBMnieCYP1Fg2yqq -wz42qlU7CjG2ES8+y4AgKMn4P9tB/FUUjzHHgkZRYk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