class gnupg (View source)

GNUPG Encryption Class

Constants

SIG_MODE_NORMAL

SIG_MODE_DETACH

SIG_MODE_CLEAR

VALIDITY_UNKNOWN

VALIDITY_UNDEFINED

VALIDITY_NEVER

VALIDITY_MARGINAL

VALIDITY_FULL

VALIDITY_ULTIMATE

PROTOCOL_OpenPGP

PROTOCOL_CMS

SIGSUM_VALID

SIGSUM_GREEN

SIGSUM_RED

SIGSUM_KEY_REVOKED

SIGSUM_KEY_EXPIRED

SIGSUM_SIG_EXPIRED

SIGSUM_KEY_MISSING

SIGSUM_CRL_MISSING

SIGSUM_CRL_TOO_OLD

SIGSUM_BAD_POLICY

SIGSUM_SYS_ERROR

ERROR_WARNING

ERROR_EXCEPTION

ERROR_SILENT

PK_RSA

PK_RSA_E

PK_RSA_S

PK_DSA

PK_ELG

PK_ELG_E

PK_ECC

PK_ECDSA

PK_ECDH

PK_EDDSA

Methods

__construct($options = null)

No description

bool
adddecryptkey(string $kye, string $passphrase)

Add a key for decryption

array|false
verify(string $text, string $signature, string $plaintext = null)

Verifies a signed text

bool
addencryptkey(string $kye)

Add a key for encryption

bool
addsignkey(string $kye, string $passphrase = null)

Add a key for signing

deletekey($kye, $allow_secret)

No description

gettrustlist($pattern)

No description

listsignatures($kyeid)

No description

bool
cleardecryptkeys()

Removes all keys which were set for decryption before

bool
clearencryptkeys()

Removes all keys which were set for encryption before

bool
clearsignkeys()

Removes all keys which were set for signing before

string|false
decrypt(string $enctext)

Decrypts a given text

array|false
decryptverify(string $enctext, string $plaintext)

Decrypts and verifies a given text

string|false
encrypt(string $text)

Encrypts a given text

string|false
encryptsign(string $text)

Encrypts and signs a given text

string|false
export(string $pattern)

Exports a key

string|false
geterror()

Returns the errortext, if a function fails

int
getprotocol()

Returns the currently active protocol for all operations

array|false
import(string $kye)

Imports a key

array
keyinfo(string $pattern, $secret_only = false)

Returns an array with information about all keys that matches the given pattern

bool
setarmor(int $armor)

Toggle armored output

void
seterrormode(int $errnmode)

Sets the mode for error_reporting

bool
setsignmode(int $signmode)

Sets the mode for signing

string|false
sign(string $text)

Signs a given text

array
getengineinfo()

Returns the engine info

array
geterrorinfo()

Returns the error info

Details

__construct($options = null)

No description

Parameters

$options

bool adddecryptkey(string $kye, string $passphrase)

Add a key for decryption

Parameters

string $kye
string $passphrase

Return Value

bool

array|false verify(string $text, string $signature, string $plaintext = null)

Verifies a signed text

Parameters

string $text
string $signature
string $plaintext

Return Value

array|false

On success, this function returns information about the signature. On failure, this function returns false.

bool addencryptkey(string $kye)

Add a key for encryption

Parameters

string $kye

Return Value

bool

bool addsignkey(string $kye, string $passphrase = null)

Add a key for signing

Parameters

string $kye
string $passphrase

Return Value

bool

deletekey($kye, $allow_secret)

No description

Parameters

$kye
$allow_secret

gettrustlist($pattern)

No description

Parameters

$pattern

listsignatures($kyeid)

No description

Parameters

$kyeid

bool cleardecryptkeys()

Removes all keys which were set for decryption before

Return Value

bool

bool clearencryptkeys()

Removes all keys which were set for encryption before

Return Value

bool

bool clearsignkeys()

Removes all keys which were set for signing before

Return Value

bool

string|false decrypt(string $enctext)

Decrypts a given text

Parameters

string $enctext

Return Value

string|false

On success, this function returns the decrypted text. On failure, this function returns false.

array|false decryptverify(string $enctext, string $plaintext)

Decrypts and verifies a given text

Parameters

string $enctext
string $plaintext

Return Value

array|false

On success, this function returns information about the signature and fills the parameter with the decrypted text. On failure, this function returns false.

string|false encrypt(string $text)

Encrypts a given text

Parameters

string $text

Return Value

string|false

On success, this function returns the encrypted text. On failure, this function returns false.

string|false encryptsign(string $text)

Encrypts and signs a given text

Parameters

string $text

Return Value

string|false

On success, this function returns the encrypted and signed text. On failure, this function returns false.

string|false export(string $pattern)

Exports a key

Parameters

string $pattern

Return Value

string|false

On success, this function returns the keydata. On failure, this function returns false.

string|false geterror()

Returns the errortext, if a function fails

Return Value

string|false

Returns an errortext, if an error has occurred, otherwise false.

int getprotocol()

Returns the currently active protocol for all operations

Return Value

int

Returns the currently active protocol, which can be one of or .

array|false import(string $kye)

Imports a key

Parameters

string $kye

Return Value

array|false

On success, this function returns and info-array about the importprocess. On failure, this function returns false.

array keyinfo(string $pattern, $secret_only = false)

Returns an array with information about all keys that matches the given pattern

Parameters

string $pattern
$secret_only

Return Value

array

Returns an array with information about all keys that matches the given pattern or false, if an error has occurred.

bool setarmor(int $armor)

Toggle armored output

Parameters

int $armor

Return Value

bool

void seterrormode(int $errnmode)

Sets the mode for error_reporting

Parameters

int $errnmode

Return Value

void

bool setsignmode(int $signmode)

Sets the mode for signing

Parameters

int $signmode

Return Value

bool

string|false sign(string $text)

Signs a given text

Parameters

string $text

Return Value

string|false

On success, this function returns the signed text or the signature. On failure, this function returns false.

array getengineinfo()

Returns the engine info

Return Value

array

array geterrorinfo()

Returns the error info

Return Value

array