Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

openssl_sign() cannot sign a precomputed digest

未關閉
#23,422 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
45/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
c, php

研究方向

從 PHP 的 ext/openssl 中的 openssl_sign() 進入點開始,將其目前的摘要處理行為與提到的 EVP_PKEY_sign() 和 EVP_PKEY_verify() API 進行比較。確定一個適用於預先計算輸入的介面,同時涵蓋簽署和驗證;完成的標準是呼叫方可以在不再次對現有摘要進行雜湊的情況下對其進行簽署和驗證。

由索引模型根據 Issue 內容生成。

描述

Bug Extension: openssl Status: Verified
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

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

php/php-src 的其他 Issue

查看 php/php-src 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。