mnavarrocarter/fernet
Composer 安装命令:
composer require mnavarrocarter/fernet
包简介
A modern implementation of Fernet crypto for PHP
README 文档
README
Exchange strong encrypted messages effectively and privately between two parties.
Install
composer require mnavarrocarter/fernet
Usage
It's really easy to get started:
// Instantiate the Fernet class using the static factory and passing the base64url encoded key. $fernet = MNC\Fernet::create('cw_0x689RpI-jtRR7oE8h_eQsKImvJapLeSbXpwF4e4='); // Then, you can encode messages with your fernet instance $token = $fernet->encode('hello'); // You can then decrypt that token back to the original message $message = $fernet->decode($token);
What is Fernet?
Fernet is a recent not so recent specification for encrypting a message and encode
it into a secure token with established security practices like block sizing, padding and
signature hashing.
Encryption is symmetric using a secret of 32 bytes.
You can read more details about the specification here.
Why Fernet?
Mainly for three reasons:
Security: The spec has been defined by cryptographers, not developers, with well-known, long-established security practices like message padding, standard block sizing, and signature verification before decryption.
Evolvavility: Every token has a version (the current and only version of Fernet is 0x80). The implementations look at the version to decide how the token will be handled. It's not the user who defines then a set of algorithms, but the spec version. Should common nowadays algorithms become more prone to breaking due advancements in computing power, Fernet can solve this easily by rolling a new version of the Spec.
Convenience: Depending on the message, Fernet tokens can be small. They can fit cookie size constraints easily, can be pasted in urls easily too, and shared in requests headers or bodies without a problem.
Fernet VS JOSE
Fernet solves all the problems existing with current "industry-standard" solutions for message-exchanging, like the JOSE standards.
I could go on lengthy here, but if you are interested to know why, you can take a look at this article.
mnavarrocarter/fernet 适用场景与选型建议
mnavarrocarter/fernet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.14k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2020 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mnavarrocarter/fernet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mnavarrocarter/fernet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12.14k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-20