Question about the Crypto Action...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Intrigued
    Indigo Rose Customer
    • Dec 2003
    • 6125

    Question about the Crypto Action...

    It's past 2am this Friday morning and my brain has done the inevitable meltdown.

    I want to check a variable that holds a password entered into a Dialog.Password dialog.

    If it's not the correct password (read: Key), then I want to end the routine.

    Let me put it in an anlogy:

    "IDOK is to Dialog.Message, as N is to Crypto.BlowfishDecrypt(sSource, sDestination, sPassword)"

    Remember, I want to check against the password entered by the user to make sure it's correct.

    I know the file holds the password, I just need to know the variable for such.

    I'm a tad tired... so I hope this all makes since.

    Thank you in advance!
    Last edited by Intrigued; 01-28-2005, 12:22 AM.
    Intrigued
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9741

    #2
    Hi. I'm sure we can figure this out but I'm not 100% certain on the task, is this it:

    "How do I validate a password which a user enters via an input object against an existing password stored in a file, using the encryption plug-in?"

    Is the existing password encrypted? With which method? Is it in a flat text file?

    In general, the metaphor is that we encrypt our master passwords prior to distribution so that no one has access to them, and then we can simply encrypt/compare user input against that. There is never any type of decryption involved...

    Comment

    • Intrigued
      Indigo Rose Customer
      • Dec 2003
      • 6125

      #3
      1. Get user typed password for a file to be encrypted.
      2. Upon trying to open the file, check the password now being used to access such file, with the password stored in the encrypted file that was typed in originally by the user.

      I need the variable to check against the password to open the file, against the password stored in the encrypted file.

      (Tired tonight, did that make more sense?)

      Thanks in advance,
      Last edited by Intrigued; 01-28-2005, 12:58 AM.
      Intrigued

      Comment

      • Corey
        Indigo Rose Staff Alumni
        • Aug 2002
        • 9741

        #4
        1. Get user typed password for a file to be encrypted.
        2. Upon trying to open the file.
        That's where you lose me. It's a non-sequitur. Maybe it's just me, I'm also tired...

        Comment

        • Intrigued
          Indigo Rose Customer
          • Dec 2003
          • 6125

          #5
          Note: Moderator(s), can you move this to the Plugin section please. I chose unwisely (Indiana Jones movie) and put this post in the wrong forum.

          When I get home I will try to reformulate my question in hopes that it will be easier to understand.

          :yes
          Intrigued

          Comment

          • TJ_Tigger
            Indigo Rose Customer
            • Sep 2002
            • 3159

            #6
            Intrigued,

            Let me see if I understand. It sounds like you have a file (or string) selected by the user and would like to now encrypt the file and save it to disk. Then the file is referenced somewhere in the project like a listbox and when the file is selected to be opened you want to receive a password and deencrypt the file so it can be read. Am I in the park or somewhere in BFE.

            tigg
            TJ-Tigger
            "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
            "Draco dormiens nunquam titillandus."
            Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

            Comment

            • Intrigued
              Indigo Rose Customer
              • Dec 2003
              • 6125

              #7
              I'm sorry about the confusion.

              Let me have a run at it again.

              Step 1:

              (In previous steps the user has saved a document to somewhere on their computer, network and protected it with a Key (read: password). This is done with the Blowfish Plugin (Crypto).

              User clicks a button to choose the encrypted file
              User then enters password that was set from before

              Now, the data is put into an Input Object.
              The data UNencrypted if the password is correct and still encrypted if wrong (they entered the previously saved password)
              My question...

              How do I check FIRST to see if the password is correct? Is there a built-in for the Crypto.BlowfishDecrypt Action? (ie. IDPASSWORD)

              I do NOT want to dump the encrypted data in the Input Object.... only the readable data.


              Now, I have not taken time to go all through it again... I have first posted this there before my mind goes to gel again.

              Thanks Corey, TJ_TIGGER, or others in advance for any insight on this matter.

              Otherwise, I will have to look for a workaround or change my understanding of the Encryption Plugin.
              Last edited by Intrigued; 01-28-2005, 06:59 PM.
              Intrigued

              Comment

              • Corey
                Indigo Rose Staff Alumni
                • Aug 2002
                • 9741

                #8
                Hmmm, the dev guys are probably better to address this than me, I'm not an expert on that particular plug-in... If you don't get a solid answer by Monday from someone else, bump this post back up and I'm sure you will get something from one of the programmers.

                Comment

                • Intrigued
                  Indigo Rose Customer
                  • Dec 2003
                  • 6125

                  #9
                  Sounds good Corey. Thanks for your fast response nontheless!

                  I'm so content with the speed of the reply I will regress to a movie (Intermission).



                  :yes
                  Intrigued

                  Comment

                  • TJ_Tigger
                    Indigo Rose Customer
                    • Sep 2002
                    • 3159

                    #10
                    I haven't tried yet, but what happens when you decrypt a file with a wrong key? What does it return. I looked at the help and didn't see an error for a wrong key. What if you were to keep a list of files that were encrypted and a MD5digest for the password for that file, maybe in an INI file. Then when the file is selected to be opened you can band the password against the digest and if it passes then decrypt the file.

                    Might be more steps then you want but it might work.
                    TJ-Tigger
                    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
                    "Draco dormiens nunquam titillandus."
                    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

                    Comment

                    • Intrigued
                      Indigo Rose Customer
                      • Dec 2003
                      • 6125

                      #11
                      Originally posted by TJ_Tigger
                      I haven't tried yet, but what happens when you decrypt a file with a wrong key? What does it return. I looked at the help and didn't see an error for a wrong key. What if you were to keep a list of files that were encrypted and a MD5digest for the password for that file, maybe in an INI file. Then when the file is selected to be opened you can band the password against the digest and if it passes then decrypt the file.

                      Might be more steps then you want but it might work.
                      Some good ideas TJ_TIGGER...

                      But, the data returned is the encrypted contents of the file. Definitely not what I wanted. I just want nothing to return if the Key (password) is not correct.

                      It might have to be an update to the plugin, if possible.

                      Hmmm....

                      Thanks for your suggestions for the workaround avenue though.
                      Intrigued

                      Comment

                      • Worm
                        Indigo Rose Customer
                        • Jul 2002
                        • 3967

                        #12
                        I haven't played with that plug-in yet, but have you tried getting the value of Application.GetLastError() after the decrypt. I'll betcha that it isn't 0 and that would let you know the key was wrong.

                        Again, just a guess. As I said, I haven't used this plug-in as of yet.

                        This is from the Crypto Plugin template:
                        Code:
                        	Crypto.BlowfishDecrypt(strSourceFile, strDestinationFile, strKey);
                        	if(Application.GetLastError() ~= 0)then
                        		Dialog.Message("Error", _tblErrorMessages[Application.GetLastError()]);
                        	else
                        		Dialog.Message("Status", "File decrypted successfully.");
                        	end
                        Last edited by Worm; 01-28-2005, 09:55 PM.

                        Comment

                        • SUF6NEWBIE

                          #13
                          My experiences thus far while getting creative with Blowfish etc
                          ..these are the two error code values that will nail if ecrypt\decrypt has failed

                          Code:
                          Crypto.BlowfishDecrypt(strSourceFile, strDestinationFile, strKey);
                          	ndecerror = Application.GetLastError();
                          	if (ndecerror == 34002) or (ndecerror == 34003) then
                          		Dialog.Message("Decrypt Error", _tblErrorMessages[Application.GetLastError()]);
                          	else
                          		Dialog.Message("Status", "File decrypted successfully.");
                          	end
                          One tip is using the md5 functionality ..the value can be stored in memory
                          or 'recorded' - changed for any purpose..the md5 value can be used as it
                          were to encrypt the correct password entered, then used with blowfish
                          as the encrypt - decrypt key.

                          ..so you could always do a string.compare with the user password entered
                          (converted to md5 string) with the 'original approved' password(also md5'd)

                          HTH

                          PS the above two error codes are 'independant' of the autorun.exe codes
                          ..so you may need to drop the returning of tabled errors as above in WORMS's.

                          The returnable error codes are those stated in the Help doc for the Plugin..
                          Last edited by Guest; 01-28-2005, 10:50 PM.

                          Comment

                          • Intrigued
                            Indigo Rose Customer
                            • Dec 2003
                            • 6125

                            #14
                            Thanks for those suggestions guys.

                            I believe a solution for my purposes can work through a two-step process.

                            1. Decrypt the file to memory (Table)
                            2. Then test for the (Application.GetLastError() == 0) .. .. (or ~=0)

                            I'll report back my findings soon.

                            :yes
                            Intrigued

                            Comment

                            • csd214
                              Forum Member
                              • Oct 2001
                              • 939

                              #15
                              Some months ago I hastily tested the Crypto plug-in. "Easy to use this plug-in", I said and went on. – Where is my test project to day? Oh, I found it in Corey Lessons.am5.

                              Worm is right (surprised?). The help doc says:
                              Returns: Nothing. You can use Application.GetLastError() to determine whether this action failed, and why.

                              Code:
                              error = Application.GetLastError();
                              if (error ~= 0) then
                              	-- the error code might be 34000-34003 [SUF6NEWBIE's post]
                                  Dialog.Message("Error", "Wrong password\r\n"..
                                  "The error message is:\r\n"..
                                  "    ".._tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
                              	
                              else
                              	-- Ok, go on; do what you want
                              end
                              I discovered something important to day:
                              AVOID AN EMPTY STRING KEY; OTHERWISE THE EXECUTABLE WILL CRASH.

                              Code:
                              sSource = "AutoPlay\\Docs\\AMSdata.enc";
                              sDestination = "AutoPlay\\Docs\\AMSdata.txt";
                              sKey = Dialog.Input("Key", "Enter Key", "pos5t5v", MB_ICONQUESTION);
                              if sKey ~= "" then
                              	Crypto.BlowfishDecrypt(sSource, sDestination, sKey);
                              	-- test for error code
                              
                              else
                              	Dialog.TimedMessage("Error", "No password entered", 2000, MB_ICONINFORMATION);
                              end
                              Intrigued, thanks for asking your question!

                              Comment

                              Working...
                              X