0
|
1 <?php
|
|
2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
|
3
|
|
4 /**
|
|
5 * Unit tests for Crypt_GPG
|
|
6 *
|
|
7 * LICENSE:
|
|
8 *
|
|
9 * This library is free software; you can redistribute it and/or modify
|
|
10 * it under the terms of the GNU Lesser General Public License as
|
|
11 * published by the Free Software Foundation; either version 2.1 of the
|
|
12 * License, or (at your option) any later version.
|
|
13 *
|
|
14 * This library is distributed in the hope that it will be useful,
|
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
17 * Lesser General Public License for more details.
|
|
18 *
|
|
19 * You should have received a copy of the GNU Lesser General Public
|
|
20 * License along with this library; if not, see
|
|
21 * <http://www.gnu.org/licenses/>
|
|
22 *
|
|
23 * @category Encryption
|
|
24 * @package Crypt_GPG
|
|
25 * @author Michael Gauthier <mike@silverorange.com>
|
|
26 * @copyright 2005-2008 silverorange
|
|
27 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
|
|
28 * @version CVS: $Id$
|
|
29 * @link http://pear.php.net/package/Crypt_GPG
|
|
30 */
|
|
31
|
|
32 /**
|
|
33 * Base test case.
|
|
34 */
|
|
35 require_once 'TestCase.php';
|
|
36
|
|
37 //require_once 'Crypt/GPG/SignatureCreationInfo.php';
|
|
38
|
|
39 /**
|
|
40 * Test the signature creation information class
|
|
41 *
|
|
42 * @category Encryption
|
|
43 * @package Crypt_GPG
|
|
44 * @author Michael Gauthier <mike@silverorange.com>
|
|
45 * @copyright 2005-2008 silverorange
|
|
46 * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
|
|
47 * @link http://pear.php.net/package/Crypt_GPG
|
|
48 */
|
|
49 class SignatureCreationInfoTest extends Crypt_GPG_TestCase
|
|
50 {
|
|
51
|
|
52 public function testValidSigCreatedLine()
|
|
53 {
|
|
54 $sci = new Crypt_GPG_SignatureCreationInfo(
|
|
55 'SIG_CREATED D 17 2 00 1440922957 8D2299D9C5C211128B32BBB0C097D9EC94C06363'
|
|
56 );
|
|
57 $this->assertTrue($sci->isValid());
|
|
58 $this->assertEquals(Crypt_GPG::SIGN_MODE_DETACHED, $sci->getMode());
|
|
59 $this->assertEquals(1440922957, $sci->getTimestamp());
|
|
60 $this->assertEquals(17, $sci->getPkAlgorithm());
|
|
61 $this->assertEquals(2, $sci->getHashAlgorithm());
|
|
62 $this->assertEquals('sha1', $sci->getHashAlgorithmName());
|
|
63 $this->assertEquals(
|
|
64 '8D2299D9C5C211128B32BBB0C097D9EC94C06363',
|
|
65 $sci->getKeyFingerprint()
|
|
66 );
|
|
67 }
|
|
68
|
|
69 public function testInvalidSigCreatedLine()
|
|
70 {
|
|
71 $sci = new Crypt_GPG_SignatureCreationInfo('foo bar');
|
|
72 $this->assertNull($sci->getMode());
|
|
73 $this->assertFalse($sci->isValid());
|
|
74 }
|
|
75 }
|
|
76 ?>
|