Sunday, May 27, 2007

Encrypt and Decrypt the Contents of a File

Here's a simple way to encrypt the contents of a message using the crypt command. The security level is fairly weak but it's not meant to be PGP. Here an example to encrypt and decrypt the contents of a file.

To encrypt
Encrypt with mykey in the open
# crypt mykey<not_encrypted_file>encrypted_file

Prompted for mykey
# crypt<not_encrypted_file>encrypted_file
Enter key:mykey

To decrypt
Decrypt with mykey in the open
# crypt mykey<encrypted_file | more

Prompted for mykey
# crypt<encrypted_file | more
Enter key:mykey

Mail the encrypted file as an attachment
Use a mail client such as Netscape, FireFox, or dtmail because it's easier to move the binary file.


Anonymous said...

Do you know of any windows (dos) based programs that encrypt/decrypt the same as the standard unix crypt command?

esofthub said...


No, but I'm sure others might have a few suggestions.