mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2026-02-06 06:11:34 +00:00
more tests
removed examples
This commit is contained in:
parent
f98e3c57e4
commit
ba4ad8960b
33 changed files with 478 additions and 121 deletions
22
tests/gnupg_oo_encrypt.phpt
Normal file
22
tests/gnupg_oo_encrypt.phpt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
--TEST--
|
||||
encrypt and decrypt a text
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
$gpg = new gnupg();
|
||||
$gpg -> seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg -> addencryptkey($fingerprint);
|
||||
$enc = $gpg -> encrypt($plaintext);
|
||||
|
||||
$gpg = NULL;
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg -> adddecryptkey($fingerprint, $passphrase);
|
||||
$ret = $gpg -> decrypt ($enc);
|
||||
|
||||
var_dump($ret);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(7) "foo bar"
|
||||
Loading…
Add table
Add a link
Reference in a new issue