Testing SMTP AUTH PLAIN Over TLS

To prepare to test a TLS connection to an SMTP server we first need to Base64 encode the Login credentials:

perl -MMIME::Base64 -e 'print encode_base64("\000LoginID\000password")'

The result of this is:

AExvZ2luSUQAcGFzc3dvcmQ=

I tried using the base64 linux command but did not get the same result or a result that would work:
echo -n "\000LoginID\000password" | base64

Create the SMTP session with openssl rather than telnet:

openssl s_client -starttls smtp -crlf -connect smtp.domain.uk:587
When prompted with ‘250 HELP’ enter:
ehlo yourclienthostname
The server will respond:
250-SIZE 20971520
250-PIPELINING
250-AUTH PLAIN LOGIN
250 HELP

Next enter your base64 encoded login credentials:

AUTH PLAIN AExvZ2luSUQAcGFzc3dvcmQ=

The server should respond with:
235 Authentication succeeded
OR:
535 Incorrect authentication data
If the wrong credntials were supplied.

TLS SMTP connection

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>