I apologize for my limitations in advance...
Is it possible to add a script to my AHK ini file that will encrypt the .ini file when I close it, and then ask for a password when I open it, and then decrypt and load the ini file? Essentially, a password + encryption lock to hide everything in the script file, but still keep the .ahk extension so it will try to load when clicked on?
I am trying to avoid having to do a separate encryption/decryption every time I open AHK. I would need this in certain selected files, not every AHK file.
[VxE]'s Encryption Function is excellent, as are others, but I'm trying to find a shortcut. I am trying to promote AHK as a timesaver in my physicians' group, but a major concern is security of passwords. As it is, I'm by far the most "techie" person in the group, and even I have some difficulty negotiating some of the encryption utilities. What's needed is super simplicity: click on AHK.exe, enter password in box, file decrypts and loads. Close AHK => file encrypts and closes and is unreadable off the hard drive. Any takers?
If this has already been done, kindly point me to the post. And thanks to everyone for this great forum!
Password to open AHK ini file
2 replies to this topic
Here's a short illustration of one way to go about having a script keep its ini file encrypted when not in use. It's not a working example, but it should give an idea or two. Another method would be to keep the key values encrypted and only decrypt them when they are being used.
OnExit, OnExitSubroutine MyINIFile = %A_MyDocuments%\TestInfo.ini ; A snippet to read from an encrypted ini file InputBox, mypassword, What's my password ! FileRead, InFile, %MyINIFile% ; read an encrypted ini file FileMove, %MyINIFile%, %MyINIFile%.tmp, 1 ; move the original out of the way FileAppend, % Decrypt(mypassword, InFile), %MyINIFile% ; write the decrypted file InFile := "" IniRead, Version, %MyINIFile%, The Top, Version, Error ; ... whatever other inireads you need ... FileMove, %MyINIFile%.tmp, %MyINIFile%, 1 If Version = Error ; the file failed to decrypt if the key wasn't read msgbox Wrong Password ! OnExitSubroutine: IfExist, %MyINIFile%.tmp FileMove, %MyINIFile%.tmp, %MyINIFile%, 1 Exitapp ; Example ini file: ; [The Top] ; Version=1.234.567 ; [Data] ; Data1=Sir Lancelot ; Data2=To seek the grail ; Data3=Blue ; ... /* ; To encrypt an ini file, try the following steps ; after all the keys have been added to the file OnExitSubroutine: FileRead, InFile, %MyINIFile% FileAppend, % Encrypt(mypassword, InFile), %MyINIFile%.tmp FileMove, %MyINIFile%.tmp, %MyINIFile%, 1 InFile := "" Exitapp
#3 - Posted 25 October 2008 - 06:58 PM