Skip to content

PHP Privacy - The OpenPGP library in PHP language

License

Notifications You must be signed in to change notification settings

lkrempler/php-privacy

 
 

Repository files navigation

PHP Privacy - The OpenPGP library in PHP language

PHP Privacy is an implementation of the OpenPGP standard in PHP language. It implements RFC4880, RFC6637, parts of RFC4880bis.

Requirement

  • PHP 8.1.x or later,
  • phpseclib library provides cryptography algorithms,
  • (optional) PHPUnit to run tests,

Features

Installation

Via Composer

$ composer require php-privacy/openpgp

or just add it to your composer.json file directly.

{
    "require": {
        "php-privacy/openpgp": "*"
    }
}

Basic usage of PHP Privacy

Sign and verify cleartext message

<?php declare(strict_types=1);

require_once 'vendor/autoload.php';

use OpenPGP\OpenPGP;

$armoredPublicKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----';
$armoredPrivateKey = '-----BEGIN PGP PRIVATE KEY BLOCK-----';
$passphrase = 'Your passphrase';

$publicKey = OpenPGP::readPublicKey($armoredPublicKey);
$privateKey = OpenPGP::decryptPrivateKey($armoredPrivateKey, $passphrase);
$cleartextMessage = OpenPGP::createCleartextMessage('Hello, PHP Privacy!');
$signedMessage = $cleartextMessage->sign([$privateKey]);
$verifications = $signedMessage->verify([$publicKey]);

Licensing

BSD 3-Clause

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.

About

PHP Privacy - The OpenPGP library in PHP language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%