php8.5
Home/ Manual/ gnupg / functions/ gnupg_decryptverify

gnupg_decryptverify

PHP function Edit on GitHub ✎

(PECL gnupg >= 0.2)

Decrypts and verifies a given text

Description

gnupg_decryptverify(resource $identifier, string $text, string $plaintext): array|false

Decrypts and verifies a given text and returns information about the signature.

Parameters

identifier

Identifier

text

The text being decrypted.

plaintext

The parameter plaintext gets filled with the decrypted text.

Return Values

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

Examples

Procedural gnupg_decryptverify() example

php
<?php
$plaintext = "";
$res = gnupg_init();
gnupg_adddecryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC","test");
$info = gnupg_decryptverify($res,$text,$plaintext);
print_r($info);
?>

OO gnupg_decryptverify() example

php
<?php
$plaintext = "";
$gpg = new gnupg();
$gpg->adddecryptkey("8660281B6051D071D94B5B230549F9DC851566DC","test");
$info = $gpg->decryptverify($text,$plaintext);
print_r($info);
?>

Source: reference/gnupg/functions/gnupg-decryptverify.xml · from the official PHP manual (php/doc-en)