1 (edited by kackle123 2015-07-10 13:44:00)

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(&params->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".

Share

Re: Encrypted Email

Hi Kackle123,

Have you tried running the wolfCrypt test app on your target platform to make sure the library has been configured correctly and that the crypto algorithms pass? 

The wolfCrypt test is located in <wolfssl_root>/wolfcrypt/test/test.c.  You can define NO_MAIN_DRIVER if you have your own driver code available.

Thanks,
Chris

Re: Encrypted Email

Chris, thank you for your reply. 

Running the test on the target sounds like a good idea, but I have no filesystem.  Is this feasible?

What is meant by "NO_MAIN_DRIVER"; a driver for what?

Share

Re: Encrypted Email

Should I move this issue to your email support?  I don't know how frequently forum questions are handled here.

Share

Re: Encrypted Email

Case moved to email support.