openssl_sign() cannot sign a precomputed digest
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 领域
- backend, cryptography, security
调研方向
从 PHP 的 ext/openssl 中的 openssl_sign() 入口点开始,将其当前的摘要处理行为与提到的 EVP_PKEY_sign() 和 EVP_PKEY_verify() API 进行比较。确定一个适用于预计算输入的接口,同时涵盖签名和验证;完成的标准是调用方可以在不再次对现有摘要进行哈希的情况下对其进行签名和验证。
由索引模型根据 Issue 内容生成。
描述
Description
Description
openssl_sign() currently always performs the digest operation internally before signing the data.
This causes a problem when the input is already a precomputed digest.
For example, when a SHA-256 digest is passed to openssl_sign() together with OPENSSL_ALGO_SHA256, the digest is hashed again:
signature = sign(SHA256(precomputed_sha256_digest))
instead of signing the existing digest directly:
signature = sign(precomputed_sha256_digest)
As a result, PHP currently has no straightforward way to sign an already computed digest using ext/openssl.
Expected behavior
It should be possible to pass a precomputed digest to the OpenSSL extension and sign it directly without applying another hashing operation.
The same should be possible for verification of a signature over a precomputed digest.
Actual behavior
openssl_sign() combines hashing and signing. Therefore, when the caller already has the digest, an additional hashing operation is performed.
Additional information
OpenSSL provides lower-level APIs such as EVP_PKEY_sign() and EVP_PKEY_verify() that can operate on already prepared input.
PHP's OpenSSL extension currently does not expose an equivalent way to perform this operation.
PHP Version
PHP 8.5
Operating System
all
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 15 小时
- 30 天内合并 PR
- 103
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
php/php-src 的其他 Issue
-
Bug SAPI: cli_server Status: Verified
难度 2/5 1-3 小时 新手友好度 88/100
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 76/100
-
Bug Status: Needs Triage
难度 1/5 1 小时以内 新手友好度 90/100
-
Bug Status: Needs Triage
难度 2/5 1-3 小时 新手友好度 78/100
-
Bug Category: Tests Status: Verified
难度 2/5 1-3 小时 新手友好度 68/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
zephyrproject-rtos/zephyr#119726 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
api7/lua-resty-saml#63 ·
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
BasedHardware/omi#15320 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 条评论 ·