
Encrypting ftp password in ftp batch script???
These are fun problems ;)
Anyway, here's a small example script which basically crypts a string and
convert it to "-" delimited octals (Coder). For decoding, the string is
processed the other way around.
You can hard-code the crypt-key or "hide" it somewhere not in plain view. In
stead of using plain text passwords, you can use the octal-serie
representation.
Don't forget this is not much different from storing plain text passwords
(security by obscurity).
If it doesn't solve your problem, it'll perhaps give you an idea of how to
proceed.
Bye,
Real
#!/usr/bin/ksh
function Coder
{
# Usage: Coder <text> <key>
echo "${1}\c" | crypt ${2} | od -t oC -v -w512 | sed -e 's/^[0-9]*[ ]*//'
| tr -d '\n' | tr ' ' '-'
return
function Decoder
{
# Usage: Decoder <pwd> <key>
echo "$( echo "\\\\0${1}" | sed -e 's/[-]/\\0/g' )\c" | crypt ${2}
return
coded="$( Coder "SuperSecretPassword" "secret" )"
echo "Coded : ${coded}"
decoded="$( Decoder "${coded}" "secret" )"
echo "Decoded: ${decoded}"
exit