From 27330f78b37ef153079df3fe0cee9610d49b16ad Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 19 Jan 2011 23:10:30 -0700 Subject: [PATCH] Converted horde/Crypt package to PHPUnit --- framework/Crypt/lib/Horde/Crypt.php | 9 +- framework/Crypt/package.xml | 59 +-- framework/Crypt/test/Horde/Crypt/AllTests.php | 38 ++ framework/Crypt/test/Horde/Crypt/Autoload.php | 28 ++ framework/Crypt/test/Horde/Crypt/PgpTest.php | 515 +++++++++++++++++++++ framework/Crypt/test/Horde/Crypt/SmimeTest.php | 35 ++ framework/Crypt/test/Horde/Crypt/bug_6601.phpt | 25 - framework/Crypt/test/Horde/Crypt/pgp.inc | 23 - framework/Crypt/test/Horde/Crypt/pgp_decrypt.phpt | 37 -- .../test/Horde/Crypt/pgp_decrypt_symmetric.phpt | 35 -- framework/Crypt/test/Horde/Crypt/pgp_encrypt.phpt | 31 -- .../test/Horde/Crypt/pgp_encrypt_symmetric.phpt | 26 -- .../Horde/Crypt/pgp_encryptedSymmetrically.phpt | 15 - .../test/Horde/Crypt/pgp_generateRevocation.phpt | 20 - .../test/Horde/Crypt/pgp_getSignersKeyID.phpt | 13 - .../Crypt/test/Horde/Crypt/pgp_parsePGPData.phpt | 89 ---- .../test/Horde/Crypt/pgp_pgpPacketInformation.phpt | 133 ------ .../test/Horde/Crypt/pgp_pgpPacketSignature.phpt | 82 ---- .../Crypt/pgp_pgpPacketSignatureByUidIndex.phpt | 82 ---- .../Crypt/test/Horde/Crypt/pgp_pgpPrettyKey.phpt | 34 -- .../test/Horde/Crypt/pgp_publicKeyMIMEPart.phpt | 53 --- framework/Crypt/test/Horde/Crypt/pgp_sign.phpt | 55 --- framework/Crypt/test/Horde/Crypt/pgp_skipif.inc | 9 - framework/Crypt/test/Horde/Crypt/pgp_verify.phpt | 32 -- .../test/Horde/Crypt/pgp_verifyPassphrase.phpt | 16 - framework/Crypt/test/Horde/Crypt/smime.inc | 12 - framework/Crypt/test/Horde/Crypt/smime_skipif.inc | 9 - .../test/Horde/Crypt/smime_subjectAltName.phpt | 17 - 28 files changed, 633 insertions(+), 899 deletions(-) create mode 100644 framework/Crypt/test/Horde/Crypt/AllTests.php create mode 100644 framework/Crypt/test/Horde/Crypt/Autoload.php create mode 100644 framework/Crypt/test/Horde/Crypt/PgpTest.php create mode 100644 framework/Crypt/test/Horde/Crypt/SmimeTest.php delete mode 100644 framework/Crypt/test/Horde/Crypt/bug_6601.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp.inc delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_decrypt.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_decrypt_symmetric.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_encrypt.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_encrypt_symmetric.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_encryptedSymmetrically.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_generateRevocation.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_getSignersKeyID.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_parsePGPData.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_pgpPacketInformation.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_pgpPacketSignature.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_pgpPacketSignatureByUidIndex.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_pgpPrettyKey.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_publicKeyMIMEPart.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_sign.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_skipif.inc delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_verify.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/pgp_verifyPassphrase.phpt delete mode 100644 framework/Crypt/test/Horde/Crypt/smime.inc delete mode 100644 framework/Crypt/test/Horde/Crypt/smime_skipif.inc delete mode 100644 framework/Crypt/test/Horde/Crypt/smime_subjectAltName.phpt diff --git a/framework/Crypt/lib/Horde/Crypt.php b/framework/Crypt/lib/Horde/Crypt.php index eff67108c..0864f8d98 100644 --- a/framework/Crypt/lib/Horde/Crypt.php +++ b/framework/Crypt/lib/Horde/Crypt.php @@ -66,10 +66,11 @@ class Horde_Crypt * Constructor. * * @param array $params Configuration parameters: - * - 'email_charset': (string) The default email - * charset. DEFAULT: NONE - * - 'temp': (string) [REQUIRED] Location of - * temporary directory. + *
+     * email_charset - (string) The default email charset.
+     *                 DEFAULT: NONE
+     * temp - (string) [REQUIRED] Location of temporary directory.
+     * 
* * @throws InvalidArgumentException */ diff --git a/framework/Crypt/package.xml b/framework/Crypt/package.xml index 9956df661..a7bc04d45 100644 --- a/framework/Crypt/package.xml +++ b/framework/Crypt/package.xml @@ -10,8 +10,8 @@ slusarz@horde.org yes - 2010-10-22 - + 2011-01-19 + 0.1.0 0.1.0 @@ -36,6 +36,7 @@ + @@ -317,28 +318,10 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -468,28 +451,10 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -544,7 +509,7 @@ Initial release as a PEAR package alpha alpha - 2010-10-22 + 2011-01-19 LGPL * Add Horde_Crypt_Exception::. diff --git a/framework/Crypt/test/Horde/Crypt/AllTests.php b/framework/Crypt/test/Horde/Crypt/AllTests.php new file mode 100644 index 000000000..eae3a4d8e --- /dev/null +++ b/framework/Crypt/test/Horde/Crypt/AllTests.php @@ -0,0 +1,38 @@ + + * @category Horde + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Crypt + * @package Crypt + * @subpackage UnitTests + */ + +/** + * Define the main method + */ +if (!defined('PHPUnit_MAIN_METHOD')) { + define('PHPUnit_MAIN_METHOD', 'Horde_Crypt_AllTests::main'); +} + +/** + * Prepare the test setup. + */ +require_once 'Horde/Test/AllTests.php'; + +/** + * @category Horde + * @package Crypt + * @subpackage UnitTests + */ +class Horde_Crypt_AllTests extends Horde_Test_AllTests +{ +} + +Horde_Crypt_AllTests::init('Horde_Crypt', __FILE__); + +if (PHPUnit_MAIN_METHOD == 'Horde_Crypt_AllTests::main') { + Horde_Crypt_AllTests::main(); +} diff --git a/framework/Crypt/test/Horde/Crypt/Autoload.php b/framework/Crypt/test/Horde/Crypt/Autoload.php new file mode 100644 index 000000000..dde7da5ac --- /dev/null +++ b/framework/Crypt/test/Horde/Crypt/Autoload.php @@ -0,0 +1,28 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Crypt + */ + +if (!spl_autoload_functions()) { + spl_autoload_register( + create_function( + '$class', + '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class);' + . '$err_mask = E_ALL ^ E_WARNING;' + . '$oldErrorReporting = error_reporting($err_mask);' + . 'include "$filename.php";' + . 'error_reporting($oldErrorReporting);' + ) + ); +} + +/** Catch strict standards */ +error_reporting(E_ALL | E_STRICT); diff --git a/framework/Crypt/test/Horde/Crypt/PgpTest.php b/framework/Crypt/test/Horde/Crypt/PgpTest.php new file mode 100644 index 000000000..1736a01cc --- /dev/null +++ b/framework/Crypt/test/Horde/Crypt/PgpTest.php @@ -0,0 +1,515 @@ + + * @category Horde + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @package Crypt + * @subpackage UnitTests + */ + +class Horde_Crypt_PgpTest extends PHPUnit_Framework_TestCase +{ + protected $_pgp; + protected $_privkey; + protected $_pubkey; + + protected function setUp() + { + if (!is_executable('/usr/bin/gpg')) { + $this->markTestSkipped('GPG binary not found at /usr/bin/gpg.'); + } + + $this->_pgp = Horde_Crypt::factory('Pgp', array( + 'program' => '/usr/bin/gpg', + 'temp' => Horde_Util::getTempDir() + )); + + $this->_privkey = file_get_contents(dirname(__FILE__) . '/fixtures/pgp_private.asc'); + $this->_pubkey = file_get_contents(dirname(__FILE__) . '/fixtures/pgp_public.asc'); + } + + public function testBug6601() + { + @date_default_timezone_set('GMT'); + + $data = file_get_contents(dirname(__FILE__) . '/fixtures/bug_6601.asc'); + + $this->assertEquals( +'Name: Richard Selsky +Key Type: Public Key +Key Creation: 04/11/08 +Expiration Date: [Never] +Key Length: 1024 Bytes +Comment: [None] +E-Mail: rselsky@bu.edu +Hash-Algorithm: pgp-sha1 +Key ID: 0xF3C01D42 +Key Fingerprint: 5912 D91D 4C79 C670 1FFF 1486 04A6 7B37 F3C0 1D42 + +', + $this->_pgp->pgpPrettyKey($data) + ); + } + + // decrypt() message + public function testPgpDecrypt() + { + // Encrypted data is in ISO-8859-1 format + $crypt = file_get_contents(dirname(__FILE__) . '/fixtures/pgp_encrypted.txt'); + + $decrypt = $this->_pgp->decrypt($crypt, array( + 'passphrase' => 'Secret', + 'privkey' => $this->_privkey, + 'pubkey' => $this->_pubkey, + 'type' => 'message' + )); + + $this->assertEquals( +'0123456789012345678901234567890123456789 +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +0123456789012345678901234567890123456789 +!"$§%&()=?^´°`+#-.,*\'_:;<>|~\{[]} + +', + Horde_String::convertCharset($decrypt->message, 'ISO-8859-1', 'UTF-8') + ); + } + + public function testPgpDecryptSymmetric() + { + // Encrypted data is in ISO-8859-1 format + $crypt = file_get_contents(dirname(__FILE__) . '/fixtures/pgp_encrypted_symmetric.txt'); + + $decrypt = $this->_pgp->decrypt($crypt, array( + 'passphrase' => 'Secret', + 'type' => 'message' + )); + + $this->assertEquals( +'0123456789012345678901234567890123456789 +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +0123456789012345678901234567890123456789 +!"$§%&()=?^´°`+#-.,*\'_:;<>|~\{[]} +', + Horde_String::convertCharset($decrypt->message, 'ISO-8859-1', 'UTF-8') + ); + } + + public function testPgpEncrypt() + { + $clear = file_get_contents(dirname(__FILE__) . '/fixtures/clear.txt'); + + $out = $this->_pgp->encrypt($clear, array( + 'recips' => array('me@example.com' => $this->_pubkey), + 'type' => 'message' + )); + + $this->assertStringMatchesFormat( +'-----BEGIN PGP MESSAGE----- +Version: GnuPG v%d.%d.%d (%s) + +%s +%s +%s +%s +%s +%s +%s +%s +%s +%s +=%s +-----END PGP MESSAGE-----', + $out + ); + } + + public function testPgpEncryptSymmetric() + { + $clear = file_get_contents(dirname(__FILE__) . '/fixtures/clear.txt'); + + $out = $this->_pgp->encrypt($clear, array( + 'passphrase' => 'Secret', + 'symmetric' => true, + 'type' => 'message' + )); + + $this->assertStringMatchesFormat( +'-----BEGIN PGP MESSAGE----- +Version: GnuPG v%d.%d.%d (%s) + +%s +%s +%s +%s +=%s +-----END PGP MESSAGE-----', + $out + ); + } + + public function testPgpEncryptedSymmetrically() + { + $this->assertFalse( + $this->_pgp->encryptedSymmetrically(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_encrypted.txt')) + ); + $this->assertTrue( + $this->_pgp->encryptedSymmetrically(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_encrypted_symmetric.txt')) + ); + } + + public function testGenerateRevocation() + { + $this->assertStringMatchesFormat( +'-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v%d.%d.%d (%s) +Comment: A revocation certificate should follow + +%s +%s +=%s +-----END PGP PUBLIC KEY BLOCK-----', + $this->_pgp->generateRevocation( + $this->_privkey, + 'me@example.com', + 'Secret' + ) + ); + } + + public function testGetSignersKeyID() + { + $this->assertEquals( + 'BADEABD7', + $this->_pgp->getSignersKeyID(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signed.txt')) + ); + } + + public function testParsePGPData() + { + $out = $this->_pgp->parsePGPData(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signed.txt')); + + $this->assertEquals( + 2, + count($out) + ); + + $this->assertEquals( + Horde_Crypt_Pgp::ARMOR_SIGNED_MESSAGE, + $out[0]['type'] + ); + $this->assertEquals( + 17, + count($out[0]['data']) + ); + + $this->assertEquals( + Horde_Crypt_Pgp::ARMOR_SIGNATURE, + $out[1]['type'] + ); + $this->assertEquals( + 7, + count($out[1]['data']) + ); + } + + + public function testPgpPacketInformation() + { + $out = $this->_pgp->pgpPacketInformation($this->_pubkey); + + $this->assertArrayHasKey( + 'public_key', + $out + ); + $this->assertArrayNotHasKey( + 'secret_key', + $out + ); + $this->assertEquals( + '1155291888', + $out['public_key']['created'] + ); + $this->assertEquals( + 2, + count($out['signature']) + ); + $this->assertEquals( + '7CA74426BADEABD7', + $out['keyid'] + ); + + $out = $this->_pgp->pgpPacketInformation($this->_privkey); + + $this->assertArrayHasKey( + 'secret_key', + $out + ); + $this->assertArrayNotHasKey( + 'public_key', + $out + ); + $this->assertEquals( + '1155291888', + $out['secret_key']['created'] + ); + $this->assertEquals( + 2, + count($out['signature']) + ); + $this->assertEquals( + '7CA74426BADEABD7', + $out['keyid'] + ); + } + + public function testPgpPacketSignature() + { + $out = $this->_pgp->pgpPacketSignature($this->_pubkey, 'me@example.com'); + + $this->assertEquals( + '7CA74426BADEABD7', + $out['keyid'] + ); + + $out = $this->_pgp->pgpPacketSignature($this->_privkey, 'me@example.com'); + + $this->assertEquals( + '7CA74426BADEABD7', + $out['keyid'] + ); + + $out = $this->_pgp->pgpPacketSignature($this->_privkey, 'foo@example.com'); + + $this->assertArrayNotHasKey( + 'keyid', + $out + ); + } + + public function testPgpPacketSignatureByUidIndex() + { + $out = $this->_pgp->pgpPacketSignatureByUidIndex($this->_pubkey, 'id1'); + + $this->assertEquals( + '7CA74426BADEABD7', + $out['keyid'] + ); + + $out = $this->_pgp->pgpPacketSignatureByUidIndex($this->_privkey, 'id1'); + + $this->assertEquals( + '7CA74426BADEABD7', + $out['keyid'] + ); + + $out = $this->_pgp->pgpPacketSignatureByUidIndex($this->_privkey, 'id2'); + + $this->assertArrayNotHasKey( + 'keyid', + $out + ); + } + + public function testPgpPrettyKey() + { + $this->assertEquals( +'Name: My Name +Key Type: Public Key +Key Creation: 08/11/06 +Expiration Date: [Never] +Key Length: 1024 Bytes +Comment: My Comment +E-Mail: me@example.com +Hash-Algorithm: pgp-sha1 +Key ID: 0xBADEABD7 +Key Fingerprint: 966F 4BA9 569D E6F6 5E82 5397 7CA7 4426 BADE ABD7 + +', + $this->_pgp->pgpPrettyKey($this->_pubkey) + ); + + $this->assertEquals( +'Name: My Name +Key Type: Private Key +Key Creation: 08/11/06 +Expiration Date: [Never] +Key Length: 1024 Bytes +Comment: My Comment +E-Mail: me@example.com +Hash-Algorithm: pgp-sha1 +Key ID: 0xBADEABD7 +Key Fingerprint: 966F 4BA9 569D E6F6 5E82 5397 7CA7 4426 BADE ABD7 + +', + $this->_pgp->pgpPrettyKey($this->_privkey) + ); + } + + public function pgpPublicKeyMIMEPart() + { + $mime_part = $this->_pgp->publicKeyMIMEPart($this->_pubkey); + + $this->assertEquals( + 'application/pgp-keys', + $mime_part->getType() + ); + + $this->assertEquals( +'-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v%d.%d.%d (GNU/Linux) + +mQGiBETcWvARBADNitbvsWy5/hhV+WcU2ttmtXkAj2DqJVgJdGS2RH8msO0roG5j +CQK/e0iMJki5lfdgxvxxWgStYMnfF5ftgWA7JV+BZUzJt12Lobm0zdENv2TqL2vc +xlPTmEGsvfPDTbY+Gr3jvuODboXat7bUn2E723WXPdh2A7KNNnLou7JF2wCgiKs/ +RqNKM/Zm01PxLbQ+rs9ghd0D/jLUfJeYWySoDsvfO8e4UyDxDVTBLkkdw3XzLx1F +4SS/Cc2Z9yJuXiepzSH/G/vhdN5ROv12kJwA4FbwsFv5C1uCQleWiPngFixca9Nw +lAd2X2Cp0/4D2XRq1M9dEbcYdrgAuyzt2ZToj3aFaYNGwjfHoLqSngOu6/d3KD1d +i0b2A/9wnXo41kPwS73gU1Un2KKMkKqnczCQHdpopO6NjKaLhNcouRauLrgbrS5y +A1CW+nxjkKVvWrP/VFBmapUpjE1C51J9P0/ub8tRr7H0xHdTQyufv01lmfkjUpVF +n3GVf95l4seBFzD7r580aTx+dJztoHEGWrsWZTNJwo6IIlFOIbQlTXkgTmFtZSAo +TXkgQ29tbWVudCkgPG1lQGV4YW1wbGUuY29tPohgBBMRAgAgBQJE3FrwAhsjBgsJ +CAcDAgQVAggDBBYCAwECHgECF4AACgkQfKdEJrreq9fivACeLBcWErSQU4ZGQsje +dhwfdst9cLQAnRETpwmqt/XvcGFVsOE28MUrUzOGuQENBETcWvAQBADNgIJ4nDlf +gBOI/iqyNy08C9+MjxrqMylrj4TPn3rRk8wySr2myX+j9CML5EHOtsxANYeI9u7h +OF11n5Z8fDht/WGJrNR7EtRhNN6mkKsPaEuO3fhz6EgwJYReUVzDJbvnV2fRCvQo +EGaSntZGQaQzIzIL+/gMEFpEVRK1P2I3VwADBQP+K2Rmmkm3DonXFlUUDWWdhEF4 +b7fy5/IPj41PSSOdo0IP4dprFoe15Vs9gWOYvzcnjy+BbOwhVwsjE3F36hf04od3 +uTSM0dLS/xmpSvgbBh181T5c3W5aKT/daVhyxXJ4csxE+JCVKbaBubne0DPEuyZj +rYlL5Lm0z3VhNCcR0LyISQQYEQIACQUCRNxa8AIbDAAKCRB8p0Qmut6r16Y3AJ9h +umO5uT5yDcir3zwqUAxzBAkE4ACcCtGfb6usaTKnNXo+ZuLoHiOwIE4= +=GCjU +-----END PGP PUBLIC KEY BLOCK-----', + $mime_part->getContents() + ); + } + + public function testPgpSign() + { + $clear = file_get_contents(dirname(__FILE__) . '/fixtures/clear.txt'); + + $out = $this->_pgp->encrypt($clear, array( + 'passphrase' => 'Secret', + 'privkey' => $this->_privkey, + 'pubkey' => $this->_pubkey, + 'type' => 'signature' + )); + + $this->assertStringMatchesFormat( +'-----BEGIN PGP SIGNATURE----- +Version: GnuPG v%d.%d.%d (%s) + +%s +%s +=%s +-----END PGP SIGNATURE-----', + $out + ); + + $out = $this->_pgp->encrypt($clear, array( + 'passphrase' => 'Secret', + 'privkey' => $this->_privkey, + 'pubkey' => $this->_pubkey, + 'sigtype' => 'cleartext', + 'type' => 'signature' + )); + + $this->assertStringMatchesFormat( +'-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +0123456789012345678901234567890123456789 +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +The quick brown fox jumps over the lazy dog. +0123456789012345678901234567890123456789 +!"$§%&()=?^´°`+#-.,*\'_:;<>|~\{[]} +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v%d.%d.%d (%s) + +%s +%s +=%s +-----END PGP SIGNATURE-----', + Horde_String::convertCharset($out, 'ISO-8859-1', 'UTF-8') + ); + } + + public function testDecryptSignature() + { + date_default_timezone_set('GMT'); + + $out = $this->_pgp->decrypt( + file_get_contents(dirname(__FILE__) . '/fixtures/clear.txt'), + array( + 'pubkey' => $this->_pubkey, + 'signature' => file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signature.txt'), + 'type' => 'detached-signature' + ) + ); + + $this->assertTrue($out->result); + + $out = $this->_pgp->decrypt( + file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signed.txt'), + array( + 'pubkey' => $this->_pubkey, + 'type' => 'signature' + ) + ); + + $this->assertTrue($out->result); + + $out = $this->_pgp->decrypt( + file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signed2.txt'), + array( + 'pubkey' => $this->_pubkey, + 'type' => 'signature' + ) + ); + + $this->assertTrue($out->result); + } + + public function testVerifyPassphrase() + { + $this->assertTrue( + $this->_pgp->verifyPassphrase($this->_pubkey, $this->_privkey, 'Secret') + ); + + $this->assertFalse( + $this->_pgp->verifyPassphrase($this->_pubkey, $this->_privkey, 'Wrong') + ); + } + +} diff --git a/framework/Crypt/test/Horde/Crypt/SmimeTest.php b/framework/Crypt/test/Horde/Crypt/SmimeTest.php new file mode 100644 index 000000000..939a316df --- /dev/null +++ b/framework/Crypt/test/Horde/Crypt/SmimeTest.php @@ -0,0 +1,35 @@ + + * @category Horde + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @package Crypt + * @subpackage UnitTests + */ + +class Horde_Crypt_SmimeTest extends PHPUnit_Framework_TestCase +{ + protected function setUp() + { + if (!extension_loaded('openssl')) { + $this->markTestSkipped('No openssl support in PHP.'); + } + } + + public function testSubjectAltName() + { + $smime = Horde_Crypt::factory('Smime', array( + 'temp' => Horde_Util::getTempDir() + )); + + $key = file_get_contents(dirname(__FILE__) . '/fixtures/smime_subjectAltName.pem'); + + $this->assertEquals( + 'test1@example.com', + $smime->getEmailFromKey($key) + ); + } + +} diff --git a/framework/Crypt/test/Horde/Crypt/bug_6601.phpt b/framework/Crypt/test/Horde/Crypt/bug_6601.phpt deleted file mode 100644 index e0a2a86fa..000000000 --- a/framework/Crypt/test/Horde/Crypt/bug_6601.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #6601 ---SKIPIF-- - ---FILE-- -pgpPrettyKey(file_get_contents(dirname(__FILE__) . '/fixtures/bug_6601.asc')); -?> ---EXPECT-- -Name: Richard Selsky -Key Type: Public Key -Key Creation: 04/11/08 -Expiration Date: [Never] -Key Length: 1024 Bytes -Comment: [None] -E-Mail: rselsky@bu.edu -Hash-Algorithm: pgp-sha1 -Key ID: 0xF3C01D42 -Key Fingerprint: 5912 D91D 4C79 C670 1FFF 1486 04A6 7B37 F3C0 1D42 - diff --git a/framework/Crypt/test/Horde/Crypt/pgp.inc b/framework/Crypt/test/Horde/Crypt/pgp.inc deleted file mode 100644 index 753c311bc..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp.inc +++ /dev/null @@ -1,23 +0,0 @@ - '/usr/bin/gpg', - 'temp' => Horde_Util::getTempDir() -)); - -$pubkey = file_get_contents($filedir . '/fixtures/pgp_public.asc'); -$privkey = file_get_contents($filedir . '/fixtures/pgp_private.asc'); diff --git a/framework/Crypt/test/Horde/Crypt/pgp_decrypt.phpt b/framework/Crypt/test/Horde/Crypt/pgp_decrypt.phpt deleted file mode 100644 index b6c94faed..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_decrypt.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::decrypt() message. ---SKIPIF-- - ---FILE-- -decrypt($crypt, - array('type' => 'message', - 'pubkey' => $pubkey, - 'privkey' => $privkey, - 'passphrase' => 'Secret')); -if (is_a($decrypt, 'PEAR_Error')) { - var_dump($decrypt); -} else { - echo $decrypt->message; -} - -?> ---EXPECT-- -0123456789012345678901234567890123456789 -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -0123456789012345678901234567890123456789 -!"$§%&()=?^´°`+#-.,*'_:;<>|~\{[]} diff --git a/framework/Crypt/test/Horde/Crypt/pgp_decrypt_symmetric.phpt b/framework/Crypt/test/Horde/Crypt/pgp_decrypt_symmetric.phpt deleted file mode 100644 index 520483526..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_decrypt_symmetric.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::decrypt() message. ---SKIPIF-- - ---FILE-- -decrypt($crypt, - array('type' => 'message', - 'passphrase' => 'Secret')); -if (is_a($decrypt, 'PEAR_Error')) { - var_dump($decrypt); -} else { - echo $decrypt->message; -} - -?> ---EXPECT-- -0123456789012345678901234567890123456789 -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -0123456789012345678901234567890123456789 -!"$§%&()=?^´°`+#-.,*'_:;<>|~\{[]} diff --git a/framework/Crypt/test/Horde/Crypt/pgp_encrypt.phpt b/framework/Crypt/test/Horde/Crypt/pgp_encrypt.phpt deleted file mode 100644 index b7ad78745..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_encrypt.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::encrypt() message. ---SKIPIF-- - ---FILE-- -encrypt($clear, - array('type' => 'message', - 'recips' => array('me@example.com' => $pubkey))); - -?> ---EXPECTF-- ------BEGIN PGP MESSAGE----- -Version: GnuPG v%d.%d.%d (%s) - -%s -%s -%s -%s -%s -%s -%s -%s -%s -%s -=%s ------END PGP MESSAGE----- diff --git a/framework/Crypt/test/Horde/Crypt/pgp_encrypt_symmetric.phpt b/framework/Crypt/test/Horde/Crypt/pgp_encrypt_symmetric.phpt deleted file mode 100644 index 745e82b1b..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_encrypt_symmetric.phpt +++ /dev/null @@ -1,26 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::encrypt() message symmetric. ---SKIPIF-- - ---FILE-- -encrypt($clear, - array('type' => 'message', - 'symmetric' => true, - 'passphrase' => 'Secret')); - -?> ---EXPECTF-- ------BEGIN PGP MESSAGE----- -Version: GnuPG v%d.%d.%d (%s) - -%s -%s -%s -%s -=%s ------END PGP MESSAGE----- diff --git a/framework/Crypt/test/Horde/Crypt/pgp_encryptedSymmetrically.phpt b/framework/Crypt/test/Horde/Crypt/pgp_encryptedSymmetrically.phpt deleted file mode 100644 index 0dbb939a9..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_encryptedSymmetrically.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::encryptedSymmetrically() ---SKIPIF-- - ---FILE-- -encryptedSymmetrically(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_encrypted.txt'))); -var_dump($pgp->encryptedSymmetrically(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_encrypted_symmetric.txt'))); - -?> ---EXPECT-- -bool(false) -bool(true) diff --git a/framework/Crypt/test/Horde/Crypt/pgp_generateRevocation.phpt b/framework/Crypt/test/Horde/Crypt/pgp_generateRevocation.phpt deleted file mode 100644 index ba9439159..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_generateRevocation.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::generateRevocation() ---SKIPIF-- - ---FILE-- -generateRevocation($privkey, 'me@example.com', 'Secret'); - -?> ---EXPECTF-- ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v%d.%d.%d (%s) -Comment: A revocation certificate should follow - -%s -%s -=%s ------END PGP PUBLIC KEY BLOCK----- diff --git a/framework/Crypt/test/Horde/Crypt/pgp_getSignersKeyID.phpt b/framework/Crypt/test/Horde/Crypt/pgp_getSignersKeyID.phpt deleted file mode 100644 index 98fa8e3d6..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_getSignersKeyID.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::getSignersKeyID() ---SKIPIF-- - ---FILE-- -getSignersKeyID(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signed.txt')); - -?> ---EXPECT-- -BADEABD7 diff --git a/framework/Crypt/test/Horde/Crypt/pgp_parsePGPData.phpt b/framework/Crypt/test/Horde/Crypt/pgp_parsePGPData.phpt deleted file mode 100644 index 48accc67b..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_parsePGPData.phpt +++ /dev/null @@ -1,89 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::parsePGPData(). ---SKIPIF-- - ---FILE-- -parsePGPData(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signed.txt'))); - -?> ---EXPECT-- -array(3) { - [0]=> - array(2) { - ["type"]=> - int(2) - ["data"]=> - array(17) { - [0]=> - string(34) "-----BEGIN PGP SIGNED MESSAGE-----" - [1]=> - string(10) "Hash: SHA1" - [2]=> - string(0) "" - [3]=> - string(40) "0123456789012345678901234567890123456789" - [4]=> - string(44) "The quick brown fox jumps over the lazy dog." - [5]=> - string(44) "The quick brown fox jumps over the lazy dog." - [6]=> - string(44) "The quick brown fox jumps over the lazy dog." - [7]=> - string(44) "The quick brown fox jumps over the lazy dog." - [8]=> - string(44) "The quick brown fox jumps over the lazy dog." - [9]=> - string(44) "The quick brown fox jumps over the lazy dog." - [10]=> - string(44) "The quick brown fox jumps over the lazy dog." - [11]=> - string(44) "The quick brown fox jumps over the lazy dog." - [12]=> - string(89) "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog." - [13]=> - string(44) "The quick brown fox jumps over the lazy dog." - [14]=> - string(44) "The quick brown fox jumps over the lazy dog." - [15]=> - string(40) "0123456789012345678901234567890123456789" - [16]=> - string(33) "!"$§%&()=?^´°`+#-.,*'_:;<>|~\{[]}" - } - } - [1]=> - array(2) { - ["type"]=> - int(5) - ["data"]=> - array(7) { - [0]=> - string(29) "-----BEGIN PGP SIGNATURE-----" - [1]=> - string(33) "Version: GnuPG v1.4.5 (GNU/Linux)" - [2]=> - string(0) "" - [3]=> - string(64) "iD8DBQFE3JNgfKdEJrreq9cRAm4lAJ48IbiwbO4ToXa2BrJaAZAFt43AiACZATs+" - [4]=> - string(24) "gnfrwrK41BzMWmVRhtjB1Po=" - [5]=> - string(5) "=5HXb" - [6]=> - string(27) "-----END PGP SIGNATURE-----" - } - } - [2]=> - array(2) { - ["type"]=> - int(6) - ["data"]=> - array(1) { - [0]=> - string(0) "" - } - } -} diff --git a/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketInformation.phpt b/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketInformation.phpt deleted file mode 100644 index 7eb8ee6fb..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketInformation.phpt +++ /dev/null @@ -1,133 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::pgpPacketInformation() ---SKIPIF-- - ---FILE-- -pgpPacketInformation($pubkey)); -var_dump($pgp->pgpPacketInformation($privkey)); - -?> ---EXPECT-- -array(4) { - ["public_key"]=> - array(3) { - ["created"]=> - string(10) "1155291888" - ["expires"]=> - string(1) "0" - ["size"]=> - string(4) "1024" - } - ["signature"]=> - array(2) { - ["id1"]=> - array(7) { - ["name"]=> - string(7) "My Name" - ["comment"]=> - string(10) "My Comment" - ["email"]=> - string(14) "me@example.com" - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["sig_7CA74426BADEABD7"]=> - array(4) { - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["created"]=> - string(10) "1155291888" - ["micalg"]=> - string(8) "pgp-sha1" - } - ["micalg"]=> - string(8) "pgp-sha1" - } - ["_SIGNATURE"]=> - array(2) { - ["micalg"]=> - string(8) "pgp-sha1" - ["sig_7CA74426BADEABD7"]=> - array(4) { - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["created"]=> - string(10) "1155291888" - ["micalg"]=> - string(8) "pgp-sha1" - } - } - } - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" -} -array(4) { - ["secret_key"]=> - array(3) { - ["created"]=> - string(10) "1155291888" - ["expires"]=> - string(1) "0" - ["size"]=> - string(4) "1024" - } - ["signature"]=> - array(2) { - ["id1"]=> - array(7) { - ["name"]=> - string(7) "My Name" - ["comment"]=> - string(10) "My Comment" - ["email"]=> - string(14) "me@example.com" - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["sig_7CA74426BADEABD7"]=> - array(4) { - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["created"]=> - string(10) "1155291888" - ["micalg"]=> - string(8) "pgp-sha1" - } - ["micalg"]=> - string(8) "pgp-sha1" - } - ["_SIGNATURE"]=> - array(2) { - ["micalg"]=> - string(8) "pgp-sha1" - ["sig_7CA74426BADEABD7"]=> - array(4) { - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["created"]=> - string(10) "1155291888" - ["micalg"]=> - string(8) "pgp-sha1" - } - } - } - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" -} diff --git a/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketSignature.phpt b/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketSignature.phpt deleted file mode 100644 index 4c45345dc..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketSignature.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::pgpPacketSignature() ---SKIPIF-- - ---FILE-- -pgpPacketSignature($pubkey, 'me@example.com')); -var_dump($pgp->pgpPacketSignature($privkey, 'me@example.com')); -var_dump($pgp->pgpPacketSignature($privkey, 'foo@example.com')); - -?> ---EXPECT-- -array(11) { - ["name"]=> - string(7) "My Name" - ["comment"]=> - string(10) "My Comment" - ["email"]=> - string(14) "me@example.com" - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["sig_7CA74426BADEABD7"]=> - array(4) { - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["created"]=> - string(10) "1155291888" - ["micalg"]=> - string(8) "pgp-sha1" - } - ["micalg"]=> - string(8) "pgp-sha1" - ["key_type"]=> - string(10) "public_key" - ["key_created"]=> - string(10) "1155291888" - ["key_expires"]=> - string(1) "0" - ["key_size"]=> - string(4) "1024" -} -array(11) { - ["name"]=> - string(7) "My Name" - ["comment"]=> - string(10) "My Comment" - ["email"]=> - string(14) "me@example.com" - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["sig_7CA74426BADEABD7"]=> - array(4) { - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["created"]=> - string(10) "1155291888" - ["micalg"]=> - string(8) "pgp-sha1" - } - ["micalg"]=> - string(8) "pgp-sha1" - ["key_type"]=> - string(10) "secret_key" - ["key_created"]=> - string(10) "1155291888" - ["key_expires"]=> - string(1) "0" - ["key_size"]=> - string(4) "1024" -} -array(0) { -} diff --git a/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketSignatureByUidIndex.phpt b/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketSignatureByUidIndex.phpt deleted file mode 100644 index 92597b5bb..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_pgpPacketSignatureByUidIndex.phpt +++ /dev/null @@ -1,82 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::pgpPacketSignatureByUidIndex() ---SKIPIF-- - ---FILE-- -pgpPacketSignatureByUidIndex($pubkey, 'id1')); -var_dump($pgp->pgpPacketSignatureByUidIndex($privkey, 'id1')); -var_dump($pgp->pgpPacketSignatureByUidIndex($privkey, 'id2')); - -?> ---EXPECT-- -array(11) { - ["name"]=> - string(7) "My Name" - ["comment"]=> - string(10) "My Comment" - ["email"]=> - string(14) "me@example.com" - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["sig_7CA74426BADEABD7"]=> - array(4) { - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["created"]=> - string(10) "1155291888" - ["micalg"]=> - string(8) "pgp-sha1" - } - ["micalg"]=> - string(8) "pgp-sha1" - ["key_type"]=> - string(10) "public_key" - ["key_created"]=> - string(10) "1155291888" - ["key_expires"]=> - string(1) "0" - ["key_size"]=> - string(4) "1024" -} -array(11) { - ["name"]=> - string(7) "My Name" - ["comment"]=> - string(10) "My Comment" - ["email"]=> - string(14) "me@example.com" - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["sig_7CA74426BADEABD7"]=> - array(4) { - ["keyid"]=> - string(16) "7CA74426BADEABD7" - ["fingerprint"]=> - string(16) "7CA74426BADEABD7" - ["created"]=> - string(10) "1155291888" - ["micalg"]=> - string(8) "pgp-sha1" - } - ["micalg"]=> - string(8) "pgp-sha1" - ["key_type"]=> - string(10) "secret_key" - ["key_created"]=> - string(10) "1155291888" - ["key_expires"]=> - string(1) "0" - ["key_size"]=> - string(4) "1024" -} -array(0) { -} diff --git a/framework/Crypt/test/Horde/Crypt/pgp_pgpPrettyKey.phpt b/framework/Crypt/test/Horde/Crypt/pgp_pgpPrettyKey.phpt deleted file mode 100644 index bbb9d5629..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_pgpPrettyKey.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::pgpPrettyKey() ---SKIPIF-- - ---FILE-- -pgpPrettyKey($pubkey); -echo $pgp->pgpPrettyKey($privkey); - -?> ---EXPECT-- -Name: My Name -Key Type: Public Key -Key Creation: 08/11/06 -Expiration Date: [Never] -Key Length: 1024 Bytes -Comment: My Comment -E-Mail: me@example.com -Hash-Algorithm: pgp-sha1 -Key ID: 0xBADEABD7 -Key Fingerprint: 966F 4BA9 569D E6F6 5E82 5397 7CA7 4426 BADE ABD7 - -Name: My Name -Key Type: Private Key -Key Creation: 08/11/06 -Expiration Date: [Never] -Key Length: 1024 Bytes -Comment: My Comment -E-Mail: me@example.com -Hash-Algorithm: pgp-sha1 -Key ID: 0xBADEABD7 -Key Fingerprint: 966F 4BA9 569D E6F6 5E82 5397 7CA7 4426 BADE ABD7 diff --git a/framework/Crypt/test/Horde/Crypt/pgp_publicKeyMIMEPart.phpt b/framework/Crypt/test/Horde/Crypt/pgp_publicKeyMIMEPart.phpt deleted file mode 100644 index 0362b6186..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_publicKeyMIMEPart.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::publicKeyMIMEPart(). ---SKIPIF-- - ---FILE-- -publicKeyMIMEPart($pubkey); -echo $mime_part->getType() . "\n\n"; -echo $mime_part->getContents(); - -?> ---EXPECTF-- -application/pgp-keys - ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v%d.%d.%d (GNU/Linux) - -mQGiBETcWvARBADNitbvsWy5/hhV+WcU2ttmtXkAj2DqJVgJdGS2RH8msO0roG5j -CQK/e0iMJki5lfdgxvxxWgStYMnfF5ftgWA7JV+BZUzJt12Lobm0zdENv2TqL2vc -xlPTmEGsvfPDTbY+Gr3jvuODboXat7bUn2E723WXPdh2A7KNNnLou7JF2wCgiKs/ -RqNKM/Zm01PxLbQ+rs9ghd0D/jLUfJeYWySoDsvfO8e4UyDxDVTBLkkdw3XzLx1F -4SS/Cc2Z9yJuXiepzSH/G/vhdN5ROv12kJwA4FbwsFv5C1uCQleWiPngFixca9Nw -lAd2X2Cp0/4D2XRq1M9dEbcYdrgAuyzt2ZToj3aFaYNGwjfHoLqSngOu6/d3KD1d -i0b2A/9wnXo41kPwS73gU1Un2KKMkKqnczCQHdpopO6NjKaLhNcouRauLrgbrS5y -A1CW+nxjkKVvWrP/VFBmapUpjE1C51J9P0/ub8tRr7H0xHdTQyufv01lmfkjUpVF -n3GVf95l4seBFzD7r580aTx+dJztoHEGWrsWZTNJwo6IIlFOIbQlTXkgTmFtZSAo -TXkgQ29tbWVudCkgPG1lQGV4YW1wbGUuY29tPohgBBMRAgAgBQJE3FrwAhsjBgsJ -CAcDAgQVAggDBBYCAwECHgECF4AACgkQfKdEJrreq9fivACeLBcWErSQU4ZGQsje -dhwfdst9cLQAnRETpwmqt/XvcGFVsOE28MUrUzOGuQENBETcWvAQBADNgIJ4nDlf -gBOI/iqyNy08C9+MjxrqMylrj4TPn3rRk8wySr2myX+j9CML5EHOtsxANYeI9u7h -OF11n5Z8fDht/WGJrNR7EtRhNN6mkKsPaEuO3fhz6EgwJYReUVzDJbvnV2fRCvQo -EGaSntZGQaQzIzIL+/gMEFpEVRK1P2I3VwADBQP+K2Rmmkm3DonXFlUUDWWdhEF4 -b7fy5/IPj41PSSOdo0IP4dprFoe15Vs9gWOYvzcnjy+BbOwhVwsjE3F36hf04od3 -uTSM0dLS/xmpSvgbBh181T5c3W5aKT/daVhyxXJ4csxE+JCVKbaBubne0DPEuyZj -rYlL5Lm0z3VhNCcR0LyISQQYEQIACQUCRNxa8AIbDAAKCRB8p0Qmut6r16Y3AJ9h -umO5uT5yDcir3zwqUAxzBAkE4ACcCtGfb6usaTKnNXo+ZuLoHiOwIE4= -=GCjU ------END PGP PUBLIC KEY BLOCK----- diff --git a/framework/Crypt/test/Horde/Crypt/pgp_sign.phpt b/framework/Crypt/test/Horde/Crypt/pgp_sign.phpt deleted file mode 100644 index 5cc91c0c0..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_sign.phpt +++ /dev/null @@ -1,55 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::encrypt() signature. ---SKIPIF-- - ---FILE-- -encrypt($clear, - array('type' => 'signature', - 'pubkey' => $pubkey, - 'privkey' => $privkey, - 'passphrase' => 'Secret')); -echo $pgp->encrypt($clear, - array('type' => 'signature', - 'pubkey' => $pubkey, - 'privkey' => $privkey, - 'passphrase' => 'Secret', - 'sigtype' => 'cleartext')); - -?> ---EXPECTF-- ------BEGIN PGP SIGNATURE----- -Version: GnuPG v%d.%d.%d (%s) - -%s -%s -=%s ------END PGP SIGNATURE----- ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA1 - -0123456789012345678901234567890123456789 -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -The quick brown fox jumps over the lazy dog. -0123456789012345678901234567890123456789 -!"$§%&()=?^´°`+#-.,*'_:;<>|~\{[]} ------BEGIN PGP SIGNATURE----- -Version: GnuPG v%d.%d.%d (%s) - -%s -%s -=%s ------END PGP SIGNATURE----- diff --git a/framework/Crypt/test/Horde/Crypt/pgp_skipif.inc b/framework/Crypt/test/Horde/Crypt/pgp_skipif.inc deleted file mode 100644 index 5316288d7..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_skipif.inc +++ /dev/null @@ -1,9 +0,0 @@ - ---FILE-- -decrypt(file_get_contents(dirname(__FILE__) . '/fixtures/clear.txt'), - array('type' => 'detached-signature', - 'pubkey' => $pubkey, - 'signature' => file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signature.txt'))); - -echo $pgp->decrypt(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signed.txt'), - array('type' => 'signature', - 'pubkey' => $pubkey)); - -echo $pgp->decrypt(file_get_contents(dirname(__FILE__) . '/fixtures/pgp_signed2.txt'), - array('type' => 'signature', - 'pubkey' => $pubkey)); - -?> ---EXPECT-- -gpg: Signature made Fri Aug 11 14:42:54 2006 GMT using DSA key ID BADEABD7 -gpg: Good signature from "My Name (My Comment) " -gpg: Signature made Fri Aug 11 14:25:36 2006 GMT using DSA key ID BADEABD7 -gpg: Good signature from "My Name (My Comment) " -gpg: Signature made Fri Aug 11 14:28:48 2006 GMT using DSA key ID BADEABD7 -gpg: Good signature from "My Name (My Comment) " diff --git a/framework/Crypt/test/Horde/Crypt/pgp_verifyPassphrase.phpt b/framework/Crypt/test/Horde/Crypt/pgp_verifyPassphrase.phpt deleted file mode 100644 index 33c5e948b..000000000 --- a/framework/Crypt/test/Horde/Crypt/pgp_verifyPassphrase.phpt +++ /dev/null @@ -1,16 +0,0 @@ ---TEST-- -Horde_Crypt_pgp::verifyPassphrase(). ---SKIPIF-- - ---FILE-- -verifyPassphrase($pubkey, $privkey, 'Secret')); -var_dump($pgp->verifyPassphrase($pubkey, $privkey, 'Wrong')); - -?> ---EXPECT-- -bool(true) -bool(false) diff --git a/framework/Crypt/test/Horde/Crypt/smime.inc b/framework/Crypt/test/Horde/Crypt/smime.inc deleted file mode 100644 index 09c8b5fd2..000000000 --- a/framework/Crypt/test/Horde/Crypt/smime.inc +++ /dev/null @@ -1,12 +0,0 @@ - Horde_Util::getTempDir())); diff --git a/framework/Crypt/test/Horde/Crypt/smime_skipif.inc b/framework/Crypt/test/Horde/Crypt/smime_skipif.inc deleted file mode 100644 index 28ddb883c..000000000 --- a/framework/Crypt/test/Horde/Crypt/smime_skipif.inc +++ /dev/null @@ -1,9 +0,0 @@ - ---FILE-- -getEmailFromKey($key); - -?> ---EXPECT-- -test1@example.com -- 2.11.0