Thomas Bruederli
2014-04-09 a2cf7c41b97a587d90188b83e4d15da1567a54b4
program/lib/Crypt/GPG/DecryptStatusHandler.php
@@ -3,9 +3,9 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
 * Crypt_GPG is a package to use GPG from PHP
 * Crypt_GPG is a package to use GnuPG from PHP
 *
 * This file contains an object that handles GPG's status output for the
 * This file contains an object that handles GnuPG's status output for the
 * decrypt operation.
 *
 * PHP version 5
@@ -29,9 +29,9 @@
 * @category  Encryption
 * @package   Crypt_GPG
 * @author    Michael Gauthier <mike@silverorange.com>
 * @copyright 2008-2009 silverorange
 * @copyright 2008-2013 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 * @version   CVS: $Id: DecryptStatusHandler.php 302814 2010-08-26 15:43:07Z gauthierm $
 * @version   CVS: $Id$
 * @link      http://pear.php.net/package/Crypt_GPG
 * @link      http://www.gnupg.org/
 */
@@ -42,7 +42,7 @@
require_once 'Crypt/GPG.php';
/**
 * GPG exception classes
 * Crypt_GPG exception classes
 */
require_once 'Crypt/GPG/Exceptions.php';
@@ -55,8 +55,8 @@
 *
 * This class is responsible for sending the passphrase commands when required
 * by the {@link Crypt_GPG::decrypt()} method. See <b>doc/DETAILS</b> in the
 * {@link http://www.gnupg.org/download/ GPG distribution} for detailed
 * information on GPG's status output for the decrypt operation.
 * {@link http://www.gnupg.org/download/ GnuPG distribution} for detailed
 * information on GnuPG's status output for the decrypt operation.
 *
 * This class is also responsible for parsing error status and throwing a
 * meaningful exception in the event that decryption fails.
@@ -64,7 +64,7 @@
 * @category  Encryption
 * @package   Crypt_GPG
 * @author    Michael Gauthier <mike@silverorange.com>
 * @copyright 2008 silverorange
 * @copyright 2008-2013 silverorange
 * @license   http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
 * @link      http://pear.php.net/package/Crypt_GPG
 * @link      http://www.gnupg.org/
@@ -293,8 +293,10 @@
            throw new Crypt_GPG_KeyNotFoundException(
                'Cannot decrypt data. No suitable private key is in the ' .
                'keyring. Import a suitable private key before trying to ' .
                'decrypt this data.', $code, $keyId);
                'decrypt this data.',
                $code,
                $keyId
            );
        case Crypt_GPG::ERROR_BAD_PASSPHRASE:
            $badPassphrases = array_diff_key(
                $this->badPassphrases,
@@ -316,17 +318,23 @@
                    implode('", "', $badPassphrases) . '".';
            }
            throw new Crypt_GPG_BadPassphraseException($message, $code,
                $badPassphrases, $missingPassphrases);
            throw new Crypt_GPG_BadPassphraseException(
                $message,
                $code,
                $badPassphrases,
                $missingPassphrases
            );
        case Crypt_GPG::ERROR_NO_DATA:
            throw new Crypt_GPG_NoDataException(
                'Cannot decrypt data. No PGP encrypted data was found in '.
                'the provided data.', $code);
                'the provided data.',
                $code
            );
        default:
            throw new Crypt_GPG_Exception(
                'Unknown error decrypting data.', $code);
                'Unknown error decrypting data.',
                $code
            );
        }
    }