|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #81703 stream_context_create - SSL context options
Submitted: 2021-12-19 18:30 UTC Modified: 2021-12-19 22:03 UTC
From: bugzilla77 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Streams related
PHP Version: 8.1.1 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: bugzilla77 at gmail dot com
New email:
PHP Version: OS:


 [2021-12-19 18:30 UTC] bugzilla77 at gmail dot com
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.

Test script:
// Using string content
// --------------------


$stream_context = stream_context_create(
[ 'ssl' => [ 'local_cert' => $certificates['cert'],
             'local_pk'   => $certificates['pkey']

// Using Data URLs
// ---------------


$stream_context = stream_context_create(
[ 'ssl' => [ 'local_cert' => 'data:,'.$certificates['cert'],
             'local_pk'   => 'data:,'.$certificates['pkey']

// Hack: temp files
// ----------------



$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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-12-19 22:03 UTC]
-Status: Open +Status: Closed -Type: Security +Type: Feature/Change Request -Assigned To: +Assigned To: cmb
 [2021-12-19 22:03 UTC]
This is not a security issue, but rather a feature request.
Closing as duplicate of <>.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 14 16:01:33 2024 UTC