Azitech

Azimout's Linux weblog

Base64 encoding/decoding for authentication

leave a comment »

To encrypt your username and password in order to authenticate yourself with an SMTP server, the command to use on a Linux terminal is the following:

echo -e -n "\0username\0password" | base64 -

The result will look something like this:

4oCdMHVzZXJuYW1lMHBhc3N3b3Jk4oCd

“-e” is required in order to correctly interpret “\0” as the null byte. “-n” is required to stop “echo” from appending CR and/or LF characters at the end.

Advertisements

Written by azimout

28/05/2011 at 13:36

Posted in Howto

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: