On Feb 26, 2005, at 15:15, Paul Nordstrom August wrote:
What I would like is an on-the-fly encryption -- i.e. select the text and run a command to encrypt it (with a pre-set password). Then I could store bank data etc securely.
You can set the password as a custom shell variable for TextMate, go to preferences / advanced (name it e.g. TM_PASSWD). Then use this command to encrypt input (which you'd probably set to “selected text”) as AES-128: openssl enc -e -aes128 -base64 -pass env:TM_PASSWD
To decrypt the block again, use this command: openssl enc -d -aes128 -base64 -pass env:TM_PASSWD
Anyone who has access to your TextMate preferences file would be able to read the password. If this is sufficient security, then I'd suggest the above. You could also provide the password directly to the command using: “-pass pass:<password>”, this is less secure than the variable because other processes running on your machine might be able to intercept launch arguments.
If you need better security, you could have the command ask for the password (e.g. using an applescript dialog) and maybe cache it in a file (readable only by current user) and maybe even have that file removed after n minutes.