david-maw / StreamSSL

The StreamSSL sample described in CodeProject
Other
48 stars 24 forks source link

Getting server certificate failed #85

Closed prasanthrgb closed 4 years ago

prasanthrgb commented 4 years ago

Hi, I have 'socat' (open ssl server) in linux configured for TLS1.2 and cipher=AES128-SHA.

I am using StreamClient to connect to it. It could connect to server socket and selected client certificate correctly. After that, when StreamClient request for server certificate, the call get failed (refer below WinAPI).

HRESULT hr = g_pSSPI->QueryContextAttributes(m_hContext.getunsaferef(), SECPKG_ATTR_REMOTE_CERT_CONTEXT, hServerCertContext.set());

The error (hr variable) says "Handle Specified is invalid". I tried following to fix issue(as per some website discussion), but it did not fixed them:

  1. Verified that both StreamClient and Server (socat) use same TLS version.
  2. Made sure that Server name is correctly embedded in server certificate.

Do you have any idea on this?

BTW, i really liked your code; written in way for other to understand and use it easily. :)

Thanks, Prasanth

david-maw commented 4 years ago

I replied to your post on CodeProject.