1832791 Members
2833 Online
110045 Solutions
New Discussion

Re: Cat encrypted files

 
SOLVED
Go to solution
Richard Briggs
Regular Advisor

Cat encrypted files

I've encrypted a text file using crypt. I would like to cat the file (and not get encrypted garbage), that is to say, I'd like to
cat the file and be able to read the encrypted text.

can I cat a file that is encrypted and unencrypt on the fly?

#find / -name coffee | cup < cream
4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: Cat encrypted files

To do what you want you would have to do something like:

# cat encrypted_file | decrypt_command

The 'cat' command by itself will not decrypt a file.
Helen French
Honored Contributor

Re: Cat encrypted files

Hi,

You can use the 'crypt' command itself to decode the file. See man pages of 'crypt' for more help.

HTH,
Shiju
Life is a promise, fulfill it!
A. Clay Stephenson
Acclaimed Contributor

Re: Cat encrypted files

Absolutely; crypt merely works on stdin/stdout so that somethings as stupid as this works:

echo "My Secret Message" | crypt "topsecret" | crypt "topsecret"

The first crypt encrypts and the second crypt unencrypts so that the plaintext "My Secret Message" emerges at the end of the pipeline as long as the the two keys match.
If it ain't broke, I can fix that.
Richard Briggs
Regular Advisor

Re: Cat encrypted files

Thank you all... it works fine to pipe it to crypt

Richard
#find / -name coffee | cup < cream