Pergunta

I'm working on an embedded application (running MQX RTOS, written in C) which has SMTP functionality. Recently, TLS support was added using the Mocana NanoSSL library. I'm currently able to successfully send emails using Gmail, Yahoo, and private exchange servers. Unfortunately, Hotmail does not work. Here's the connection parameters i've used:

Server: smtp.live.com
Port: 25 and 587
AUTH method: PLAIN and LOGIN

Basically, i'm able to successfully connect to the server, perform the SSL/TLS handshake (using STARTTLS), and send the encrypted EHLO message to the server (receiving a response). According to this response, the server supports both AUTH PLAIN and AUTH LOGIN. However, once I send either of these commands, the following SSL_recv() call I make to get the response fails with either a timeout or connection reset by peer.

UPDATE:
OK, so after some experimentation it would appear that my issue lies at the SSL library level and not with Microsoft's SMTP server. I tried replacing the SSL_recv() calls with standard RTCS socket recv() calls and was able to receive and view encrypted data. By disabling my response verification, I was then able to continue through the SMTP process and successfully send a message. At this time i'm not sure why the SSL_recv() calls are unable to get the socket data, but i'll keep digging and will hopefully find an answer.

Foi útil?

Solução 2

So, it's the SSL library itself that appears to be failing me here. I was able to bypass the issue and successfully send email by simply not calling SSL_recv() to verify the server responses. I'm obviously not able to error check or get any meaningful failure feedback, but for a successful use case where the server accepts all of my SMTP messages the email is sent.

Outras dicas

Well, I also got it working here too. I had to replace the

ssl_ctx=SSL_CTX_new(SSLv23_client_method());

with either:

ssl_ctx=SSL_CTX_new(SSLv3_client_method());

or

ssl_ctx=SSL_CTX_new(TLSv1_client_method());

My understanding is that the 23_client method sends a SSL2 client hello first and this confuses the server. I read this in the HP SSL programming tutorial:

http://h71000.www7.hp.com/doc/83final/ba554_90007/ch04s03.html

it says: "However, the SSL client using the SSLv23 method cannot establish connection with the SSL server with the SSLv3/TLSv1 method because SSLv2 hello message is sent by the client."

SSL3 works too since you can continue after STARTTLS with SSL, you do not have to use TLS.

See here: https://www.fastmail.fm/help/technology_ssl_vs_tls_starttls.html

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top