Class: Crypt_GPG
Source Location: /Crypt_GPG-0.7.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(
[array
$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 gpgBinary
- 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.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 1200]
void addDecryptKey(
mixed
$key, [string
$passphrase = null])
|
|
Adds a key to use for decryption
Parameters:
addEncryptKey [line 1222]
void addEncryptKey(
mixed
$key)
|
|
Adds a key to use for encryption
Parameters:
addSignKey [line 1249]
void addSignKey(
mixed
$key, [string
$passphrase = null])
|
|
Adds a key to use for signing
Parameters:
clearDecryptKeys [line 1265]
Clears all decryption keys
clearEncryptKeys [line 1281]
Clears all encryption keys
clearSignKeys [line 1297]
decrypt [line 965]
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 1008]
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 590]
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 526]
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 895]
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 931]
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 463]
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 814]
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 653]
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 1356]
void handleImportKeyStatus(
string
$line, array
&$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 <strong>doc/DETAILS</strong> in the GPG distribution for detailed info on GPG's status output.
Parameters:
handleSignStatus [line 1320]
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 <strong>doc/DETAILS</strong> in the GPG distribution for detailed info on GPG's status output.
Parameters:
importKey [line 389]
importKeyFile [line 427]
sign [line 1049]
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 1102]
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 1137]
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 1173]
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 Mon, 11 Mar 2019 15:25:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|
|