parsed.org

Tips by tag: encryption

Decrypt RSA Key by xinu on Sep 10, 2005 12:15 AM

Tired of typing your SSL password on boot of your webserver? You can decrypt it if you're certain it's safe:

# openssl rsa -in server.key -out server.key.unsecure
apachebootcommandsencryptionkeyopensslsecurityshellsslwebserver
Open a Backgrounded SSH Tunnel by cygnus on May 06, 2006 12:10 AM

If you want to open an SSH tunnel in the background, use the -N and -f switches:

ssh -Nf -L2121:localhost:21 user@host
authenticationencryptionsecurityshellsshtunnel

add these lines to your vimrc and you can read/write .gpg files. passwortd will be prompted by vim. ('ksh' needs to be installed):

augroup gpg
  au!
  autocmd BufReadPre *.gpg set binary noswapfile
  autocmd BufRead *.gpg call s:Decrypt()
  autocmd BufWrite *.gpg call s:Encrypt()
augroup END

function s:Decrypt()
 set shell=ksh
 let s:mykey = inputsecret("Enter passphrase:")
 exe "%! { echo " . escape(s:mykey, "!\"|") . "|& };
  \ gpg -q --no-mdc-warning --passphrase-fd 3 3<&p --decrypt 2>/dev/tty"
 set nobin
 if !nextnonblank(1)
   echohl ErrorMsg
   call input("type ENTER to exit")
   :q!
 endif
endf

function s:Encrypt()
 exe "%! { echo " . escape(s:mykey, "!\"|") . "|& };
  \ gpg -q --passphrase-fd 3 3<&p -sear Fabian -"
endf
encryptiongpgvim
RSS