Fix certificate handling in OpenSSL