Tutorials applicable on more than one Unix/Linux OS and shell scripts: ssh / openssl / protocols.

Advertisement


DNS query tools & Network tools (Ping & Traceroute)

Openssl: Commandline base64 string encoding

Postby debuser » Fri Mar 05, 2010 6:50 pm

To encode a string into base64, echo and openssl system utilities can be used:
Code: Select all
# echo -n 'somepassword' | openssl enc -base64
c29tZXBhc3N3b3Jk


The -n switch to echo is used to supress echoing a new line character. For example, below is a difference between base64 encoded string that doesn't contain newline and on that does:
Code: Select all
# echo -n 'somepassword' | openssl enc -base64
c29tZXBhc3N3b3Jk
# echo 'somepassword' | openssl enc -base64
c29tZXBhc3N3b3JkCg==
debuser
 
Posts: 70
Joined: Thu Aug 06, 2009 9:48 am


Advertisement


Return to Tutorials for general Unix

Similar topics


Who is online

Users browsing this forum: No registered users and 0 guests

cron