フィードを購読する

The ccrypt utility is a security tool that encrypts and decrypts files and streams on demand. It uses the Advanced Encryption Standard (AES), which is considered very secure. For the moment, it's considered to be unbreakable and is a government standard. When you encrypt a file using ccrypt, a password is required. It is best if you continue to use complex passwords for ccrypt encryption because someone might still try.

Using ccrypt is easy enough for encrypting, decrypting, and viewing an encrypted file's contents. I found the rpm on Sourceforge. Be sure to get the 1.11 or later package. Install the ccrypt-1.11 package in the usual way.

$ sudo rpm -i ccrypt-1.11-1.x86_64.rpm

Once installed, you have a few new apps on your system: ccrypt, ccat, ccencrypt, ccdecrypt, and ccguess. The only two actual programs are ccrypt and ccguess. The others are links to ccrypt with their respective options embedded. For example, you can use ccencrypt or ccdecrypt without knowing any ccrypt options for encrypting or decrypting a file. And ccat decrypts and displays the contents of a file without extracting the original file from the encrypted one. The ccguess application can help recover your encryption password if you remember a part of it.

[ Want to learn more about security? Check out the IT security and compliance checklist. ] 

ccencrypt

The ccencrypt command encrypts a file using a key (password or passphrase).

$ cat file1.txt
This is a test of the ccrypt utility

$ ccencrypt file1.txt
Enter encryption key: 
Enter encryption key: (repeat)

$ ls
file1.txt.cpt

You must enter your encryption key twice to confirm that you know it. Then your file is encrypted and is appended with a .cpt extension. You can copy your encrypted file or move it and it remains encrypted.

cp file1.txt.cpt file2.txt
$ cat file2.txt 
?\?mn???&?ꋄ???n????K?B?^+^?Ҧl?EEn???	?2?u??t?=??=??`ʽ??c
$ file file2.txt 
file2.txt: PGP\011Secret Sub-key -

ccdecrypt

Issue the ccdecrypt command to decrypt and extract the original file from the encrypted one.

$ ccdecrypt file2.txt 
Enter decryption key: 
$ ls
file1.txt.cpt  file2.txt
$ cat file2.txt
This is a test of the ccrypt utility

Notice that although file2.txt is a copy of file1.txt.cpt, when decrypted it remains file2.txt and does not revert back to file1.txt.

ccat

The ccat utility is one of my favorites because it allows me to check the encrypted file contents but doesn't extract the contents.

$ ccat file1.txt.cpt 
Enter decryption key: 
This is a test of the ccrypt utility
$ ls
file1.txt.cpt  file2.txt

The encrypted file, file1.txt.cpt, is left encrypted and intact.

ccguess

I like the ccguess command but I also hate it. I like it because it can help recover a forgotten key, but I hate it because it could compromise security in the wrong hands. Here's an example of how it works. When I encrypted file1.txt, I used the key goonygoogoo to protect it. Yes, it's not a great password (key), but it's one I'll remember. But if I forget, I might remember that it has the word 'goo' in it. 

ccguess file1.txt.cpt 
Enter approximate key: goo

Generating patterns...1..2..3..4..5..sorting...done.
***g*o 818434604

Possible match: oLK@gw (5 changes, found after trying 6313742182 keys)

As you can see, even a relatively simple key couldn't be cracked even with a prompt that contained a good portion of the key. Could this key stand up to a brute force attack? Probably not, so use long, complex keys or key phrases for added protection.

Wrap up

The ccrypt utility "suite" is an excellent tool for encrypting and decrypting your files. Here you got a small sampling of what the utility can do for you. There are many more options, which you can explore with this one, but these are the ones I've used most. You also got a glimpse of the ccguess utility that might come in handy should you ever need it. Let's hope you don't, especially if you don't remember a large portion of the key.

 


執筆者紹介

Ken has used Red Hat Linux since 1996 and has written ebooks, whitepapers, actual books, thousands of exam review questions, and hundreds of articles on open source and other topics. Ken also has 20+ years of experience as an enterprise sysadmin with Unix, Linux, Windows, and Virtualization.

Follow him on Twitter: @kenhess for a continuous feed of Sysadmin topics, film, and random rants.

In the evening after Ken replaces his red hat with his foil hat, he writes and makes films with varying degrees of success and acceptance. He is an award-winning filmmaker who constantly tries to convince everyone of his Renaissance Man status, also with varying degrees of success and acceptance.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

チャンネル別に見る

automation icon

自動化

テクノロジー、チームおよび環境に関する IT 自動化の最新情報

AI icon

AI (人工知能)

お客様が AI ワークロードをどこでも自由に実行することを可能にするプラットフォームについてのアップデート

open hybrid cloud icon

オープン・ハイブリッドクラウド

ハイブリッドクラウドで柔軟に未来を築く方法をご確認ください。

security icon

セキュリティ

環境やテクノロジー全体に及ぶリスクを軽減する方法に関する最新情報

edge icon

エッジコンピューティング

エッジでの運用を単純化するプラットフォームのアップデート

Infrastructure icon

インフラストラクチャ

世界有数のエンタープライズ向け Linux プラットフォームの最新情報

application development icon

アプリケーション

アプリケーションの最も困難な課題に対する Red Hat ソリューションの詳細

Original series icon

オリジナル番組

エンタープライズ向けテクノロジーのメーカーやリーダーによるストーリー