I have been digging into the vip code recently. Initially to get a better understanding on namespacing and scope in pil21.
However, I am really appreciating how powerfully extensible vip is. I added a couple of cmds (not yet moved to viprc) to encrypt and decrypt entire buffers (see below where I essentially took a cue from vip's existing support for ccrypt), The code is just a port of vimscript code I use in that editor. I wrote the code this way so I could have the undo/redo functionality when crypting and choose whether to save any changes. I also have different files encrypted with different keys and don't want to use one of the other openssl options for -pass like reading from a file. I've been a bit stuck on how to enter the "yek" encryption key (ideally twice for confirmation) without echoing to the display. Is there a straightforward way to do that? Regards, Lindsay ("yek" (=: buffer yek L) (with *CmdWin T ) ) ("enc" # Encrypt buffer with openssl (when (sys "YEK" (: buffer yek) ) (pipe (out '("openssl" "enc" "-aes-256-cbc" "-salt" "-pbkdf2" "-a" "-pass" "env:YEK") (mapc prinl (: buffer text)) ) (let (EncryptedData (rdLines)) (setq *Change NIL) (move 'goAbs 1 (or (format *Count) 1)) # Move to top (setq *Change "d") # Delete... (move 'goAbs 1 (or (format *Count) T)) # Delete all (paste (cons T EncryptedData) *@@) # Replace with encoded data ) ) ) ) ("dec" # Decrypt buffer with openssl (when (sys "YEK" (: buffer yek) ) (pipe (out '("openssl" "enc" "-aes-256-cbc" "-d" "-pbkdf2" "-a" "-pass" "env:YEK") (mapc prinl (: buffer text)) ) (let (EncryptedData (rdLines)) (setq *Change NIL) (move 'goAbs 1 (or (format *Count) 1)) # Move to top (setq *Change "d") # Delete... (move 'goAbs 1 (or (format *Count) T)) # Delete all (paste (cons T EncryptedData) *@@) # Replace with encoded data