Класс для работы с GPG из PHP http://php-gnupg.blindage.org/
php
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vladimir Smagin e186aa5ee5 README.md 2 months ago
README.md README.md 2 months ago
gnupgsimple.php copyrights 2 years ago

README.md

GnuPG (GPG) and mailer PHP class.

Supports:

  • encrypt and decrypt
  • sign and verify
  • mail
  • accept stdin

Download

git clone https://git.blindage.org/21h/phpgnupgsimple.git

Usage

Encryption of stdin example:

    <?php 
    require "/opt/phpGnupgSimple/gnupgsimple.php"; 
    $stdin=""; 
    $options=getopt('m:s:'); 
     
    while($f = fgets(STDIN)){ 
        $stdin.=$f; 
    } 
     
    $pubkey=file_get_contents('BORODA.asc'); 
    $gpg = new GnupgSimple($pubkey, '', ''); 
    $encrypted = $gpg->encrypt($stdin); 
    $gpg->mail($options['m'], 'root@blindage.org', $options['s'], $encrypted);  
    ?>

You can use it to encrypt cron logs:

MAILTO=""
0 1 * * * root /opt/backup.sh|/usr/sbin/php /opt/mailgpg.php -m 21h@blindage.org -s "secret server report"