devjack/encrypted-content-encoding
Composer 安装命令:
composer require devjack/encrypted-content-encoding
包简介
Encrypted Content-Encoding for HTTP (RFC8188)
README 文档
README
Introduction
PHP implementation of RFC8188 to encrypt HTTP messages.
Code Samples
Note: RFC8188 relies heavily on base64 URL encoding.
Simple callback function for encryption key lookup
require_once "vendor/autoload.php"; use Base64Url\Base64Url as b64; $message = "I am the walrus"; $encoded = RFC8188::rfc8188_encode( $message, // plaintext b64::decode("yqdlZ-tYemfogSmv7Ws5PQ"), // encryption key null, // key ID 123 // record size. ); $decoded = RFC8188::rfc8188_decode( $encoded, // data to decode function($keyid) { return b64::decode('yqdlZ-tYemfogSmv7Ws5PQ'); } ); $this->assertEquals($message, $decoded);
Invocable class for key lookup
In this example we use a simple incovable class to provide key lookup. This may be more useful in complex framework integrations such as providing middleware that looks up keys from a database. This sample does not cover service injection to the key lookup class.
use DevJack\EncryptedContentEncoding\RFC8188; use DevJack\EncryptedContentEncoding\Exception\EncryptionKeyNotFound; use Base64Url\Base64Url as b64; class MockKeyLookupProvider { protected $keys = []; public function addKey($key, $keyid='') { $this->keys[$keyid] = $key; } public function __invoke($keyid) { if (in_array($keyid, array_keys($this->keys))) { return $this->keys[$keyid]; } throw new EncryptionKeyNotFound("Encryption key not found."); } } $encoded = b64::decode("uNCkWiNYzKTnBN9ji3-qWAAAABkCYTHOG8chz_gnvgOqdGYovxyjuqRyJFjEDyoF1Fvkj6hQPdPHI51OEUKEpgz3SsLWIqS_uA"); $keyProvider = new MockKeyLookupProvider(); $keyProvider->addKey(b64::decode("BO3ZVPxUlnLORbVGMpbT1Q"), 'a1'); $decoded = RFC8188::rfc8188_decode( $encoded, // data to decode $keyProvider );
Installation
Available via composer.
composer require devjack/encrypted-content-encoding
PHP 5.6 compatibility
Additionally, install a polyfill for random_bytes such as:
composer require paragonie/random_compat
devjack/encrypted-content-encoding 适用场景与选型建议
devjack/encrypted-content-encoding 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.93k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 10 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「middleware」 「encryption」 「encoding」 「rfc8188」 「aes128gcm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 devjack/encrypted-content-encoding 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 devjack/encrypted-content-encoding 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 devjack/encrypted-content-encoding 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
integration of the Panda encoding services into the Symfony2 Framework
FileBundle manages uploads and manipulations of files for the Kitpages CMS Bundle
A simple PHP class to encrypt a string and decrypt an encrypted string
A PHP Framework that allows you to encode and decode arbitrary ASN.1 structures using the ITU-T X.690 Encoding Rules.
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
统计信息
- 总下载量: 5.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-28