View Full Version : Need Help in Encryption
gurudict
03-28-2007, 07:56 AM
I am using Autoplay media studio 6.0. I would like to encrypt the setup.exe file which i created, so that whenever it is opened by anybody a password prompt should appear. Without entering the correct password nobody should be able to access it. How should i do it. Please help me as i don't have any plugins for AMS. Any kind of help would be appreciated and anybody and everybody is welcome.
Thanx!:huh
RizlaUK
03-28-2007, 09:16 AM
what do you mean you don't have any plugins, thay come as standard with apms 6
but anyway, to your problem,
steps:
1st, encode the exe file with base64 encryption to a text file
2nd, encode the text file with blowfish adding your password
3rd, user must enter the right password to decode the blowfish file
4th, if the right password was entered then decode the blowfish file to a base64 string and then decode the string back into the original exe file
you might find my file encoder (http://www.indigorose.com/forums/showthread.php?t=19328) helpful for the encoding part, but the rest will have to be done in ams with code
RizlaUK
03-28-2007, 11:30 AM
Here, i made a small example of what i mean
it includes a encrypted exe so its to big to attach
Encrypted EXE Example (http://www.box.net/shared/eomimvc2d7)
preview the app, click the button enter "exepassword" in the input and the file will be decrypted from blowfish to base64, then decoded from base64 to exe and then the file will run
all the code is in the button
RizlaUK
Crypto.Base64DecodeFromString(StrCode, _TempFolder.."\\temp.exe");
where is this TempFolder ? temp.exe, and temp.txt
its not there?
RizlaUK
03-28-2007, 07:05 PM
i don't understand
do you mean its not working or the files are not there when you look for them ?
Sorry RizlaUK , Its working fine, but Just want to know how does that ramwatcher application run's? checked it in the folders not there, thats why I ask.
:huh
RizlaUK
03-28-2007, 07:36 PM
lol, ok, after the files have been used thay are deleted from the temp folder
it allows for a one time use of the file, every time the user wants to use the file (which would be a install.exe for the original poster) thay have to enter the password
the idea is, anyone can decode the base64 file, thats why i encrypted it with blowfish, so the password decrypts the blowfish file and writes the contents to a txt file (wich would be the base64 encryption) and then decode that file back to the exe, then run the file, after the file is run all the files are deleted
im trying to work on a way to do it all in memory to avoid writing the temp.txt file, but i cant get it to work yet
the files will remain in the temp folder as long as the ramwatcher file is running, as soon as you exit that the files are deleted
EDIT, if you look in the docs folder you will see "encrypted_exe.txt" that is the ramwatcher.exe app, double encrypted
A ha now I understand, Nice work RizlaUK.
:yes
Thanks for make me understand the code.
gurudict
03-29-2007, 04:03 AM
what do you mean you don't have any plugins, thay come as standard with apms 6
but anyway, to your problem,
steps:
1st, encode the exe file with base64 encryption to a text file
2nd, encode the text file with blowfish adding your password
3rd, user must enter the right password to decode the blowfish file
4th, if the right password was entered then decode the blowfish file to a base64 string and then decode the string back into the original exe file
you might find my file encoder (http://www.indigorose.com/forums/showthread.php?t=19328) helpful for the encoding part, but the rest will have to be done in ams with code
No buddy you haven't understand. I wnat to make an setup.exe file which when double clicked i.e. tried to open it asks fro password. If the the correct password enter the program will run else it fails to run. I hope you have understood what i want.
Put this on your first page: Preload
-- the 'correct' password
real_password = "password";
-- prompt the user to enter a password
user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);
-- compare the user's password to the 'correct' password.
-- If the user supplies the wrong password, exit the program.
if real_password == user_password then
Page.Jump("Page2");
else
-- wrong password (change this message to suit)
Dialog.Message("Incorrect Password", "Incorrect password.", MB_OK, MB_ICONEXCLAMATION);
Application.Exit(0);
end
If this is you want , then you have to Thank , RizlaUK and Worm because I learned from them.
;)
gurudict
03-29-2007, 07:35 AM
Put this on your first page: Preload
-- the 'correct' password
real_password = "password";
-- prompt the user to enter a password
user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);
-- compare the user's password to the 'correct' password.
-- If the user supplies the wrong password, exit the program.
if real_password == user_password then
Page.Jump("Page2");
else
-- wrong password (change this message to suit)
Dialog.Message("Incorrect Password", "Incorrect password.", MB_OK, MB_ICONEXCLAMATION);
Application.Exit(0);
end
If this is you want , then you have to Thank , RizlaUK and Worm because I learned from them.
;)
Hey NALS this is the thing i needed. But i am having one problem. I have inserted the code to the page Script and when i build the program (without publishing it) a pop up dialog box shows a message as "Please go to control panel to install and configure system components." And when i publish the program bya making a single exe file i get another pop up dialog box whose screen shot i have provided as the attachment. Please help me. and by the way i have made little chages in your program. Here they are
-- the 'correct' password
real_password = "password";
-- prompt the user to enter a password
user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);
-- compare the user's password to the 'correct' password.
-- If the user supplies the wrong password, exit the program.
if real_password == user_password then
File.Open("setup.exe");(Here earlier it was "Page.Jump("Page2");")
else
-- wrong password (change this message to suit)
Dialog.Message("Incorrect Password", "Incorrect password.", MB_OK, MB_ICONEXCLAMATION);
Application.Exit(0);
end
Is anything wrong with my program Please help me. And thanx a million man for the code.
RizlaUK
03-29-2007, 07:43 AM
No buddy you haven't understand. I wnat to make an setup.exe file which when double clicked i.e. tried to open it asks fro password. If the the correct password enter the program will run else it fails to run. I hope you have understood what i want.
try nals code, but there is no need to jusp to page 2
try like this:
-- the 'correct' password
real_password = "password";
-- prompt the user to enter a password
user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);
-- compare the user's password to the 'correct' password.
-- If the user supplies the wrong password, exit the program.
if real_password ~= user_password then
Dialog.Message("Incorrect Password", "Incorrect password.", MB_OK, MB_ICONEXCLAMATION);
Application.Exit(0);
end
RizlaUK
03-29-2007, 07:47 AM
that is just a pre warning for the vista platform, there is nothing wrong with you app, that pop up just tell you that you may need to inform users if your app need to have admin account on the pc, its all part of the vista securty settings
I have no Idea about Vista, I m still using Windows XP and I m happy with it.
;)
gurudict
03-29-2007, 08:20 AM
try nals code, but there is no need to jusp to page 2
try like this:
-- the 'correct' password
real_password = "password";
-- prompt the user to enter a password
user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);
-- compare the user's password to the 'correct' password.
-- If the user supplies the wrong password, exit the program.
if real_password ~= user_password then
Dialog.Message("Incorrect Password", "Incorrect password.", MB_OK, MB_ICONEXCLAMATION);
Application.Exit(0);
end
A million billion thanx RizlaUK. This is exactly what i needed. But you told me that even though it is encrypted. it can be cracked out from the TEMP folder. Please tell me in detail how to permanently protect it as far as you know. A one more thing i would like to tell ya that when a wrong password is entered the program shuts but, gives a glimpse of it. Can we stop/hide the glimpse. Thanx a lot again:lol
Lorne
04-10-2007, 10:20 AM
Use the Crypto actions to generate an MD5 hash of the original password, and only store that. When the user enters their password, generate an MD5 hash of what they entered, and compare that to the MD5 hash of the original. If they match, then you know the passwords match, without having to store the originals in a form that can be decrypted (not yet anyway).
TJ_Tigger
04-10-2007, 12:02 PM
Use the Crypto actions to generate an MD5 hash of the original password, and only store that. When the user enters their password, generate an MD5 hash of what they entered, and compare that to the MD5 hash of the original. If they match, then you know the passwords match, without having to store the originals in a form that can be decrypted (not yet anyway).
Just to add to what Lorne said, you may want to add some characters to their password before you calculate the MD5 hash and do the same to the entered password. This helps if your user enters a word that is in a dictionary incase you are concerned if someone trying to bruteforce your app.
strpass = "TIGG"..strpass --something like this anyway
--then calculate the md5
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.