s_client certificate validation fails in Windows for login.live.com


I downloaded <a href="http://slproweb.com/download/Win32OpenSSL_Light-1_0_2.exe" rel="nofollow">Win32OpenSSL_Light-1_0_2.exe</a> from <a href="http://slproweb.com/products/Win32OpenSSL.html" rel="nofollow">Shining Light Productions</a> and installed it to the default location C:\OpenSSL-Win32. I copied the file <a href="https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt" rel="nofollow">ca-bundle.crt</a> to C:\OpenSSL-Win32\bin and ran:

C:\OpenSSL-Win32\bin>openssl s_client -connect login.live.com:443 -CAfile ca-bundle.crt

The verification of the certificate chain fails with the message:

Verify return code: 20 (unable to get local issuer certificate)

Using the same command with the same <a href="https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt" rel="nofollow">ca-bundle.crt</a> file on Debian Wheezy with OpenSSL version 1.0.1e returns:

Verify return code: 0 (ok)

If I change the hostname to api.onedrive.com (same command) I get Verify return code: 0 (ok) on both, Windows and Linux.

Am I doing something wrong or is there a known bug? How can i get it to work on Windows for login.live.com?

(Initially I stumbled upon this problem when <a href="https://stackoverflow.com/questions/29106240/how-to-verify-login-live-com-ssl-certificate-with-curl-php-and-windows-xampp" rel="nofollow">trying to connect to login.live.com with PHP's cURL extension under Windows XAMPP</a>, but now it looks more like an OpenSSL issue.)


s_client has the undocumented property (or probably more a long standing bug), that if you give a -CAfile option it will not only check against the given CA file but also against the systems default (/usr/lib/ssl/certs on Debian). If you run openssl s_client with strace to check out which files are used during the verification you will see the following:

$ strace -e open openssl s_client -connect login.live.com:443 -CAfile ca-bundle.crt ... open("ca-bundle.crt", O_RDONLY) = 3 open("/usr/lib/ssl/cert.pem", O_RDONLY) = -1 ENOENT (No such file or directory) ... open("/usr/lib/ssl/certs/415660c1.0", O_RDONLY) = 4 open("/usr/lib/ssl/certs/415660c1.1", O_RDONLY) = 4

From this output you can see that it not only uses the given CA file for verification but also tries to use /usr/lib/ssl/cert.pem (does not exist) and then looks into /usr/lib/ssl/certs to find the required CA by the subject hash 415660c1. There it finally finds the root CA it is looking for in 415660c1.1:

$ openssl x509 -in /usr/lib/ssl/certs/415660c1.1 -text ... Issuer: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority ... Subject: C=US, O=VeriSign, Inc., OU=Class 3 Public Primary Certification Authority

Since there are no system defaults on Windows usable by OpenSSL (it can not use the Windows CA store) the verification will fail there.

As for api.onedrive.com: this has another trust chain and can fully be verified with the given CA bundle. The output from strace shows that it does not try to access any files inside /usr/lib/ssl/certs.


  • Update failed of file descriptor limit
  • Opening Local File Works with urllib but not with urllib2
  • How to create a PKCS12 compatible with iOS's Multipeer Connectivity with node-forge?
  • How export all my certificates of software separately to a .pfx file?
  • Export Certificate with private key including all certificates in path using powershell
  • unsupported response type in oauth [duplicate]
  • Key with alias xxx doesn't have a private key with Spring SAML
  • AngularJS two http get in one controller make problems
  • How java jackson deserializer handle both Boolean and Object on same field
  • Hash UUIDs without requiring ordering
  • Using Reactive Extension for certain KeyPress sequences?
  • Building Yocto image for DragonBoard 410c, how to build Chromium
  • Android signing problem
  • Is there a better way to do an “unravel” function in python?
  • How to write an install script for ubuntu
  • How can I check the type of the next element?
  • What is the best Linux distro to work with Ruby on Rails? [closed]
  • Get the negative of an Optional Chain
  • Google Bigquery Command Line Return Limit
  • Unable to set a breakpoint on main while debugging a program compiled with Rust 1.10 with GDB
  • How to get current document uri in XSLT?
  • ADO and msqli connections very slow
  • PHP buffered output depending on server setting?
  • Bad request using file_get_contents for PUT request in PHP
  • OpenGL 3.3 on Mac OSX El Capitan with LWJGL
  • When to use `image` and when to use `Matrix` in Emgu CV?
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Uncaught Error: Could not find module `ember-load-initializers`
  • How do I fake an specific browser client when using Java's Net library?
  • Accessing IRQ description array within a module and displaying action names
  • SSO with signing and signature validation doesn't work
  • Running a C# exe file
  • Deserializing XML into class C#
  • Apache 2.4 - remove | delete | uninstall
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • How to include full .NET prerequisite for Wix Burn installer
  • Getting Messege Twice Using IMvxMessenger
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • costura.fody for a dll that references another dll
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize