Crypt/GPG.php
protected function _encrypt($data, $isFile, $outputFile, $armor)
    {
        if (!$this->hasEncryptKeys()) {
            throw new Crypt_GPG_KeyNotFoundException(
                'No encryption keys specified.'
            );
        }

        $input     = $this->_prepareInput($data, $isFile);
        $output    = $this->_prepareOutput($outputFile, $input);
        $arguments = $armor ? array('--armor') : array();

        foreach ($this->encryptKeys as $key) {
            $arguments[] = '--recipient ' . escapeshellarg($key['fingerprint']);
        }

        $this->engine->reset();
        $this->engine->setInput($input);
        $this->engine->setOutput($output);
        $this->engine->setOperation('--encrypt', $arguments);
        $this->engine->run();

        if ($outputFile === null) {
            return $output;
        }
    }
protected function _encrypt($data, $isFile, $outputFile, $armor)
    {
        if (!$this->hasEncryptKeys()) {
            throw new Crypt_GPG_KeyNotFoundException(
                'No encryption keys specified.'
            );
        }

        $input     = $this->_prepareInput($data, $isFile);
        $output    = $this->_prepareOutput($outputFile, $input);
        $arguments = $armor ? array('--armor') : array();

        foreach ($this->encryptKeys as $key) {
            $arguments[] = '--recipient ' . escapeshellarg($key['fingerprint']);
        }

        $this->engine->reset();
        $this->engine->setInput($input);
        $this->engine->setOutput($output);
        $this->engine->setOperation('--encrypt', $arguments);
        $this->engine->run();

        if ($outputFile === null) {
            return $output;
        }
    }
Encrypts data

@param string  $data       the data to encrypt.
@param boolean $isFile     whether or not the data is a filename.
@param string  $outputFile the filename of the file in which to store
the encrypted data. If null, the encrypted
data is returned as a string.
@param boolean $armor      if true, ASCII armored data is returned;
otherwise, binary data is returned.

@return void|string if the <kbd>$outputFile</kbd> parameter is null, a
string containing the encrypted data is returned.

@throws Crypt_GPG_KeyNotFoundException if no encryption key is specified.
See {@link Crypt_GPG::addEncryptKey()}.

@throws Crypt_GPG_FileException if the output file is not writeable or
if the input file is not readable.

@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.