[TxMt] Improvement on ASE encrpt commands

Quinn Comendant quinn at strangecode.com
Mon Jun 5 22:30:01 UTC 2006


Allan,

Here is an updated version of the "AES Encrypt Document / Selection With
Password..." command. It uses secure-inputboxs and asks to verify the
entered password.

Decrypt version also needs secure-inputbox, but obviously not the
verification.

Q

---

res=$(CocoaDialog secure-inputbox --title "Encrypt Text With AES 128" --
informative-text "What password should be used?"  --text ""  --button1
"Continue" --button2 "Cancel")
[[ $(head -n1 <<<"$res") == "2" ]] && exit_discard
passwd=$(tail -n1 <<<"$res")

res=$(CocoaDialog secure-inputbox --title "Encrypt Text With AES 128" --
informative-text "Enter password again to verify."  --text ""  --button1
"Encrypt" --button2 "Cancel")
[[ $(head -n1 <<<"$res") == "2" ]] && exit_discard
passwd2=$(tail -n1 <<<"$res")

if [[ $passwd == $passwd2 ]]; then
    openssl enc -e -aes128 -base64 -pass "pass:$passwd"
else
    exit_show_tool_tip "Password mismatch! Please play again."
fi





More information about the textmate mailing list