User Tag List

Results 1 to 6 of 6

Thread: AESFusion on Android and PHP

  1. #1
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    AESFusion on Android and PHP

    I am trying to develop an application for Android that talks to a PHP backend. I had anticipated using a shared private key to encrypt/decrypt data between the Android app and the PHP backend. Whenever I encrypt a string on Android and send it to the PHP backend for decryption, the shared private key does not decrypt the string properly. Does anyone have an example of the code I can use in PHP that correlates to the encryption that AESFusion object does on Android? I searched the threads but I may not have been using the right keywords to uncover this little bit of information.

    Thanks

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    SoftWarewolf's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    941
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I recommend obfuscating the values, as local encryption can easily be broken.
    There is no problem sending the values in clear text if you include a verification string, just use a bunch of different parts of the variables and md5 it with string parser.
    Then do the same on the php side to check that it matches up.

    f.ex you send
    score: 500
    level: 4
    random: 123456

    and verification, which is something like: md5((score*2)+(level*5)+random-1337)
    the more complicated the better.

    so you'll send 4 variables instead of 3, but an md5 is always only 32 characters and it protects all the variables you use to build it, if any variable is changed the two md5 will not match.

    if you want it really secure you can do two requests where the server first sends values to the client to play with.
    it works something like this:

    client: id like to submit a score please
    server: sure, i randomly generated the numbers 45346245, 324456, and 234356 for you and put this in a database with id X.
    client: no problem, id was X, my score is 1000 and using the score, id, and the 3 numbers with crazy obfuscation i end up with md5 verification key "e4d909c290d0fb1ca068ffaddf22cbd0"
    server: that's a match, request complete, thanks!

  3. #3
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I didnt include my plans to MD5 hash most of my data to make the example less complicated. Personally, I like the way you outlined this, and I definitely plan on this strategy for the local data. What I am looking for, though is how I can take the data and bundle it up (MD5 hashed or no) encrypt this with a private key so that I can send it to the PHP server and have the server decrypt that data using the same shared key on that side.

    So the flow goes like this:
    -package the data in a string "|data1|data2|md5(data3)|random data|"
    -encrypt string with key
    -POST to PHP server
    -On php server, decrypt string with key
    -store data including compare MD5 hash with data already stored

    The problem I am running into is I cant seem to decrypt the string with the key using PHP and get the same data I put into it on Android.

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    Ls2's Avatar
    Join Date
    Jun 2011
    Location
    Maceió - Brazil
    Posts
    927
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    A question: how are you creating a md5 hash in Android application?

  5. #5
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2014
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The string parser has an MD5 signature function.

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    Ls2's Avatar
    Join Date
    Jun 2011
    Location
    Maceió - Brazil
    Posts
    927
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Thank you, ReaperHGN!

Similar Threads

  1. AESFusion - please support iOS
    By wpd in forum Fusion 2.5
    Replies: 5
    Last Post: 22nd May 2016, 03:14 PM
  2. Beta: AESFusion
    By James in forum Extension Development
    Replies: 11
    Last Post: 12th November 2012, 03:01 PM
  3. AESFusion in Flash SWF
    By turtle in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 13th October 2010, 04:03 AM
  4. AESFusion
    By James in forum SWF/Flash Extensions
    Replies: 0
    Last Post: 19th March 2010, 03:17 PM
  5. Beta: AESFusion
    By James in forum File Archive
    Replies: 0
    Last Post: 21st January 2010, 04:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •