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 天 17 小時
- 30 天內合併 PR
- 115
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
php/php-src 的其他 Issue
-
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
-
Bug SAPI: fpm Status: Needs Triage
難度 2/5 1-3 小時 新手友好度 65/100
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
bradcypert/plum#53 ·
-
Component: GLib
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 75/100
-
Status: Opened
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 75/100
nextbsd/nextbsd-userland#285 ·