php-privacy/openpgp
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
- Support data signing & encryption.
- Support key management: key generation, key reading, key decryption.
- Support public-key algorithms: RSA, ECDSA, EdDSA and ECDH.
- Support symmetric ciphers: Blowfish, Twofish, AES, Camellia.
- Support AEAD ciphers: EAX, OCB, GCM.
- Support hash algorithms: SHA-256, SHA-384, SHA-512, SHA-224, SHA3-256, SHA3-512.
- Support compression algorithms: Zip, Zlib, BZip2.
- Support ECC curves: secp256r1, secp384r1, secp521r1, brainpoolP256r1, brainpoolP384r1, brainpoolP512r1, Curve25519, Curve448, Ed25519, Ed448.
- Support public-key algorithms, symmetric ciphers & hash algorithms for signature verification & message decryption (backward compatibility): DSA, ElGamal, TripleDES, IDEA, CAST5, MD5, SHA-1, RIPEMD-160.
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
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
php-privacy/openpgp 适用场景与选型建议
php-privacy/openpgp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30.16k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2023 年 06 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「library」 「openpgp」 「end to end encryption」 「privacy guard」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 php-privacy/openpgp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 php-privacy/openpgp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 php-privacy/openpgp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Front-end asset upload for user photos, fields, volumes and folders.
Inbox pattern process implementation for your Laravel Applications
A Laravel queue connector to process jobs at the end of the application
Front-end asset upload for fields, volumes and folders.
Front-end asset upload for user photos, fields, volumes and folders.
The (sort of) unausuming front end asset uploader for Craft 3.
统计信息
- 总下载量: 30.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2023-06-05