Ruan Bekker's Blog

From a Curious mind to Posts on Github

Encrypt and Decrypt Files With Ccrypt

This is a quick post to demonstrate how to encrypt and decrypt files with ccrypt

About

Ccrypt’s description from its project page:

Encryption and decryption depends on a keyword (or key phrase) supplied by the user. By default, the user is prompted to enter a keyword from the terminal. Keywords can consist of any number of characters, and all characters are significant (although ccrypt internally hashes the key to 256 bits). Longer keywords provide better security than short ones, since they are less likely to be discovered by exhaustive search.

Ref: http://ccrypt.sourceforge.net/

Install

For debian based systems, to install ccrypt:

1
$ sudo apt-get install ccrypt

Usage

To encrypt files, write a file to disk:

1
$ echo "ok" > file.txt

Then encrypt the file by providing a password:

1
2
3
$ ccencrypt file.txt
Enter encryption key:
Enter encryption key: (repeat)

It encrypts and only the encrypted file can be found:

1
2
$ ls
file.txt.cpt

Decrypt the file, by providing your password that you encrypted it with:

1
2
$ ccdecrypt file.txt.cpt
Enter decryption key:

View the decrypted file:

1
2
$ cat file.txt
ok
-->

Comments