Base64decode causing decrypt fault on Android?

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

sphere
Posts: 629
Joined: Sat Sep 27, 2014 10:32 am
Location: the Netherlands

Re: Base64decode causing decrypt fault on Android?

Post by sphere » Sat Jun 09, 2018 9:28 pm

Thanks Brain for your testing.

I was not able yet to continue on the quest, i had to finish some other things first concerning the GPDR law.
I want to change my test stack and use the same piece of code which works on windows, and do a basic test and build from there. But i already know that encrypting and decryptng itself is not a problem on Andorid. It's where the Base64Encode/decode comes in. So i will try your suggestions, and also the one from Hermann.

Hopefully i can get started tomorrow, today was really busy. Had to go to an Amusement park with the family and ride the Rollercoaster :lol: 8) :lol: as it was a special day, turning 23 again for the 2nd time :?
Please, stop quoting things my brother did not say. Thank you. Hans Zweistein.

sphere
Posts: 629
Joined: Sat Sep 27, 2014 10:32 am
Location: the Netherlands

Re: Base64decode causing decrypt fault on Android?

Post by sphere » Sun Jun 10, 2018 12:13 pm

Hi i tested some things and this works OK on Android.
Android SSL test.zip
(3.09 KiB) Downloaded 13 times
So the actual fault must be found elsewhere.
Perhaps i made a mistake somewhere, although most is copy/paste, but you never know
or something goes wrong with writing/reading to the database.
There is no conversion in the PHP files, just plain insert or update to DB.

At least i know it's not an LC fault.

Some further investigation to do. I'll keep Hermann's suggestion in mind, maybe i will need it when doing the base64Encoding.

I will update when i find the issue.

Thank you all,
Sphere.
Please, stop quoting things my brother did not say. Thank you. Hans Zweistein.

sphere
Posts: 629
Joined: Sat Sep 27, 2014 10:32 am
Location: the Netherlands

Re: Base64decode causing decrypt fault on Android?

Post by sphere » Sun Jun 10, 2018 7:33 pm

Ok i found where it has troubles, especially on Android.
It's the password and the salt i use. These also give some trouble when copy/pasting them to another script.
(although i checked that the copied string was exactly the same)

For the password i use :

Code: Select all

put textEncode(tSomething, "UTF-8") into tMessage
   get messageDigest(tMessage, "SHA3-256") 
and the Salt:

Code: Select all

 put randomBytes(20) into tS
Either of them can create characters which cause the Final Block Length fault

If i use simple normal words like "thisisapassword" and for salt "zout" then it simply works

So this means i have to change how i will generate a password
Thanks.
Please, stop quoting things my brother did not say. Thank you. Hans Zweistein.

bwmilby
Posts: 181
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

Re: Base64decode causing decrypt fault on Android?

Post by bwmilby » Sun Jun 10, 2018 7:46 pm

If you are doing it that way, the use key instead of password. And add the salt to the password before generating the key. Or, just pull my PW demo stack and use the hmac function.

https://github.com/bwmilby/lc-misc/blob ... codescript
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

sphere
Posts: 629
Joined: Sat Sep 27, 2014 10:32 am
Location: the Netherlands

Re: Base64decode causing decrypt fault on Android?

Post by sphere » Sun Jun 10, 2018 8:19 pm

Thanks Brian, i copied it and will take a look at it. See if i can use it.
Please, stop quoting things my brother did not say. Thank you. Hans Zweistein.

Post Reply

Return to “Bug Triage”