You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by i0...@sneakemail.com on 2006/12/09 23:31:57 UTC

How to get mod_ssl's SSL_CTX from another module?

I need to use SSL's crypto lib functions to decrypt (using RSA) in another module.

I see that I need to use the SSL_CTX and/or SSL structures to do this.

I assume that I don't call 
  SSL_CTX_new() 
to get the SSL_CTX, it looks like one-time-only, and I assume it's already been done since mod-ssl is loaded.

So, how do I get the current SSL_CTX (and/or SSL) structure?

Proposed calling sequence is below.

Thanks,
Andy
---------

SSL *ssl;
SSL_CTX *ctx;

<ctx = current SSL_CTX, somehow>

SSL_CTX_use_RSAPrivateKey_file(ctx, ...)
ssl = SSL_new(ctx);
pKey = SSL_get_privatekey(ssl);
RSA_private_decrypt(..., ..., ..., pKey->pkey.rsa, ...)