annotate vendor/pear/crypt_gpg/tests/ImportKeyTest.php @ 4:888e774ee983

libcalendar plugin as distributed
author Charlie Root
date Sat, 13 Jan 2018 08:57:56 -0500
parents 1e000243b222
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
1 <?php
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
2
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
4
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
5 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
6 * Key import tests for the Crypt_GPG package.
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
7 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
8 * These tests require the PHPUnit 3.6 or greater package to be installed.
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
9 * PHPUnit is installable using PEAR. See the
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
10 * {@link http://www.phpunit.de/manual/3.6/en/installation.html manual}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
11 * for detailed installation instructions.
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
12 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
13 * To run these tests, use:
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
14 * <code>
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
15 * $ phpunit ImportKeyTestCase
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
16 * </code>
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
17 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
18 * LICENSE:
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
19 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
20 * This library is free software; you can redistribute it and/or modify
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
21 * it under the terms of the GNU Lesser General Public License as
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
22 * published by the Free Software Foundation; either version 2.1 of the
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
23 * License, or (at your option) any later version.
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
24 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
25 * This library is distributed in the hope that it will be useful,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
28 * Lesser General Public License for more details.
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
29 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
30 * You should have received a copy of the GNU Lesser General Public
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
31 * License along with this library; if not, see
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
32 * <http://www.gnu.org/licenses/>
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
33 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
34 * @category Encryption
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
35 * @package Crypt_GPG
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
36 * @author Michael Gauthier <mike@silverorange.com>
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
37 * @copyright 2005-2008 silverorange
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
38 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
39 * @version CVS: $Id$
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
40 * @link http://pear.php.net/package/Crypt_GPG
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
41 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
42
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
43 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
44 * Base test case.
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
45 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
46 require_once 'TestCase.php';
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
47
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
48 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
49 * Tests key import abilities of Crypt_GPG.
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
50 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
51 * @category Encryption
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
52 * @package Crypt_GPG
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
53 * @author Michael Gauthier <mike@silverorange.com>
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
54 * @copyright 2005-2008 silverorange
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
55 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
56 * @link http://pear.php.net/package/Crypt_GPG
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
57 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
58 class ImportKeyTestCase extends Crypt_GPG_TestCase
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
59 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
60 // set up
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
61 // {{{ setUp()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
62
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
63 public function setUp()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
64 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
65 parent::setUp();
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
66
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
67 // In GnuPG 2.1 first operation on a keyring in v1 format
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
68 // will cause format update and several IMPORT_OK responses
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
69 // This way we clean the state first
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
70 $this->gpg->getKeys();
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
71 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
72
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
73 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
74 // {{{ testImportKey_private()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
75
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
76 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
77 * @group string
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
78 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
79 public function testImportKey_private()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
80 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
81 // Note: Some of GnuPG 2.1.x versions return different private_imported
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
82 // and private_uchanged values, bug? GnuPG 2.1.15 returns 1 as expected.
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
83
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
84 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
85 'fingerprint' => 'F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
86 'fingerprints' => array('F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
87 'public_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
88 'public_unchanged' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
89 'private_imported' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
90 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
91 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
92
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
93 // {{{ private key data
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
94 $privateKeyData = <<<TEXT
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
95 -----BEGIN PGP PRIVATE KEY BLOCK-----
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
96 Version: GnuPG v1.4.6 (GNU/Linux)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
97
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
98 lQHhBEjS+OIRBACPl023p+jInWiUtc7zSBU1D4mv42zSOwPdC37Pn/4x9FyhIOXE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
99 LCRTpsnAw9rT6R3BvAC4uO68fxjxFCwTpsa60RsHw4bwpSAYuf0t5Xg+GQIritlm
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
100 XHVYwku3Hkh4Svv0quemooGuJ9lLwIHacL/4W1dTHLB2rzon0T4kx7ExZwCg/XKl
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
101 RD9zbbnQOgjn0EaS8fcSm+ED/1IMfkCz5ac9Y3jBUlcArOZcOlTrzxst+iMZm4f0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
102 fh8dFCCaRN0iaVLSdCNaFvbKbJYZad1w3jFAMU9bX83flqgV1wMPO/NenfMidBIq
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
103 sKzgttaQo5VmjWPtwyOJXODR2lHKQR2hFCkIKlHMPLV3awCGV8iTyiTZMJirdtvf
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
104 s26oA/9STYro+yB9yrHufdfjM1u8SbSIhK6jUoq2ajLPHaLF2nRZZyv1gnkzRFd+
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
105 /Vxcx6cwp8Qd6L4z+0sU3pMS4X8rt2vqilK2msg1VrHnjGgFIfmfIvY5EmrhNzEx
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
106 6X82fbR9f8lwLy5N/gPm326e0xSw1rWdR15VukJPbmK6nf/pL/4DAwIZF3WLmXaM
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
107 DGCHa6b36T1VZ+bgYYcoQUanh3OSfLO0NwJ5ywFiML26DYZ7M3aivlfXj/8lOKy0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
108 8tcg/rRcUHVibGljIE9ubHkgVGVzdCBLZXkgKGRvIG5vdCBlbmNyeXB0IGltcG9y
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
109 dGFudCBkYXRhIHdpdGggdGhpcyBrZXkpIDxwdWJsaWMtb25seUBleGFtcGxlLmNv
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
110 bT6IYAQTEQIAIAUCSNL44gIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEKuo
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
111 HvVOjA3r8DYAn1/DrF5jw31P3L6MlWdelLuR4POnAJ9It7IynfJalYIHoAWtY2xk
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
112 kTsT+p0CYgRI0vjoEAgAp65R578Es8qtASDAgIbYfJlJTwMovEnA4KJ69mpVt3mz
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
113 cFWMtJCvuilvwSQQ+VfKxjemtbe/IbMe9ssj4nTSLw/mweUB89tRj8ZzaS+/9312
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
114 AS8ra/xIDr6kTSfKcRKjXgMzkJ+A13rYwG5LFWnyumg36xglmzXKhecEkRVPfWn3
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
115 ISoq3zirZlQOWcKYdyA2Z685SKJC/N+3nUqKOJ7qrA7eT608LFksytBHeOfNf5m7
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
116 CC4wAE3RAz+ZkJvWRbE2G5pUalZktq8uKMT5WQgvuFP3hnvku5yilpo2ELTnYkO3
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
117 ltc3NHCc9v+jhikayPr7RvUdVPbaITT80yYKBPygCwADBggApzR1vW/fvzmrO5pW
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
118 zAvd4umVh/Yp34n3vWyXMu+JIHA7s08rkTzlMXzamICQmkjwAuCwJt0t7BA28Lny
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
119 goh2joxo8tE/OowFk+IzbeA2Vrz71d/T5SMDtC2mePE0m3bmCOLBscu5aJIfgi1X
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
120 /fzr44f4i+6hqVDCuOOmnVtbL4xBBnS6KXdcWP7QbVhxG3SpH9Agd/QXvSQm0Obz
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
121 9iKZ11FEXzgnVZGXaCM0GBsFE9JuNY5+hi6A72rccjhC0V1Cy43veeIhOE+v3pK0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
122 a/BGUlgDSdgVopE9zUSQwzuo87UbY3EoDWBqDRSRCRMfmv8S2b9VJIRPdCOHZGCI
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
123 R49/0f4DAwIZF3WLmXaMDGCvSMKxFAt3zGZVEsfwS67ilWw0kq9wgmDpTmbrz1pe
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
124 8tUgmHxgiVc3Xo86ItXGr69udzSODYw2wO6JGdgOKsZDKAv7zJHi+3GISAQYEQIA
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
125 CQUCSNL46AIbDAAKCRCrqB71TowN6zbAAJ4qBrdmAYuAbY5txsc+Tmv9quOpzwCW
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
126 NN5B7Vl2JdxBuwWJrdfUb9UQzw==
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
127 =51qc
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
128 -----END PGP PRIVATE KEY BLOCK-----
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
129
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
130 TEXT;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
131 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
132
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
133 $result = $this->gpg->importKey($privateKeyData);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
134 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
135 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
136
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
137 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
138 // {{{ testImportKey_public()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
139
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
140 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
141 * @group string
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
142 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
143 public function testImportKey_public()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
144 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
145 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
146 'fingerprint' => '948F9835FF09F5F91CFF2AC1268AB7103435E65D',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
147 'fingerprints' => array('948F9835FF09F5F91CFF2AC1268AB7103435E65D'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
148 'public_imported' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
149 'public_unchanged' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
150 'private_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
151 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
152 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
153
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
154 // {{{ public key data
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
155 $publicKeyData = <<<TEXT
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
156 -----BEGIN PGP PUBLIC KEY BLOCK-----
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
157 Version: GnuPG v1.4.6 (GNU/Linux)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
158
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
159 mQGiBEjS+PgRBADbDdRN9iwESSyJvjnfgk7ZWUYKdHdSER7yJ0aM4LQjVDdw9y/f
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
160 QGidipXxVD2lW28gRtzcmLufxv3DzjZp83VaXvlJs9jbTtHDIYFyDW9kH1HTRbZT
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
161 WKWfuInd0AXzHy5o77qQ+mW0AIXbyke5suSHdvcmv1hiWI9OnXcIHpmavwCgt4Hm
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
162 +j3FpRo9qs4fJM887c796qUD/iPkStU9sM/0KCJFZNaPCGBaamCEi7UoAHNlim+B
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
163 dv3rfSQ2VcDRq9/3GoCEJ2c62XpgQxt79mojJLdWZsTWvr6ESnWOm7W6GIjv/Zc3
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
164 +OXgi7QdH5nwpZl6kBMkuzZxczFuwh9dqlXml+bND0JawS38MvQpDUkwMb592v5U
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
165 i9WIBADBacg6nixiTR+4kaHFE1Ww8QxT+vQ4S1SOx47cm8R6FxTRQA7FvK+vMxCt
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
166 Ps9GOzhjrCgIoF/6X10IZ7qB5jCYIH+kvHrp90ZbNwJ4pIa7phCPhqUF9mEyMbC2
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
167 AEIGp/Aw26yXKskQJJ3vFji+VaeCui21sXjg5EHfoayt79xT8bRfRXh0ZXJuYWwg
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
168 UHVibGljIEtleSAoZG8gbm90IGVuY3J5cHQgaW1wb3J0YW50IGRhdGEgd2l0aCB0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
169 aGlzIGtleSkgPGV4dGVybmFsLXB1YmxpY0BleGFtcGxlLmNvbT6IYAQTEQIAIAUC
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
170 SNL4+AIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJECaKtxA0NeZdqHwAn3AF
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
171 EEhX1Tyba0ovCV2DwUytKM0CAKCnu6VzRy1Y8jp9fiy3ScwmaCI3FbkCDQRI0vj8
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
172 EAgArBRh0YpPhE1vvKoPuhGDa//96YqrYt9rmBo3AR1WmF3CKtspjXdOK2bCqdJh
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
173 H6kaoNi+0Ors00n2NfPj9Am2cTV3h2/KpAWOxQGfkmpzU3xXTVCUo/HoKDXIfWqk
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
174 /TPXRqbwFV489GRBtVov4IoZM0KqZXhaFD6cXBsEl/BVSvVdBqmBzUoJ2bOzYiSW
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
175 eg/ml65jbtxjDYMbxTLi7xRcTSAsareoN6/PcbAvcCE5UeCMu8p52wxHOTrAkI4/
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
176 6elpziVpIGn07zJb//4qIoZdhIzwfsMl73tPfdoL9jEC66SiWAN+BEDxceGR5E15
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
177 2WsT5tkxuz/pQUC1L3JW4WCC/wADBwf8CsevcPsk2XxT2XZj0lfmAOuhXxuqBczW
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
178 TXCimnRxvC8+uAacv1RgVRH6emW3BVjt0dr9vwRT0n54JA+7ZwXVMOo4/tqNwmJs
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
179 C6SThBXGBQxEaZwv19WC58DjblbvYa81cUaXrUdHi1OyoHwgalx0xZQ57IUXW6+7
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
180 qdLRfzyqbDBph9ogB0ta3AhSikAqqYImTrI650v/KWBLjrI+N925r0TvnfSOsru7
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
181 JrftccY2LntVnQUcXjuaFViZ7y8ocW8f92zmGj2zUN8z2GsMKiGQtNNmoX51TcQl
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
182 sJPsZF0RKduVkNUQa9cfzSIMjjhUSzspA2qHLUKafrS3e38s2Y4CNIhJBBgRAgAJ
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
183 BQJI0vj8AhsMAAoJECaKtxA0NeZdOFQAn15X+eYzFgVERrFkddsHvAE00OnSAJ9h
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
184 A7Lcv7M+9WeZ6cjeHkZfLB6LLA==
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
185 =AV/P
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
186 -----END PGP PUBLIC KEY BLOCK-----
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
187
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
188 TEXT;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
189 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
190
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
191 $result = $this->gpg->importKey($publicKeyData);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
192 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
193 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
194
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
195 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
196 // {{{ testImportKeyAlreadyImported_private()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
197
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
198 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
199 * @group string
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
200 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
201 public function testImportKeyAlreadyImported_private()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
202 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
203 // {{{ private key data
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
204 $privateKeyData = <<<TEXT
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
205 -----BEGIN PGP PRIVATE KEY BLOCK-----
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
206 Version: GnuPG v1.4.6 (GNU/Linux)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
207
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
208 lQHhBEjS+OIRBACPl023p+jInWiUtc7zSBU1D4mv42zSOwPdC37Pn/4x9FyhIOXE
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
209 LCRTpsnAw9rT6R3BvAC4uO68fxjxFCwTpsa60RsHw4bwpSAYuf0t5Xg+GQIritlm
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
210 XHVYwku3Hkh4Svv0quemooGuJ9lLwIHacL/4W1dTHLB2rzon0T4kx7ExZwCg/XKl
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
211 RD9zbbnQOgjn0EaS8fcSm+ED/1IMfkCz5ac9Y3jBUlcArOZcOlTrzxst+iMZm4f0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
212 fh8dFCCaRN0iaVLSdCNaFvbKbJYZad1w3jFAMU9bX83flqgV1wMPO/NenfMidBIq
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
213 sKzgttaQo5VmjWPtwyOJXODR2lHKQR2hFCkIKlHMPLV3awCGV8iTyiTZMJirdtvf
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
214 s26oA/9STYro+yB9yrHufdfjM1u8SbSIhK6jUoq2ajLPHaLF2nRZZyv1gnkzRFd+
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
215 /Vxcx6cwp8Qd6L4z+0sU3pMS4X8rt2vqilK2msg1VrHnjGgFIfmfIvY5EmrhNzEx
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
216 6X82fbR9f8lwLy5N/gPm326e0xSw1rWdR15VukJPbmK6nf/pL/4DAwIZF3WLmXaM
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
217 DGCHa6b36T1VZ+bgYYcoQUanh3OSfLO0NwJ5ywFiML26DYZ7M3aivlfXj/8lOKy0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
218 8tcg/rRcUHVibGljIE9ubHkgVGVzdCBLZXkgKGRvIG5vdCBlbmNyeXB0IGltcG9y
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
219 dGFudCBkYXRhIHdpdGggdGhpcyBrZXkpIDxwdWJsaWMtb25seUBleGFtcGxlLmNv
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
220 bT6IYAQTEQIAIAUCSNL44gIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEKuo
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
221 HvVOjA3r8DYAn1/DrF5jw31P3L6MlWdelLuR4POnAJ9It7IynfJalYIHoAWtY2xk
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
222 kTsT+p0CYgRI0vjoEAgAp65R578Es8qtASDAgIbYfJlJTwMovEnA4KJ69mpVt3mz
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
223 cFWMtJCvuilvwSQQ+VfKxjemtbe/IbMe9ssj4nTSLw/mweUB89tRj8ZzaS+/9312
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
224 AS8ra/xIDr6kTSfKcRKjXgMzkJ+A13rYwG5LFWnyumg36xglmzXKhecEkRVPfWn3
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
225 ISoq3zirZlQOWcKYdyA2Z685SKJC/N+3nUqKOJ7qrA7eT608LFksytBHeOfNf5m7
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
226 CC4wAE3RAz+ZkJvWRbE2G5pUalZktq8uKMT5WQgvuFP3hnvku5yilpo2ELTnYkO3
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
227 ltc3NHCc9v+jhikayPr7RvUdVPbaITT80yYKBPygCwADBggApzR1vW/fvzmrO5pW
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
228 zAvd4umVh/Yp34n3vWyXMu+JIHA7s08rkTzlMXzamICQmkjwAuCwJt0t7BA28Lny
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
229 goh2joxo8tE/OowFk+IzbeA2Vrz71d/T5SMDtC2mePE0m3bmCOLBscu5aJIfgi1X
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
230 /fzr44f4i+6hqVDCuOOmnVtbL4xBBnS6KXdcWP7QbVhxG3SpH9Agd/QXvSQm0Obz
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
231 9iKZ11FEXzgnVZGXaCM0GBsFE9JuNY5+hi6A72rccjhC0V1Cy43veeIhOE+v3pK0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
232 a/BGUlgDSdgVopE9zUSQwzuo87UbY3EoDWBqDRSRCRMfmv8S2b9VJIRPdCOHZGCI
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
233 R49/0f4DAwIZF3WLmXaMDGCvSMKxFAt3zGZVEsfwS67ilWw0kq9wgmDpTmbrz1pe
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
234 8tUgmHxgiVc3Xo86ItXGr69udzSODYw2wO6JGdgOKsZDKAv7zJHi+3GISAQYEQIA
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
235 CQUCSNL46AIbDAAKCRCrqB71TowN6zbAAJ4qBrdmAYuAbY5txsc+Tmv9quOpzwCW
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
236 NN5B7Vl2JdxBuwWJrdfUb9UQzw==
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
237 =51qc
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
238 -----END PGP PRIVATE KEY BLOCK-----
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
239
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
240 TEXT;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
241 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
242
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
243 $result = $this->gpg->importKey($privateKeyData);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
244
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
245 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
246 'fingerprint' => 'F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
247 'fingerprints' => array('F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
248 'public_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
249 'public_unchanged' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
250 'private_imported' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
251 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
252 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
253
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
254 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
255
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
256 $result = $this->gpg->importKey($privateKeyData);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
257
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
258 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
259 'fingerprint' => 'F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
260 'fingerprints' => array('F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
261 'public_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
262 'public_unchanged' => version_compare($this->gpg->getVersion(), '2.1.0', 'ge') ? 1 : 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
263 'private_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
264 'private_unchanged' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
265 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
266
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
267 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
268 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
269
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
270 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
271 // {{{ testImportKeyAlreadyImported_public()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
272
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
273 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
274 * @group string
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
275 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
276 public function testImportKeyAlreadyImported_public()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
277 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
278 // {{{ public key data
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
279 $publicKeyData = <<<TEXT
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
280 -----BEGIN PGP PUBLIC KEY BLOCK-----
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
281 Version: GnuPG v1.4.6 (GNU/Linux)
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
282
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
283 mQGiBEjS+PgRBADbDdRN9iwESSyJvjnfgk7ZWUYKdHdSER7yJ0aM4LQjVDdw9y/f
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
284 QGidipXxVD2lW28gRtzcmLufxv3DzjZp83VaXvlJs9jbTtHDIYFyDW9kH1HTRbZT
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
285 WKWfuInd0AXzHy5o77qQ+mW0AIXbyke5suSHdvcmv1hiWI9OnXcIHpmavwCgt4Hm
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
286 +j3FpRo9qs4fJM887c796qUD/iPkStU9sM/0KCJFZNaPCGBaamCEi7UoAHNlim+B
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
287 dv3rfSQ2VcDRq9/3GoCEJ2c62XpgQxt79mojJLdWZsTWvr6ESnWOm7W6GIjv/Zc3
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
288 +OXgi7QdH5nwpZl6kBMkuzZxczFuwh9dqlXml+bND0JawS38MvQpDUkwMb592v5U
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
289 i9WIBADBacg6nixiTR+4kaHFE1Ww8QxT+vQ4S1SOx47cm8R6FxTRQA7FvK+vMxCt
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
290 Ps9GOzhjrCgIoF/6X10IZ7qB5jCYIH+kvHrp90ZbNwJ4pIa7phCPhqUF9mEyMbC2
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
291 AEIGp/Aw26yXKskQJJ3vFji+VaeCui21sXjg5EHfoayt79xT8bRfRXh0ZXJuYWwg
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
292 UHVibGljIEtleSAoZG8gbm90IGVuY3J5cHQgaW1wb3J0YW50IGRhdGEgd2l0aCB0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
293 aGlzIGtleSkgPGV4dGVybmFsLXB1YmxpY0BleGFtcGxlLmNvbT6IYAQTEQIAIAUC
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
294 SNL4+AIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJECaKtxA0NeZdqHwAn3AF
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
295 EEhX1Tyba0ovCV2DwUytKM0CAKCnu6VzRy1Y8jp9fiy3ScwmaCI3FbkCDQRI0vj8
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
296 EAgArBRh0YpPhE1vvKoPuhGDa//96YqrYt9rmBo3AR1WmF3CKtspjXdOK2bCqdJh
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
297 H6kaoNi+0Ors00n2NfPj9Am2cTV3h2/KpAWOxQGfkmpzU3xXTVCUo/HoKDXIfWqk
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
298 /TPXRqbwFV489GRBtVov4IoZM0KqZXhaFD6cXBsEl/BVSvVdBqmBzUoJ2bOzYiSW
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
299 eg/ml65jbtxjDYMbxTLi7xRcTSAsareoN6/PcbAvcCE5UeCMu8p52wxHOTrAkI4/
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
300 6elpziVpIGn07zJb//4qIoZdhIzwfsMl73tPfdoL9jEC66SiWAN+BEDxceGR5E15
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
301 2WsT5tkxuz/pQUC1L3JW4WCC/wADBwf8CsevcPsk2XxT2XZj0lfmAOuhXxuqBczW
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
302 TXCimnRxvC8+uAacv1RgVRH6emW3BVjt0dr9vwRT0n54JA+7ZwXVMOo4/tqNwmJs
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
303 C6SThBXGBQxEaZwv19WC58DjblbvYa81cUaXrUdHi1OyoHwgalx0xZQ57IUXW6+7
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
304 qdLRfzyqbDBph9ogB0ta3AhSikAqqYImTrI650v/KWBLjrI+N925r0TvnfSOsru7
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
305 JrftccY2LntVnQUcXjuaFViZ7y8ocW8f92zmGj2zUN8z2GsMKiGQtNNmoX51TcQl
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
306 sJPsZF0RKduVkNUQa9cfzSIMjjhUSzspA2qHLUKafrS3e38s2Y4CNIhJBBgRAgAJ
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
307 BQJI0vj8AhsMAAoJECaKtxA0NeZdOFQAn15X+eYzFgVERrFkddsHvAE00OnSAJ9h
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
308 A7Lcv7M+9WeZ6cjeHkZfLB6LLA==
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
309 =AV/P
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
310 -----END PGP PUBLIC KEY BLOCK-----
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
311
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
312 TEXT;
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
313 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
314
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
315 $result = $this->gpg->importKey($publicKeyData);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
316
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
317 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
318 'fingerprint' => '948F9835FF09F5F91CFF2AC1268AB7103435E65D',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
319 'fingerprints' => array('948F9835FF09F5F91CFF2AC1268AB7103435E65D'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
320 'public_imported' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
321 'public_unchanged' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
322 'private_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
323 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
324 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
325
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
326 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
327
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
328 $result = $this->gpg->importKey($publicKeyData);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
329
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
330 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
331 'fingerprint' => '948F9835FF09F5F91CFF2AC1268AB7103435E65D',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
332 'fingerprints' => array('948F9835FF09F5F91CFF2AC1268AB7103435E65D'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
333 'public_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
334 'public_unchanged' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
335 'private_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
336 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
337 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
338
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
339 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
340 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
341
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
342 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
343 // {{{ testImportKeyNoDataException_invalid()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
344
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
345 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
346 * @expectedException Crypt_GPG_NoDataException
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
347 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
348 * @group string
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
349 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
350 public function testImportKeyNoDataException_invalid()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
351 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
352 $keyData = 'Invalid OpenPGP data.';
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
353 $this->gpg->importKey($keyData);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
354 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
355
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
356 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
357 // {{{ testImportKeyNoDataException_empty()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
358
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
359 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
360 * @expectedException Crypt_GPG_NoDataException
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
361 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
362 * @group string
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
363 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
364 public function testImportKeyNoDataException_empty()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
365 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
366 $keyData = '';
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
367 $this->gpg->importKey($keyData);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
368 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
369
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
370 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
371 // {{{ testImportKeyFile_private()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
372
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
373 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
374 * @group file
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
375 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
376 public function testImportKeyFile_private()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
377 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
378 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
379 'fingerprint' => 'F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
380 'fingerprints' => array('F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
381 'public_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
382 'public_unchanged' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
383 'private_imported' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
384 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
385 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
386
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
387 $filename = $this->getDataFilename('testImportKeyFile_private.asc');
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
388 $result = $this->gpg->importKeyFile($filename);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
389
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
390 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
391 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
392
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
393 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
394 // {{{ testImportKeyFile_public()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
395
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
396 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
397 * @group file
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
398 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
399 public function testImportKeyFile_public()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
400 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
401 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
402 'fingerprint' => '948F9835FF09F5F91CFF2AC1268AB7103435E65D',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
403 'fingerprints' => array('948F9835FF09F5F91CFF2AC1268AB7103435E65D'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
404 'public_imported' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
405 'public_unchanged' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
406 'private_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
407 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
408 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
409
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
410 $filename = $this->getDataFilename('testImportKeyFile_public.asc');
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
411 $result = $this->gpg->importKeyFile($filename);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
412
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
413 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
414 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
415
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
416 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
417 // {{{ testImportKeyFileAlreadyImported_private()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
418
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
419 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
420 * @group file
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
421 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
422 public function testImportKeyFileAlreadyImported_private()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
423 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
424 $filename = $this->getDataFilename('testImportKeyFile_private.asc');
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
425 $result = $this->gpg->importKeyFile($filename);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
426
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
427 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
428 'fingerprint' => 'F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
429 'fingerprints' => array('F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
430 'public_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
431 'public_unchanged' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
432 'private_imported' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
433 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
434 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
435
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
436 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
437
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
438 $result = $this->gpg->importKeyFile($filename);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
439
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
440 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
441 'fingerprint' => 'F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
442 'fingerprints' => array('F83118CB6F5892DC1C3E936DABA81EF54E8C0DEB'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
443 'public_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
444 'public_unchanged' => version_compare($this->gpg->getVersion(), '2.1.0', 'ge') ? 1 : 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
445 'private_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
446 'private_unchanged' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
447 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
448
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
449 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
450 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
451
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
452 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
453 // {{{ testImportKeyFileAlreadyImported_public()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
454
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
455 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
456 * @group file
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
457 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
458 public function testImportKeyFileAlreadyImported_public()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
459 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
460 $filename = $this->getDataFilename('testImportKeyFile_public.asc');
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
461 $result = $this->gpg->importKeyFile($filename);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
462
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
463 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
464 'fingerprint' => '948F9835FF09F5F91CFF2AC1268AB7103435E65D',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
465 'fingerprints' => array('948F9835FF09F5F91CFF2AC1268AB7103435E65D'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
466 'public_imported' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
467 'public_unchanged' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
468 'private_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
469 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
470 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
471
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
472 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
473
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
474 $result = $this->gpg->importKeyFile($filename);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
475
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
476 $expectedResult = array(
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
477 'fingerprint' => '948F9835FF09F5F91CFF2AC1268AB7103435E65D',
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
478 'fingerprints' => array('948F9835FF09F5F91CFF2AC1268AB7103435E65D'),
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
479 'public_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
480 'public_unchanged' => 1,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
481 'private_imported' => 0,
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
482 'private_unchanged' => 0
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
483 );
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
484
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
485 $this->assertEquals($expectedResult, $result);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
486 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
487
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
488 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
489 // {{{ testImportKeyFileFileException()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
490
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
491 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
492 * @expectedException Crypt_GPG_FileException
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
493 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
494 * @group file
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
495 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
496 public function testImportKeyFileFileException()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
497 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
498 // input file does not exist
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
499 $filename =
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
500 $this->getDataFilename('testImportKeyFileFileException.asc');
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
501
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
502 $this->gpg->importKeyFile($filename);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
503 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
504
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
505 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
506 // {{{ testImportKeyFileNoDataException()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
507
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
508 /**
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
509 * @expectedException Crypt_GPG_NoDataException
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
510 *
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
511 * @group file
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
512 */
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
513 public function testImportKeyFileNoDataException()
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
514 {
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
515 $filename = $this->getDataFilename('testFileEmpty.plain');
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
516 $this->gpg->importKeyFile($filename);
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
517 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
518
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
519 // }}}
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
520 }
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
521
1e000243b222 vanilla 1.3.3 distro, I hope
Charlie Root
parents:
diff changeset
522 ?>