Skip to content

Instantly share code, notes, and snippets.

@marcus-at-localhost
Last active August 29, 2015 14:27
Show Gist options
  • Save marcus-at-localhost/412c9dd87303d9280578 to your computer and use it in GitHub Desktop.
Save marcus-at-localhost/412c9dd87303d9280578 to your computer and use it in GitHub Desktop.
Experimental Standalone OpenSSL text file de/encrypter for Sublime-Text-Crypto Package

OpenSSL text file de/encrypter

This is an alternative way to decrypt text files that got encrypted by the Sublime Text Crypto Package. Just in case, Sublime Text is not available.

Setup

  1. Download OpenSSL Windows Binaries here or here
  2. Extract to a folder openssl
  3. Place the file crypt.bat one level up

Usage

Make a backup of your file first!

  1. Drop an encrypted file onto crypt.bat
  2. Type in password into the cmd prompt
  3. File opens in Notepad
  4. Keep the cmd window open
  5. Make changes and save the file, or just view the content, then close the file
  6. Cmd prompt asks for the password two times
  7. done
  8. It's not the most convinient way, I know...

Don't drop

Additional Information

@echo off
rem Changes program to the dir .bat is in
cd /d %~dp0
rem First part is the path to openssl.exe, then the encryptions stuff.
rem Then %1 is the item you dropped on the .bat file.
rem Then %~dp1%~n1 removes the .extension and places a *.tmp file into original dir.
rem The *.tmp file will be opened by Notepad
rem Edit the file save and close
rem Prompt asks for password twice
rem File gets encrypted and *.tmp removed
echo "Keep the window open!"
rem >nul 2>&1 suspresses any errors in case password is wrong
"openssl\openssl.exe" enc -d -aes128 -base64 -in %1 -out "%~dp1%~n1.tmp" >nul 2>&1
IF ERRORLEVEL 1 (
echo "Wrong Password or some other error"
goto close
)
Notepad.exe "%~dp1%~n1.tmp"
"openssl\openssl.exe" enc -aes128 -base64 -in "%~dp1%~n1.tmp" -out %1
goto close
:close
del "%~dp1%~n1.tmp"
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment