I need to encrypt and decrypt a password using bash script. For that, I'm using
The decryption is needed because I'm moving the password between hosts.
The weird thing is it looks like the encryption has an expiration time.
To encrypt (not on bash script):
echo P@$$word| openssl enc -aes-128-cbc -a -salt -pass pass:pass_key
to decrypt (on bash script):
dec_password=$(echo -n $1 | openssl enc -aes-128-cbc -a -d -salt -pass pass:pass_key)
if I'm doing the encryption and then running the script it works perfectly.
However, if I'm doing the encryption and in the next day running the script for decryption it fails with the error:
error reading input file
Not sure if time is related but that's the only variable that changed.
Any ideas? Thanks