SSL context options for in memory cert and pk
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C
- Sterne
- 40.4k
- Forks
- 8.1k
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 96
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit den SSL-Optionen von stream_context_create, insbesondere local_cert und local_pk, und vergleiche deren aktuelle Handhabung von Dateipfaden mit der hier gezeigten Ausgabe von openssl_pkcs12_read. Ermittle die unterstützte Darstellung und ergänze Tests, die das Laden von Zertifikat und privatem Schlüssel ohne temporäre Dateien belegen; abgeschlossen ist die Aufgabe, wenn das bereitgestellte Beispiel auf allen Plattformen funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- c, php
- Bereich
- networking, security
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100