Skip to content

Commit

Permalink
[mms] Remove Horde_Crypt_Pgp#generateRevocation() (Bug #7375).
Browse files Browse the repository at this point in the history
This won't work unless using a version of GnuPG that hasn't been
released yet, due to the fact that this command can't be run in batch
mode and disabling pinentry is not possible with any released version.

Not BC breaking since this method has never worked.
  • Loading branch information
slusarz committed Nov 13, 2013
1 parent ee0da6e commit 354b7a2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 64 deletions.
43 changes: 0 additions & 43 deletions framework/Crypt/lib/Horde/Crypt/Pgp.php
Expand Up @@ -1456,49 +1456,6 @@ protected function _callGpg($options, $mode, $input = array(),
return $data;
}

/**
* Generates a revocation certificate.
*
* @param string $key The private key.
* @param string $email The email to use for the key.
* @param string $passphrase The passphrase to use for the key.
*
* @return string The revocation certificate.
* @throws Horde_Crypt_Exception
*/
public function generateRevocation($key, $email, $passphrase)
{
$keyring1 = $this->_putInKeyring($key, 'public');
$keyring2 = $this->_putInKeyring($key, 'private');

/* Prepare the canned answers. */
$input = array(
'y', // Really generate a revocation certificate
'0', // Refuse to specify a reason
'', // Empty comment
'y' // Confirm empty comment
);
if (!empty($passphrase)) {
$input[] = $passphrase;
}

/* Run through gpg binary. */
$cmdline = array(
$keyring1,
$keyring2,
'--command-fd 0',
'--gen-revoke ' . $email,
);
$results = $this->_callGpg($cmdline, 'w', $input, true);

/* If the key is empty, something went wrong. */
if (empty($results->output)) {
throw new Horde_Crypt_Exception(Horde_Crypt_Translation::t("Revocation key not generated successfully."));
}

return $results->output;
}

/**
* Generates a public key from a private key.
*
Expand Down
2 changes: 2 additions & 0 deletions framework/Crypt/package.xml
Expand Up @@ -27,6 +27,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Remove Horde_Crypt_Pgp#generateRevocation() (Bug #7375).
* [mms] Fix submitting PGP keys to a public keyserver (Bug #10931).
* [mms] PGP keyserver code now uses Horde_Http_Client to connect to the keyserver.
* [mms] Move PGP keyserver code to a separate Horde_Crypt_Pgp_Keyserver class.
Expand Down Expand Up @@ -976,6 +977,7 @@ Initial release as a PEAR package
<date>2013-11-13</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [mms] Remove Horde_Crypt_Pgp#generateRevocation() (Bug #7375).
* [mms] Fix submitting PGP keys to a public keyserver (Bug #10931).
* [mms] PGP keyserver code now uses Horde_Http_Client to connect to the keyserver.
* [mms] Move PGP keyserver code to a separate Horde_Crypt_Pgp_Keyserver class.
Expand Down
21 changes: 0 additions & 21 deletions framework/Crypt/test/Horde/Crypt/PgpTest.php
Expand Up @@ -181,27 +181,6 @@ public function testPgpEncryptedSymmetrically()
);
}

public function testGenerateRevocation()
{
$this->markTestSkipped('This is broken in GPG2');

$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(
Expand Down

0 comments on commit 354b7a2

Please sign in to comment.