mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2026-02-04 13:21:34 +00:00
Fix GH-37: decryption of an encrypted empty string returns false (#50)
Closes GH-50
This commit is contained in:
parent
d3bbfee186
commit
c365ff0835
4 changed files with 34 additions and 5 deletions
26
tests/gnupg_oo_encrypt_empty_str.phpt
Normal file
26
tests/gnupg_oo_encrypt_empty_str.phpt
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
--TEST--
|
||||
encrypt and decrypt a text
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->addencryptkey($fingerprint);
|
||||
$enc = $gpg->encrypt("");
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->adddecryptkey($fingerprint, $passphrase);
|
||||
$ret = $gpg->decrypt($enc);
|
||||
var_dump($ret);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(0) ""
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue