PKI Tutorials - Herong's Tutorial Examples - v2.32, by Herong Yang
OpenSSL Failing to Verify Server's Certificate
This section provides a tutorial example on how OpenSSL fails to verify HTTPS server's certificate using the 'cafile' SSL context option. The CA certificate can not be found.
The test on https://login.yahoo.com finished nicely in the previous tutorial. Now let's try to play with another HTTPS server, www.google.com:
herong> \local\php\php OpenSSL_HTTPS_file_get_contents_with_CA.php \ https://www.google.com/accounts/ServiceLogin PHP Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:func(144):reason(134) in OpenSSL_HTTPS_file_get_contents_with_CA.php on line 14 PHP Warning: file_get_contents(): Failed to enable crypto in OpenSSL_HTTPS_file_get_contents_with_CA.php on line 14 PHP Warning: file_get_contents( https://www.google.com/accounts/ServiceLogin): failed to open stream: operation failed in OpenSSL_HTTPS_file_get_contents_with_CA.php on line 14
I am not surprised to see these errors:
Table of Contents
Introduction of PKI (Public Key Infrastructure)
Introduction of HTTPS (Hypertext Transfer Protocol Secure)
Using HTTPS with Google Chrome
Using HTTPS with Mozilla Firefox
HTTPS with IE (Internet Explorer)
Android and Server Certificate
Windows Certificate Stores and Console
RDP (Remote Desktop Protocol) and Server Certificate
macOS Certificate Stores and Keychain Access
Perl Scripts Communicating with HTTPS Servers
►PHP Scripts Communicating with HTTPS Servers
Configuring PHP OpenSSL on Windows
Testing OpenSSL with file_get_contents()
SSL Context Options for OpenSSL
Asking OpenSSL to Verify Server's Certificate
►OpenSSL Failing to Verify Server's Certificate
Multiple CA Certificates in a Single File
Testing OpenSSL with fsockopen()
Adding CA Certificates for the PHP Engine
Testing OpenSSL with stream_socket_client()
Java Programs Communicating with HTTPS Servers
.NET Programs Communicating with HTTPS Servers
CAcert.org - Root CA Offering Free Certificates
PKI CA Administration - Issuing Certificates
Comodo Free Personal Certificate
Digital Signature - Microsoft Word
Digital Signature - OpenOffice.org 3