How to encrypt text in Visual Studio Code (VSCode)
I wanted a way to quickly encrypt and decrypt files in Visual Studio Code using a memorised pass phrase so I created an easy to use plugin.
The Encryption-VScode plugin uses AES encryption to encrypt/decrypt the contents of the current text file.
The Crypto-JS plugin is the only dependancy which gives access to the encryption module as crypto.subtle is not available within node.
It’s easy to install and use.
Go to “File > Preferences > Extensions” and search Encryption-VScode then install and restart the editor.
When you want to encrypt a file press CTRL + SHIFT + P to open the command prompt and type “Encrypt”. You’ll be prompted to enter a pass phrase and the current text document will turn into an encrypted text string.
To decrypt open the command prompt and type “Decrypt”.
It’s a good way to store private information on a local device and could be useful for cold storage solutions as well. I did consider adding a salt in the settings.json but this would make it incompatible with other AES products/services.
The workflow is you write a document that you want to keep secure. Before saving it you encrypt the text and then save to a local hard drive. The encrypted document can then be safely saved and stored on the local device. When you need the data simply open up the text file and decrypt it using the plugin and passcode. The document can then be edited and modified before encrypting again and saving any modifications.
Software is provided as is with no warranty or guarantees. Source code is on Github at: https://github.com/jamesbachini/Encryption-VScode
The plugin is also available from Microsofts plugin market place: https://marketplace.visualstudio.com/items?itemName=JamesBachini.encryption-vscode