GnuPG 函数
注释
This extension makes use of the keyring of the current user. This keyring is normally located in ~./.gnupg/. To specify a custom location, store the path to the keyring in the environment variable GNUPGHOME. See putenv for more information how to do this.
Some functions require the specification of a key. This specification can be anything that refers to a unique key (userid, key-id, fingerprint, ...). This documentation uses the fingerprint in all examples.
注意:
As alternative to the explicitly documented functions using resources, you can also use an object-oriented style using gnupg objects.
目录
- gnupg_adddecryptkey — Add a key for decryption
- gnupg_addencryptkey — Add a key for encryption
- gnupg_addsignkey — Add a key for signing
- gnupg_cleardecryptkeys — Removes all keys which were set for decryption before
- gnupg_clearencryptkeys — Removes all keys which were set for encryption before
- gnupg_clearsignkeys — Removes all keys which were set for signing before
- gnupg_decrypt — Decrypts a given text
- gnupg_decryptverify — Decrypts and verifies a given text
- gnupg_deletekey — Delete a key from the keyring
- gnupg_encrypt — Encrypts a given text
- gnupg_encryptsign — Encrypts and signs a given text
- gnupg_export — Exports a key
- gnupg_getengineinfo — Returns the engine info
- gnupg_geterror — Returns the errortext, if a function fails
- gnupg_geterrorinfo — Returns the error info
- gnupg_getprotocol — Returns the currently active protocol for all operations
- gnupg_gettrustlist — Search the trust items
- gnupg_import — Imports a key
- gnupg_init — Initialize a connection
- gnupg_keyinfo — Returns an array with information about all keys that matches the given pattern
- gnupg_listsignatures — List key signatures
- gnupg_setarmor — Toggle armored output
- gnupg_seterrormode — Sets the mode for error_reporting
- gnupg_setsignmode — Sets the mode for signing
- gnupg_sign — Signs a given text
- gnupg_verify — Verifies a signed text
add a note
User Contributed Notes 2 notes
phplist2REMOVE AT REMtincanOVE.co.uk ¶
15 years ago
There's a function/method missing in the list.
gnupg_deletekey
(no version information, might be only in CVS)
gnupg_deletekey -- Delete a key
Description
bool gnupg_deletekey ( resource identifier, string key, [bool allowsecret] )
Deletes the key from the keyring. If allowsecret is not set or FALSE it will fail on deleting secret keys.
Return Values
On success, this function returns TRUE. On failure, this function returns FALSE.
Examples
Example 1. Procedural gnupg_deletekey() example
<?php
$res = gnupg_init();
gnupg_deletekey($res,"8660281B6051D071D94B5B230549F9DC851566DC");
?>
Example 2. OO gnupg_deletekey() example
<?php
$gpg = new gnupg();
$gpg -> deletekey("8660281B6051D071D94B5B230549F9DC851566DC");
?>
web at rlauzier dot com ¶
8 years ago
The function for listing all key signatures is also missing from the list...
gnupg_listsignatures
Examples:
$gpg = new gnupg();
$result = $gpg->listsignatures($fingerprint);
$gpg = gnupg_init();
$result = gnupg_listsignatures($gpg, $fingerprint);