SSL context options for in memory cert and pk
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.1k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
It is dangerous to store certificates and privateKeys (without a password) on the disk. Unfortunately, this is needed to load the * .p12 file into stream_context_create.
Please, add the option to set certificates and privateKeys from string content or at least from Data URLs, instead the file path only.
// Using string content
// --------------------
openssl_pkcs12_read(file_get_contents('cert.p12'),$certificates,'pass');
$stream_context = stream_context_create(
[ 'ssl' => [ 'local_cert' => $certificates['cert'],
'local_pk' => $certificates['pkey']
]
]);
// Using Data URLs
// ---------------
openssl_pkcs12_read(file_get_contents('cert.p12'),$certificates,'pass');
$stream_context = stream_context_create(
[ 'ssl' => [ 'local_cert' => 'data:,'.$certificates['cert'],
'local_pk' => 'data:,'.$certificates['pkey']
]
]);
// Hack: temp files
// ----------------
openssl_pkcs12_read(file_get_contents('cert.p12'),$certificates,'pass');
file_put_contents('cert.temp',$certificates['cert']);
file_put_contents('pkey.temp',$certificates['pkey']);
$stream_context = stream_context_create(
[ 'ssl' => [ 'local_cert' => 'cert.temp',
'local_pk' => 'pkey.temp'
]
]);
Expected result: Reading certificates and privateKeys without temp files.
Actual result: Reading certificates and privateKeys only with temp files.
PHP Version
PHP 8.1.1
Operating System
All
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
stream_context_create の SSL オプション、特に local_cert と local_pk から始め、現在のファイルパス処理を、ここに示されている openssl_pkcs12_read の出力と比較します。サポートされている表現を特定し、一時ファイルを使わずに証明書と秘密鍵を読み込めることを示すテストカバレッジを追加します。提供された例がすべてのプラットフォームで動作すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- networking, security
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100