Cedeq Community Forum
Keyboard Shortcut - Insert a Password Stored in an Encrypted File - Printable Version

+- Cedeq Community Forum (https://forum.cedeq.com)
+-- Forum: General (https://forum.cedeq.com/forumdisplay.php?fid=1)
+--- Forum: Keyboard shortcuts with AutoHotkey code (https://forum.cedeq.com/forumdisplay.php?fid=4)
+--- Thread: Keyboard Shortcut - Insert a Password Stored in an Encrypted File (/showthread.php?tid=49)



Keyboard Shortcut - Insert a Password Stored in an Encrypted File - denilama - 05-22-2018

Creating a shortcut to insert a password is easy with the "Insert text" command in ShortKeeper. However, your password could be found by someone with access to your ShortKeeper. One way to make things more secure is to create a shortcut to insert a password that is stored in an external file (containing all of your passwords) protected with a master password. Here is one way to do it.

Instead of using the "Insert text" command in ShortKeeper, you use the "Run AutoHotkey code" command. Then, instead of typing your password in the Param field, you paste the following code:
ExternalFileName := "T:\MyData.ini"
PasswordName := "YourBank1"
IniRead, Password, % ExternalFileName, % "Passwords", % PasswordName
SendInput % Password
Password :=

At line #1 of the code above, "T:\MyData.ini" must refer to the path and filename of the external file containing your passwords (do not remove quotation marks).

At line #2 of the code above, "YourBank1" must match one of the password names in the external file (do not remove quotation marks).

Then you will have to create an external file (a simple text file will do) with an ".ini" extension with content like this:

[Passwords]
YourBank1=hkdf77*&77767s8erw82w38
YourBank2=76349286&876&*987&*fGG

You can add all of your other passwords in the external file too.

If the external file cannot be read (e.g. if it is encrypted), the shortcut will insert "ERROR" instead of the password.

There are several ways to encrypt/decrypt the external file. If you are using VeraCrypt, you could insert the following code between lines #2 and #3 above. This will prompt you to enter the master password if the file is not already decrypted:
if (!FileExist(ExternalFileName))
{
  VeraCryptPath := "C:\Program Files\VeraCrypt\VeraCrypt.exe"
  ContainerPath := "U:\VeraCryptContainer.vc"
  RunWait % VeraCryptPath . " /hash sha512 /q /l t /v " . ContainerPath
}

At line #3, "C:\Program Files\VeraCrypt\VeraCrypt.exe" must refer to the path of VeraCrypt.exe (do not remove quotation marks).

At line #4, "U:\VeraCryptContainer.vc" must refer to the path of the VeraCrypt file container (do not remove quotation marks).