Topic: Encrypted Email
I have some basic questions about doing encrypted email on an embedded platform. I am posting here because I'm sure others will want to do the same thing in the future.
If I want to send an email without validating the email server's identity via certificates, but still encrypt the communication, how would I go about doing that? I try such code below but I keep getting a PEER_KEY_ERROR from CyaSSL_negotiate.
CyaSSL_Init();
method = CyaSSLv23_client_method();
ctx = CyaSSL_CTX_new(method);
wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
wolfSSL_CTX_use_PrivateKey_buffer(ctx,
clientKeyInBuffer,
strlen(clientKeyInBuffer),
SSL_FILETYPE_PEM);
ssl = CyaSSL_new(ctx);
socket = SMTP_connect(¶ms->server);
recv(socket, response, CYASSL_SMTP_RESPONSE_BUFFER_SIZE, 0);
CyaSSL_set_fd(ssl, socket);
SMTP_send_command(socket, "EHLO me", response);
SMTP_send_command(socket, "STARTTLS", response);
CyaSSL_negotiate(ssl);
SSL_SMTP_send_command(socket, "EHLO me", response);
Variable "clientKeyInBuffer" holds what was in ASCII disk file "client-key.pem".