hugoprudente / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

Feature request: Ability to read SSL certificate and key from memory. #385

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently we can specify only file
by using ssl_certificate 
parameter in call to mg_start.

It will be useful for embedding purposes to be able 
to specify certificates by using NULL terminated
character string.

Original issue reported on code.google.com by rusla...@gmail.com on 12 Aug 2012 at 8:43

GoogleCodeExporter commented 9 years ago
Currently, mongoose sends MG_SSL_INIT event when SSL is initializing, passing 
SSL context. Callback is called, then PEM files are loaded.

I can slightly change the logic: if callback returns non-NULL, then PEM files 
would not be loaded by mongoose. It would be a user responsibility to load 
them. User might load PEM files from memory in this case.

Would that be sufficient, or you'd like mongoose to load PEM files from memory? 
In this case, what interface would you like to see?

Original comment by valenok on 12 Aug 2012 at 9:12

GoogleCodeExporter commented 9 years ago
I've done the aforementioned change.
I had to do the same thing, by the way -- to load PEM file from memory.
I've decided that the easiest thing to do is to create a temporary file, write 
PEM into it, start mongoose, and remove the file. Works well for me, you might 
want to do the same.

Original comment by valenok on 22 Sep 2012 at 10:33

GoogleCodeExporter commented 9 years ago
Thanks for your response and execuse me for delay! 
I adapted latest version and everything works. 
I use code from http://stackoverflow.com/a/3812457 to load certificate
from string constant in my code.

However, I made some changes to mongoose so user_data will be passed to 
init_ssl, for obvious reasons.

Original comment by rusla...@gmail.com on 27 Feb 2013 at 7:14

Attachments: