DontPanic
DontPanic

Reputation: 2406

Are certificates required for client-only SSL/TLS apps?

I am trying to develop a minimal client-only SSL/TLS app to connect to an https server. It always fails on on 'SSL_connect(). I haven't installed any certificates.
Are certicates required in such a case?
I've found many answers on SO and elsewhere that say NO with the caveat "unless required by the server".

Details:

Code Synopsis:

Upvotes: 0

Views: 202

Answers (2)

DontPanic
DontPanic

Reputation: 2406

Well, simple answer to my problem. Turns out there was a problem with the server I was testing against. When I tried to connect to another, e.g., "feistyduck.com" or "google.com" on port 443, all was good.

Upvotes: 0

dave_thompson_085
dave_thompson_085

Reputation: 38781

"no Applink" explains the failure -- even though it caused ERR_print_errors_fp to also fail.

On Windows to pass opened files or sockets from your exe to the OpenSSL library if linked as DLL (which is the default, but overridable) you must compile and link into your application exe the supplied file include/openssl/applink.c (note .c not .h -- it's an include file but not a header file). See https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_Applink.html (though it's brief; I'm sure I've seen a better explanation somewhere, decades ago, but I can't find it now).

On MSVC I think you can just 'add' this file, or a copy, to your project and it will get compiled and linked automatically, but I no longer use it myself and can't verify. You may need to #include the file somewhere appropriate, like your main.c .

Upvotes: 0

Related Questions