[SERVER] ssl: Add the possibility for the user to set a password callback
In order to use passphrase-protected keys. This patch does not change the default behavior: server.useSSL("./cert/server.crt", "./cert/server.key"); $> ./a.out Enter PEM pass phrase: [...] static int password_callback(char *buf, int size, int rwflag, void *u) { static const char *password = "foobar"; // _Please_ don't do that, that's an example strncpy(buf, password, size); return strlen(password); } server.useSSL("./cert/server.crt", "./cert/server.key", false, &password_callback); $> ./a.out Listening on 0.0.0.0:9080 Key has been generated with: $> openssl genrsa -aes128 -passout pass:foobar -out server.key 3072 If you intend to use this feature, please look at the recent developments on memfd_secret[1] in order to actually store a passphrase with relative security in memory. [1] https://lwn.net/Articles/865256/Signed-off-by: Louis Solofrizzo <lsolofrizzo@scaleway.com>
Showing
Please register or sign in to comment