View | Details | Raw Unified
Collapse All | Expand All

(-) gpg.org/gpg.php (-6 / +10 lines)
 Lines 25-30   define( 'GPGSTDOUT', 1 ); Link Here 
define( 'GPGSTDERR', 2 );
define( 'GPGSTDERR', 2 );
define( 'STATUS_FD', 5 );
define( 'STATUS_FD', 5 );
define( 'PASSPHRASE_FD', 7 );
define( 'PASSPHRASE_FD', 7 );
define( 'PASSPHRASE_FD2', 8 );
define( 'CHECKPASSWORD_FD', 3 );
define( 'CHECKPASSWORD_FD', 3 );
// from gnupg include/cipher.h
// from gnupg include/cipher.h
 Lines 444-449   class GnuPG Link Here 
		GPGSTDERR => array( 'pipe', 'w' ),  // stderr
		GPGSTDERR => array( 'pipe', 'w' ),  // stderr
		STATUS_FD => array( 'pipe', 'w' ),
		STATUS_FD => array( 'pipe', 'w' ),
		PASSPHRASE_FD => array( 'pipe', 'r' )
		PASSPHRASE_FD => array( 'pipe', 'r' )
		PASSPHRASE_FD2 => array( 'pipe', 'r' )
	);
	);
    //These variables control the environmental variables that we try to set before executing the gpg binary
    //These variables control the environmental variables that we try to set before executing the gpg binary
 Lines 1512-1517   class GnuPG Link Here 
								default:
								default:
									$this->printDebug("This action: " . $this->action . " isn't written to allow passing of the passphrase.");
									$this->printDebug("This action: " . $this->action . " isn't written to allow passing of the passphrase.");
									$this->closePipe(PASSPHRASE_FD);
									$this->closePipe(PASSPHRASE_FD);
									$this->closePipe(PASSPHRASE_FD2);
									$this->setError("NOSTATUS","Couldn't handle the status");
									$this->setError("NOSTATUS","Couldn't handle the status");
									break;
									break;
							}
							}
 Lines 1770-1775   class GnuPG Link Here 
				case "BEGIN ENCRYPTION":
				case "BEGIN ENCRYPTION":
					$this->printDebug("Encryption begun.");
					$this->printDebug("Encryption begun.");
					$this->closePipe( PASSPHRASE_FD );
					$this->closePipe( PASSPHRASE_FD );
					$this->closePipe( PASSPHRASE_FD2 );
					break;
					break;
			}
			}
		} //end [GNUPG]: if
		} //end [GNUPG]: if
 Lines 1795-1801   class GnuPG Link Here 
	{
	{
		if ($this->passphrase) {
		if ($this->passphrase) {
			$this->printDebug( "Sending Passphrase" );
			$this->printDebug( "Sending Passphrase" );
			$this->writeData( $this->passphrase."\n", PASSPHRASE_FD );
			$this->writeData( $this->passphrase."\n", PASSPHRASE_FD2 );
			$this->printDebug( "Done Sending Passphrase" );
			$this->printDebug( "Done Sending Passphrase" );
		} else {
		} else {
		$keyIndex = $this->getKeyIndexFromFingerprint( $fingerprint );
		$keyIndex = $this->getKeyIndexFromFingerprint( $fingerprint );
 Lines 1803-1814   class GnuPG Link Here 
		if( $keyIndex !== false && $this->keys[ $keyIndex ]->passphrase!='' )
		if( $keyIndex !== false && $this->keys[ $keyIndex ]->passphrase!='' )
		{
		{
			$this->printDebug( "Sending Passphrase" );
			$this->printDebug( "Sending Passphrase" );
			$this->writeData( $this->keys[ $keyIndex]->passphrase."\n", PASSPHRASE_FD );
			$this->writeData( $this->keys[ $keyIndex]->passphrase."\n", PASSPHRASE_FD2 );
			$this->printDebug( "Done Sending Passphrase" );
			$this->printDebug( "Done Sending Passphrase" );
		}
		}
		else {
		else {
			$this->printDebug( "No Password: " . $this->keys[ $keyIndex ]->passphrase . '?' );
			$this->printDebug( "No Password: " . $this->keys[ $keyIndex ]->passphrase . '?' );
			$this->writeData("\n", PASSPHRASE_FD );
			$this->writeData("\n", PASSPHRASE_FD2 );
		}
		}
		}
		}
//		$this->closePipe( PASSPHRASE_FD );
//		$this->closePipe( PASSPHRASE_FD );
 Lines 1827-1834   class GnuPG Link Here 
	{
	{
		if ($this->newpassphrase) {
		if ($this->newpassphrase) {
			$this->printDebug("Writing new passphrase." );
			$this->printDebug("Writing new passphrase." );
			$this->writeData($this->newpassphrase."\n",PASSPHRASE_FD );
			$this->writeData($this->newpassphrase."\n",PASSPHRASE_FD2 );
			$this->writeData($this->newpassphrase."\n",PASSPHRASE_FD );
			$this->writeData($this->newpassphrase."\n",PASSPHRASE_FD2 );
		} else {
		} else {
			$this->printDebug("Failed to find new passphrase." );
			$this->printDebug("Failed to find new passphrase." );
		}
		}
 Lines 3072-3078   class GnuPG Link Here 
		$lastSecondCommands='';
		$lastSecondCommands='';
		if( $usePassphrase )
		if( $usePassphrase )
			$lastSecondCommands .= ' --command-fd '.PASSPHRASE_FD;
			$lastSecondCommands .= ' --batch --command-fd '.PASSPHRASE_FD . ' --passphrase-fd='.PASSPHRASE_FD2;
		else
		else
			$lastSecondCommands .= ' --batch';
			$lastSecondCommands .= ' --batch';