Skip to content

ccrypt

installation

install
brew install ccrypt
apt-get install ccrypt

For simple file encryption :

encrypt a file
ccrypt file

Results in file.cpt, decrypting it back to file would be :

decrypting
ccrypt -d file.cpt

But that's mostly not what you want, since you would have to encrypt it again. So use -c or the command ccat to do it to stdout :

ccat
ccrypt -c file.cpt
ccat file.cpt

Or redirect it to file, there is no -o option :

ccat into file
ccat file.cpt > file

Also i see no option for changing the key, but decrypt and encrypt again works perfectly. Also these autocommands in vim (taken from : visit) work out of the box :

~/.vimrc
augroup CPT
 au!
 au BufReadPre *.cpt set bin
 au BufReadPre *.cpt set viminfo=
 au BufReadPre *.cpt set noswapfile
 au BufReadPost *.cpt let $vimpass = inputsecret("Password: ")
 au BufReadPost *.cpt silent '[,']!ccrypt -cb -E vimpass
 au BufReadPost *.cpt set nobin
 au BufWritePre *.cpt set bin
 au BufWritePre *.cpt silent! '[,']!ccrypt -e -E vimpass
 au BufWritePost *.cpt silent! u
 au BufWritePost *.cpt set nobin
augroup END

I added these to the .vimrc file in bitbucket.