AES Encryption and Setting Result In Editbox

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I'm using the AES Encryption object as well as the blowfish object. I have three editboxes: one for encryption key, one to enter the text the user wants to encrypt, and one that is to display the encrypted text. There's two buttons. One next to the editbox for the key which uses the Random Key feature in the Blowfish object to create a random 16-character key (as the AES object only supports up to a 16-character key).

    When you press the random key button it creates a random key and does display the random key text in the editbox. My issue is when I go to encrypt what is typed in the second editbox and press the Encrypt button it does not display the encrypted text in the third editbox. Btw, both second and third editboxes are set as multiline boxes.

    For the editbox where it's supposed to display the encrypted text I have tried doing this a few ways. One way was to set the text the user types in as Alterable String B. Then, set Alterable String C to use the AES encrypted object, which would pull the data from Alterable String B as to what to encrypt. Then in the last editbox set the text to Alterable String C. If I do it that way the app crashes.

    The other way is to just set the text in the third editbox to use the AES object which would encrypt the get text of the second editbox and don't set the text in the second textbox as an alterable string. That doesn't crash the app but it doesn't display anything in the third text box.

    Please login to see this link.

  • As soon as I go to run the application it crashes. Actually, I don't even have to run it. If I go to the Event Editor MMF2 Dev crashes. In the crash details it sites the strgenobj.mfx file. Something with that object is causing MMF2 Dev to crash.

    Please login to see this link.

  • I'm guessing it's maybe the order of the events.. Or possibly the way information is being handled. While working on my own encryption program using the AES Object I have noticed if you sometimes put events in the wrong order or not handle strings properly I will get crashes (but on start of application), never on event editor.

    Specifically, the event editor does not crash until I put my mouse over the box of the editbox on the area that generates the 128-bit key. I can put my mouse over all the other events with no problems.

    Still trying to figure out my initial problem.. That is getting the encrypted data in to the editbox.

    Please login to see this link.

  • Okay, that's bizarre. There are only two events to the entire program, both activated by the buttons.

    Maybe there's something with the String Generator object and build 251? I still use build 249.

    I have made a new version, replacing the String Generator with the Blowfish object to generate the keys.

    Please login to see this link.

  • I've tested out the String Generator Object and it is not the object that is causing the crash. I created a small app that will generate a 16-character random string (letters, numbers, and symbols) and then set that value to an editbox.

    Please login to see this link.

    Please login to see this link.

  • I don't know what the exact problem was with my original encryption application however, I have fixed it. Instead of having the Blowfish Object generate the random key, I used the String Generator Object to generate the random string.

    I then proceeded to encrypt the data and set the encrypted text excatly the same way I did it originally. The original end result was that the editbox where the encrypted text was supposed to be would end up being blank. Now that I've used the String Generator Object, for some reason, everything works fine.

    The only real difference it in the original app I set the random key as a string. In this one I don't have to do this because when I go to set the key for the AES Object I just get the value from the String Generator of "GetLastGeneratedString." Therefore the AES Object is pulling the information directly from the other object rather than by pulling it from an Alterable String. Not sure if or why it would make a difference. Just my theory.

    If anyone has a theory or an actual reason why please share it. While I like to see my ideas work I also like to understand why my ideas don't work.

    Thanks Richard for suggesting the use of the String Generator Object. For a while now I was wondering how to generate random text without using anything complex in the Expression Editor. The String Generator Object did the trick. :D

    Please login to see this link.

  • Heh, your .MFA with the String Generator object in it won't work here. It doesn't crash, it just fails to produce any output. Perhaps we have different versions of the String Generator object. Without a doubt this object was involved somehow in the crashing of my example application, the error object even references the strgenobj.mfx file.

    I cannot say why your application wouldn't work before with the Blowfish object, unless the key somehow contained some illegal character or were not 16 characters in length. I'm glad it worked out, though.

  • I downloaded it today from the link provided on the Fusion Wiki site:

    Please login to see this link.

    Maybe it also might have something to do with your MMF2 version. Try updating it to 251 and see if that helps. After a little thought on the Blowfish random key issue I remember reading either on the forums or in the help file that the Blowfish Random Key Generator feature sometimes produces characters that are not viewable.

    I took this in to consideration when designing the first version of the app. I stored the random key as an Alterable String and then when it displayed in the editbox I pulled the info from the Alterable String. When I set the key I made sure to pull the data straight from the Alterable String and not from the editbox as I knew there may be some characters that were generated by the Blowfish Random Key Generator that would not be picked up in the editbox.

    In any case, all is working great. I even compiled the app to an exe to see if it will work outside of the safe MMF2 environment and it works fine.

    Please login to see this link.

  • I'm guessing it may have to do, possibly, with the order or way the expressions were entered in that first condition. I can mouse over and modify all the other conditions except for that first one.

    I did notice one thing. The way you limited the edibox text to 16 characters was using Len. There's another way. The way I do it is I do a condition of "At Start of Frame" I right click under the editbox that's for the key, go to Control > Limit text size, and then set the value to 16.

    Please login to see this link.

  • It was the same thing for me in your example, the actions referencing the String Generator object could not be viewed or edited. With the newer version of the object the example behaved as intended.

    The reason I chose the Len method is because it will also prevent the use of keys shorter than 16 characters, which will no doubt happen at some point if users are allowed to specify their own keys.

  • That's interesting about the 16 characters. And I just learned something new on how to limit characters +/- character lengths. Does the key have to be 16 characters or can it be less than 16 characters for AES?

    Please login to see this link.

  • Quote from RickyRombo

    Besides, I think the "Limit Text Size" doesn't prevent pasting more than 16...

    I've tested it out and only "Limit Text Size" will prevent more than 16 characters in the editbox. It doesn't matter whether you manually type in the characters or attempt to paste more than 16 characters. If you past more than 16 characters with "Limit Text Size" then only the first 16 characters will paste.

    Len does not prevent more than 16 characters from being typed or pasted. It is good, however, if you want to create a condition that checks to see if there's more than 16 characters in the editbox and then lets a person know (string, dialog box, etc) that they have too many characters in the editbox.

    You can also use Len as Richard has used it. Use it as a condition so that if the characters exceed the limit specified in Len then it does not perform the action (i.e. encrypt the text).

    Please login to see this link.

  • Yes. I think in such cases it would be best to check the contents of the input in a condition to prevent the AES object from performing its actions unless the key is correct, and also to implement some routine to warn the user if they type in a key that is not the requred length.

    Just to make sure, the key for AES 128 must be exactly 16 characters (128 bit) long.

  • Hi Everybody,

    a few months ago i developed an Encryption/Decryption-App. Perhaps someone would be interessted in testing it.

    The "Source" is for Free and can be edited to any extend. It could also be used as a Template for your own Encryption-App.

    Important: In that Build, the "File-Encryption" is not implemented yet (code-wise), but the Controls are already on the GUI. The String-Encryption/Decryption and saving of Keys does already work.
    I' ve implemented some "advanced" features already like checking for correct Key-Length and checking for duplicated Key-Names. The Keys can also be stored to an encrypted Database for later usage.

    Here' s the MFA:

    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!