1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 19:23:22 +02:00
Commit Graph

82 Commits

Author SHA1 Message Date
Stefan Roehrich 56b4205f38 MFH: fixed certificate version, serial number not always 0. 2003-07-13 10:13:24 +00:00
foobar 0db5048d6a MFH 2003-06-27 16:42:51 +00:00
SVN Migration 3dbe3deb64 This commit was manufactured by cvs2svn to create branch 'PHP_4_3'. 2003-06-24 15:23:18 +00:00
Ilia Alshanetsky c60c1258e2 Fixed compile warnings. 2003-06-08 23:42:47 +00:00
Wez Furlong 246300a60c Avoid potential segfault when preparing an SSL stream. 2003-05-05 16:30:04 +00:00
Wez Furlong c3d353867a Really fix dll linkage, and fix TSRMLS usage. 2003-05-01 10:44:18 +00:00
Wez Furlong 87eaeb5363 Fix win32 build of shared openssl extension. 2003-04-29 13:48:06 +00:00
Ilia Alshanetsky f15b229e55 MFH 2003-04-28 22:42:36 +00:00
Wez Furlong 71a63bc126 Fix the lack of SSL certificate verification support for ssl:// sockets and
https:// streams.

This code is essential for people writing secure applications in order to avoid
man-in-the-middle attacks, and is thus regarded as a bug fix.

It is, however, optional; you need to explicitly turn on the verification
functionality, as it depends on you to specify your trusted certificate chain.

This sample demonstrates a secured https:// request, making use of the CA
bundle provided by curl:

<?php
$ctx = stream_context_create();
// Turn on verification
stream_context_set_option($ctx, "ssl", "verify_peer", true);
// Set the CA bundle (trusted certificate chain)
stream_context_set_option($ctx, "ssl", "cafile",
	"/usr/local/share/curl/curl-ca-bundle.crt");
$fp = fopen("https://www.zend.com", "rb", false, $ctx);
?>

This sample demonstrates how to roll your own https:// request, and specify a
certificate to use for authentication; the local_cert and passphrase options
will also work for fopen().

<?php
$ctx = stream_context_create();
stream_context_set_option($ctx, "ssl", "verify_peer", true);
stream_context_set_option($ctx, "ssl", "cafile",
	"/usr/local/share/curl/curl-ca-bundle.crt");

// set local cert.  it MUST be a PEM encoded file containing the certificate
// AND your private key.  It can also contain the certificate chain of issuers.
stream_context_set_option($ctx, "ssl", "local_cert", "/path/to/my/cert.pem");
stream_context_set_option($ctx, "ssl", "passphrase", "secret!");

// Set the common name that we are expecting; PHP will perform limited wildcard
// matching.  If the CN does not match this, the connection attempt will fail.
// The value to specify will always be the same as the Host: header you specify.
stream_context_set_option($ctx, "ssl", "CN_match", "secure.sample.domain");

$ssl = fsockopen("ssl://secure.sample.domain", 443, $errno, $errstr, 10, $ctx);

if ($ssl) {
	fwrite($ssl, "GET / HTTP/1.0\r\nHost: secure.sample.domain\r\n\r\n");
	fpassthru($ssl);
}

?>
2003-04-26 21:34:49 +00:00
David Hill 45a1a3037a 64-bit correction to variables passed to zend_parse_parameters
@64-bit correction to variables passed to zend_parse_parameters (Dave)
2003-03-07 13:42:30 +00:00
Ilia Alshanetsky 43e6623c3d MFH 2003-01-31 22:27:28 +00:00
Sebastian Bergmann ec46829b38 MFH: Bump year. 2002-12-31 16:37:36 +00:00
Ilia Alshanetsky 58613036fb Fixed ZTS build. 2002-12-12 18:36:44 +00:00
Wez Furlong e651db5cf1 MFH more entropy "fix" 2002-12-12 15:51:11 +00:00
Marcus Boerger e549631cee MFH 2002-12-12 14:16:16 +00:00
Wez Furlong a50bd94a0e MFH #20936 fix 2002-12-12 13:46:29 +00:00
Marcus Boerger 16eac635ae MFH: ws, php_error_docref, typeconversion for cygwin 2002-12-12 13:21:25 +00:00
Wez Furlong bd77e7d0f8 No longer experimental. 2002-12-10 22:20:55 +00:00
Wez Furlong 5d9bc065f5 Fix proto and avoid potential segfault on an error. 2002-12-10 22:04:44 +00:00
Edin Kadribasic a2c170e296 Fixed windows build. Symbol PHP_EXPORTS is a no-no for dynamically
linked extensions.
2002-11-11 16:11:32 +00:00
Ilia Alshanetsky cc85828811 Fixed bug #19935. Made OpenSSL file system operations abide by safe_mode
& open_basedir restrictions.
2002-11-10 05:19:40 +00:00
Wez Furlong 0c7a386b3e correct proto 2002-08-10 20:19:49 +00:00
Wez Furlong 9eb215511f syntax highlighting for vim 2002-08-09 20:56:52 +00:00
foobar 36fbe5c933 Fixed bug: #18295. e_os.h is not supposed to be included.. 2002-07-12 21:46:36 +00:00
foobar ce379abfbd Fixed bug: #17751 (typo) 2002-06-13 19:41:25 +00:00
Wez Furlong 7ae1630a97 proto tweak 2002-05-17 12:42:40 +00:00
Wez Furlong 3a68052828 Fix for #16885 2002-05-01 08:22:17 +00:00
Wez Furlong f571438d7a Probable fix for #16940. 2002-05-01 07:50:13 +00:00
Yasuo Ohgaki fe6990cc6b Remove compiler warnings 2002-04-19 07:56:41 +00:00
Wez Furlong 4df5076d2f fix build with ZE2 2002-04-12 19:26:08 +00:00
Wez Furlong 959021a8c9 Add subject hash to parsed x509 data.
Make the test use file_get_contents().
2002-03-28 00:56:19 +00:00
Wez Furlong 74749ad642 Fix regular openssl_pkey_get_private($content, $phrase) syntax and
add test case.
This stuff should be merged into the 4.2 branch.
2002-03-26 00:03:11 +00:00
foobar 4a0291d238 - Make it possible to build ext/openssl as shared extension 2002-03-20 02:07:11 +00:00
Sascha Schumann 5cba3a99c2 extension converted automatically to PHP_NEW_EXTENSION. Manually confirmed 2002-03-12 16:44:00 +00:00
Sebastian Bergmann 90613d2282 Maintain headers. 2002-02-28 08:29:35 +00:00
Derick Rethans d26afcf366 - Fix for openssl_pkcs7_sign segfaults
(patch by Christian Stocker <chregu@php.net>)
2002-01-31 09:57:28 +00:00
Sebastian Bergmann 38933514e1 Update headers. 2001-12-11 15:32:16 +00:00
Hartmut Holzgraefe 94737d086f proto fix 2001-12-07 07:27:00 +00:00
Hartmut Holzgraefe 250aded265 proto fixes 2001-12-06 17:51:48 +00:00
foobar f1397d5339 Unified the configure messages. 2001-11-30 19:00:13 +00:00
Stig Bakken 689252082c * zend_module_entry change: apino, debug and zts are moved first,
see README.EXTENSIONS file for upgrade help.
@Introduced extension version numbers (Stig)
2001-10-11 23:33:59 +00:00
Daniel Beulshausen 1ac3aa7e08 nuke unnecessary force-by-ref declarations + name the needed in a proper way 2001-10-05 15:56:42 +00:00
Daniel Beulshausen 377d88cec0 use maxpathlen instead of path_max 2001-10-04 20:10:58 +00:00
Stig Venaas b055912861 Didn't compile, replaced some TSRMLS_C with TSRMLS_CC 2001-09-30 13:30:18 +00:00
Jeroen van Wolffelaar c033288573 Back-substitute for Z_* macro's. If it breaks some extension (the script isn't optimal, it parses for example var->zval.value incorrect) please let me know. 2001-09-25 21:58:48 +00:00
Egon Schmid 88713e4d8d Fixed some protos. Haven't read the source code, so some protos could be wrong. bool notext=true looks very strange to me. 2001-09-11 01:03:59 +00:00
Wez Furlong 671b46a0db Revise the xxx_export api so that exporting to files is comfortable. 2001-09-11 00:33:25 +00:00
Wez Furlong 0f835fdf28 Arrrgghh!
Fix munched file.
# Dunno how that happened.
2001-09-11 00:03:58 +00:00
Wez Furlong 3b8f3cc439 Added some preliminary x509 cert and csr creation/signing functions.
Also, some problems with CGI initialization should be eliminated.
Renamed some pkey functions to be more consistent.
# Added aliases for older names; not sure if we should keep those.
2001-09-10 23:57:10 +00:00
Daniel Beulshausen 87d7284e46 don't forget TSRMLS_CC when using zend_parse_parameters 2001-09-10 14:30:10 +00:00