php-privacy/openpgp 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

php-privacy/openpgp

最新稳定版本:2.2.0

Composer 安装命令:

composer require php-privacy/openpgp

包简介

PHP Privacy - The OpenPGP library in PHP language

README 文档

README

PHP Privacy is an implementation of the OpenPGP standard in PHP language. It implements RFC 9580 and provides encryption with public key or symmetric cryptographic algorithms, digital signatures, compression, and key management.

Requirement

  • PHP 8.1.x or later,
  • phpseclib library provides cryptography algorithms,
  • Argon2 for Argon2 string-to-key,
  • (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": "^2.1"
    }
}

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.

统计信息

  • 总下载量: 14.97k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 未知