On Fri, 27 Dec 2013 11:42:08 GMT, Stephan Dilly wrote:

On Fri, 27 Dec 2013 10:43:12 +0100, Sönke Ludwig wrote:

Am 27.12.2013 03:33, schrieb Stephan Dilly:

On Fri, 27 Dec 2013 02:30:54 GMT, Stephan Dilly wrote:

http://vibed.org/api/vibe.stream.ssl/
you show above how to create an ssl server using cert/key. now i have an ssl server (apple push service) that needs me to use cert/key even when connecting to them. do i have to do something different there cause simply providing it like in the server-listen example gives me zero as a return from SSL_connect() in SSLStream and 5 from ERR_get_error() ...

but i must confess, i am a total ssl noob

auto conn = connectTCP(m_options.address, m_options.port);
auto sslctx = new SSLContext(m_options.cert, m_options.key);
auto stream = new SSLStream(conn, sslctx, SSLStreamState.connecting);

this is what it looks like on my site right now...

This is also what I'd expect to work. When enforceSSL throws, do you
get a usable, human readable error message?

No it just prints:

object.Exception@C:\Users\Stephan\AppData\Roaming\dub\packages\vibe-d-0.7.18\source\vibe\stream\ssl.d(225): Failed to connect SSL tunnel.: 1

Ok now I changed enforceSSL to:

if( ret <= 0 ){
	char[120] ebuf;
	auto eCode = ERR_get_error();
	while(eCode != 0){
		ERR_error_string(eCode, ebuf.ptr);
		logError("ERR: '%s'", ebuf);

		eCode = ERR_get_error();
	}
	
	auto errmsg = to!string(SSL_get_error(m_ssl, ret));
	throw new Exception(message~": "~errmsg);
}
return ret;

Now it prints:

ERR: 'error:140C5042:SSL routines:SSL_UNDEFINED_FUNCTION:called a function you should not call                                '
object.Exception@C:\Users\Stephan\AppData\Roaming\dub\packages\vibe-d-0.7.18\source\vibe\stream\ssl.d(231): Failed to connect SSL tunnel.: 5

Any ideas ??