Crypt/GPG.php
protected function _importKey($key, $isFile)
    {
        $result    = array();
        $arguments = array();
        $input     = $this->_prepareInput($key, $isFile, false);
        $version   = $this->engine->getVersion();

        if (version_compare($version, '1.0.5', 'ge')
            && version_compare($version, '1.0.7', 'lt')
        ) {
            $arguments[] = '--allow-secret-key-import';
        }

        if (empty($this->passphrases)) {
            $arguments[] = '--batch';
        }

        $this->engine->reset();
        $this->engine->setPins($this->passphrases);
        $this->engine->setOperation('--import', $arguments);
        $this->engine->setInput($input);
        $this->engine->run();

        return $this->engine->getProcessData('Import');
    }
protected function _importKey($key, $isFile)
    {
        $result    = array();
        $arguments = array();
        $input     = $this->_prepareInput($key, $isFile, false);
        $version   = $this->engine->getVersion();

        if (version_compare($version, '1.0.5', 'ge')
            && version_compare($version, '1.0.7', 'lt')
        ) {
            $arguments[] = '--allow-secret-key-import';
        }

        if (empty($this->passphrases)) {
            $arguments[] = '--batch';
        }

        $this->engine->reset();
        $this->engine->setPins($this->passphrases);
        $this->engine->setOperation('--import', $arguments);
        $this->engine->setInput($input);
        $this->engine->run();

        return $this->engine->getProcessData('Import');
    }
Imports a public or private key into the keyring

@param string  $key    the key to be imported.
@param boolean $isFile whether or not the input is a filename.

@return array an associative array containing the following elements:
- <kbd>fingerprint</kbd>       - the fingerprint of the
imported key,
- <kbd>public_imported</kbd>   - the number of public
keys imported,
- <kbd>public_unchanged</kbd>  - the number of unchanged
public keys,
- <kbd>private_imported</kbd>  - the number of private
keys imported,
- <kbd>private_unchanged</kbd> - the number of unchanged
private keys.

@throws Crypt_GPG_NoDataException if the key data is missing or if the
data is is not valid key data.

@throws Crypt_GPG_FileException if the key file is not readable.

@throws Crypt_GPG_BadPassphraseException if a required passphrase is
incorrect or if a required passphrase is not specified. See
{@link Crypt_GPG::addPassphrase()}.

@throws Crypt_GPG_Exception if an unknown or unexpected error occurs.
Use the <kbd>debug</kbd> option and file a bug report if these
exceptions occur.