mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2026-02-05 05:41:34 +00:00
initial release
This commit is contained in:
parent
43e0364a82
commit
04b0e31929
14 changed files with 1381 additions and 0 deletions
8
examples/clearsign.php
Normal file
8
examples/clearsign.php
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
require_once (dirname(__FILE__)."/main.php");
|
||||
|
||||
$gnupg -> setSignerKey ($fingerprint);
|
||||
$gnupg -> setPassPhrase ($passphrase);
|
||||
$text = $gnupg -> sign ($mailtext);
|
||||
echo $text;
|
||||
?>
|
||||
30
examples/decrypt.php
Normal file
30
examples/decrypt.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
require_once (dirname(__FILE__)."/main.php");
|
||||
|
||||
$mailtext = '
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
Version: GnuPG v1.2.5 (GNU/Linux)
|
||||
|
||||
hQIOA8VdBLDv7dV1EAgAtEMlQ1K/iXYIgPLiojfEhaTOvyEhDjZZ/9Gr5IQ/UvXZ
|
||||
nQW0KYuIpYB8Oe7SC/n3NDqcLuS9Q8GMBgcQjLQKIjEtu0I2xcXATjpNEooKgSqp
|
||||
KxWtoobsPNkCrVyK1dEH911vr/sGcjpiX5L0dYMldq5So45979AaUirpX4pmu7ay
|
||||
1YB81iciq3/KmR+ocOMWzT+v6WJFB0rXSoFc1WiwSiw6TcotXdZA9hAllwaRuBMQ
|
||||
2Vct7/F+dTqZRD4mBt8WiksJFvPm8bb+5p4QVt9eVkuxJv8w7mROVEDFYsDeh8GG
|
||||
FxEzYBr1yv+9DG3Hkmtqk6Ns6VZH4roB9RdwKU2XlggAq/6DiqYnuV9+xuKYvF1G
|
||||
+8X/MWOg2Di6xqe8GqujGmq3ztFb5wNDc+Rp4aW9YgbHHLf9VFc21QAEozjfTe6S
|
||||
hQbcY02UrkJ8bQ4LigWtNnvM3XzQw/J+LQFYij/QogvO3inNVMFd+/WEoJNZ7EMB
|
||||
sE68F32hPsumPhpheyfD19SX2Nejrlaqa4qYCuhNUR0luI4Xti6ymX3jAXJsozNa
|
||||
zP/Ho1T/fCwohyJYaOe7S+u99fcVrchmGP77qiPNQUMsY1LthY1LMihq+0Kd+ORM
|
||||
Hc7HHGvV8/ufIB9WFWNOhQW+gOfIfGzQidLaw+AI7ar68FciKwce9aX99yffVx3U
|
||||
y9JHAWS6GctPfUHl1ZiS/1hq5s7xcWHsh7KTPwv449OsXIWFitnDH6jCL1sqQPjq
|
||||
3pNJXapRMRsyKi60i8jV+KIDl0O0Q9S6eEY=
|
||||
=Rb4q
|
||||
-----END PGP MESSAGE-----
|
||||
|
||||
';
|
||||
|
||||
$gnupg -> setPassPhrase ($passphrase);
|
||||
$plaintext = $gnupg -> decrypt ($mailtext);
|
||||
|
||||
echo "\n".$plaintext."\n";
|
||||
?>
|
||||
7
examples/encrypt.php
Normal file
7
examples/encrypt.php
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
require_once (dirname(__FILE__)."/main.php");
|
||||
|
||||
$gnupg -> setEncryptKey ($fingerprint);
|
||||
$text = $gnupg -> encrypt ($mailtext);
|
||||
echo $text;
|
||||
?>
|
||||
6
examples/keyinfo.php
Normal file
6
examples/keyinfo.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
require_once (dirname(__FILE__)."/main.php");
|
||||
|
||||
$keyinfo = $gnupg -> keyinfo ($fingerprint);
|
||||
print_r($keyinfo)
|
||||
?>
|
||||
9
examples/main.php
Normal file
9
examples/main.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
dl("gnupg.so");
|
||||
|
||||
$fingerprint = "8660281B6051D071D94B5B230549F9DC851566DC";
|
||||
$mailtext = "Test test Test TeSt";
|
||||
$passphrase = "incorrect";
|
||||
|
||||
$gnupg = new gnupg ();
|
||||
?>
|
||||
24
examples/verify.php
Normal file
24
examples/verify.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
require_once (dirname(__FILE__)."/main.php");
|
||||
|
||||
$mailtext = '
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA1
|
||||
|
||||
Test test Test TeSt
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.2.5 (GNU/Linux)
|
||||
|
||||
iD8DBQFDRWw6BUn53IUVZtwRAoVKAJ9P0E0PKcpEuWeHNxgZRbctpETbGQCgv0Nq
|
||||
TmrOEDxc5AihrFREY+IYPp4=
|
||||
=933C
|
||||
-----END PGP SIGNATURE-----
|
||||
';
|
||||
|
||||
$plaintext = false;
|
||||
|
||||
$info = $gnupg -> verify ($mailtext,$plaintext);
|
||||
|
||||
print_r($info);
|
||||
echo "\n".$plaintext."\n";
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue