mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2026-02-07 06:41:34 +00:00
Refactore all test to be independent
This commit is contained in:
parent
3bb4d28798
commit
4aabe3c966
26 changed files with 306 additions and 108 deletions
|
|
@ -4,19 +4,19 @@ encryptsign and decryptverify a text
|
|||
<?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);
|
||||
$gpg -> addsignkey($fingerprint, $passphrase);
|
||||
$enc = $gpg -> encryptsign($plaintext);
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->addencryptkey($fingerprint);
|
||||
$gpg->addsignkey($fingerprint, $passphrase);
|
||||
$enc = $gpg->encryptsign($plaintext);
|
||||
|
||||
$gpg = NULL;
|
||||
$plaintext = false;
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg -> adddecryptkey($fingerprint, $passphrase);
|
||||
$ret = $gpg -> decryptverify ($enc, $plaintext);
|
||||
$gpg->adddecryptkey($fingerprint, $passphrase);
|
||||
$ret = $gpg->decryptverify ($enc, $plaintext);
|
||||
|
||||
var_dump($ret);
|
||||
var_dump($plaintext);
|
||||
|
|
@ -38,3 +38,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue