Class: Crypt_GPG
Source Location: /Crypt_GPG-1.0.0/GPG.php
A class to use GPG from PHP
Author(s):
Copyright:
|
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
__construct (Constructor) [line 353]
Crypt_GPG __construct(
[
$options = array()])
|
|
Creates a new GPG object Available options are: - string homedir - the directory where the GPG keyring files
are stored. If not specified, Crypt_GPG
uses the default of ~/.gnupg.
- string binary - the location of the GPG binary. If not
specified, the driver attempts to auto-
detect the GPG binary location using a
list of known default locations for the
current operating system. The option
gpgBinary is a deprecated
alias for this option.
- boolean debug - whether or not to use debug mode. When
debug mode is on, all communication to and
from the GPG subprocess is logged. This
can be useful to diagnose errors when
using Crypt_GPG.
Parameters:
addDecryptKey [line 1203]
void addDecryptKey(
mixed
$key, [string
$passphrase = null])
|
|
Adds a key to use for decryption
Parameters:
addEncryptKey [line 1226]
void addEncryptKey(
mixed
$key)
|
|
Adds a key to use for encryption
Parameters:
addSignKey [line 1254]
void addSignKey(
mixed
$key, [string
$passphrase = null])
|
|
Adds a key to use for signing
Parameters:
clearDecryptKeys [line 1270]
Clears all decryption keys
clearEncryptKeys [line 1286]
Clears all encryption keys
clearSignKeys [line 1302]
decrypt [line 967]
string decrypt(
string
$encryptedData)
|
|
Decrypts string data This method assumes the required private key is available in the keyring and throws an exception if the private key is not available. To add a private key to the keyring, use the Crypt_GPG::importKey() or Crypt_GPG::importKeyFile() methods.
Parameters:
decryptFile [line 1010]
void|string decryptFile(
string
$encryptedFile, [string
$decryptedFile = null])
|
|
Decrypts a file This method assumes the required private key is available in the keyring and throws an exception if the private key is not available. To add a private key to the keyring, use the Crypt_GPG::importKey() or Crypt_GPG::importKeyFile() methods.
Parameters:
deletePrivateKey [line 591]
void deletePrivateKey(
string
$keyId)
|
|
Deletes a private key from the keyring If more than one key fingerprint is available for the specified $keyId (for example, if you use a non-unique uid) only the first private key is deleted. Calls GPG with the --delete-secret-key command.
Parameters:
deletePublicKey [line 527]
void deletePublicKey(
string
$keyId)
|
|
Deletes a public key from the keyring If more than one key fingerprint is available for the specified $keyId (for example, if you use a non-unique uid) only the first public key is deleted. The private key must be deleted first or an exception will be thrown. See Crypt_GPG::deletePrivateKey().
Parameters:
encrypt [line 897]
string encrypt(
string
$data, [boolean
$armor = true])
|
|
Encrypts string data Data is ASCII armored by default but may optionally be returned as binary.
Parameters:
encryptFile [line 933]
void|string encryptFile(
string
$filename, [string
$encryptedFile = null], [boolean
$armor = true])
|
|
Encrypts a file Encrypted data is ASCII armored by default but may optionally be saved as binary.
Parameters:
exportPublicKey [line 464]
string exportPublicKey(
string
$keyId, [boolean
$armor = true])
|
|
Exports a public key from the keyring The exported key remains on the keyring. To delete the public key, use Crypt_GPG::deletePublicKey(). If more than one key fingerprint is available for the specified $keyId (for example, if you use a non-unique uid) only the first public key is exported.
Parameters:
getFingerprint [line 816]
string getFingerprint(
string
$keyId, [integer
$format = Crypt_GPG::FORMAT_NONE])
|
|
Gets a key fingerprint from the keyring If more than one key fingerprint is available (for example, if you use a non-unique user id) only the first key fingerprint is returned. Calls the GPG --list-keys command with the --with-fingerprint option to retrieve a public key fingerprint.
Parameters:
getKeys [line 654]
array getKeys(
[string
$keyId = ''])
|
|
Gets the available keys in the keyring Calls GPG with the --list-keys command and grabs keys. See the first section of doc/DETAILS in the GPG package for a detailed description of how the GPG command output is parsed.
Parameters:
handleImportKeyStatus [line 1360]
void handleImportKeyStatus(
string
$line,
&$result)
|
|
Handles the status output from GPG for the import operation This method is responsible for building the result array that is returned from the Crypt_GPG::importKey() method. See doc/DETAILS in the GPG distribution for detailed information on GPG's status output.
Parameters:
handleSignStatus [line 1324]
void handleSignStatus(
string
$line)
|
|
Handles the status output from GPG for the sign operation This method is responsible for sending the passphrase commands when required by the Crypt_GPG::sign() method. See doc/DETAILS in the GPG distribution for detailed information on GPG's status output.
Parameters:
importKey [line 389]
importKeyFile [line 428]
sign [line 1051]
string sign(
string
$data, [boolean
$mode = Crypt_GPG::SIGN_MODE_NORMAL], [boolean
$armor = true])
|
|
Signs data Data may be signed using any one of the three available signing modes:
Parameters:
signFile [line 1104]
void|string signFile(
string
$filename, [string
$signedFile = null], [boolean
$mode = Crypt_GPG::SIGN_MODE_NORMAL], [boolean
$armor = true])
|
|
Signs a file The file may be signed using any one of the three available signing modes:
Parameters:
verify [line 1139]
array verify(
string
$signedData, [string
$signature = ''])
|
|
Verifies signed data The Crypt_GPG::decrypt() method may be used to get the original message if the signed data is not clearsigned and does not use a detached signature.
Parameters:
verifyFile [line 1175]
array verifyFile(
string
$filename, [string
$signature = ''])
|
|
Verifies a signed file The Crypt_GPG::decryptFile() method may be used to get the original message if the signed data is not clearsigned and does not use a detached signature.
Parameters:
Documentation generated on Thu, 22 Jan 2009 21:30:13 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|
|