Page 2 of 2

Re: Base64decode causing decrypt fault on Android?

Posted: Sat Jun 09, 2018 9:28 pm
by sphere
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 :?

Re: Base64decode causing decrypt fault on Android?

Posted: Sun Jun 10, 2018 12:13 pm
by sphere
Hi i tested some things and this works OK on Android.
Android SSL test.zip
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.

Re: Base64decode causing decrypt fault on Android?

Posted: Sun Jun 10, 2018 7:33 pm
by sphere
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.

Re: Base64decode causing decrypt fault on Android?

Posted: Sun Jun 10, 2018 7:46 pm
by bwmilby
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

Re: Base64decode causing decrypt fault on Android?

Posted: Sun Jun 10, 2018 8:19 pm
by sphere
Thanks Brian, i copied it and will take a look at it. See if i can use it.