Size of textual version

  • New Wordpress Plug-In Forum
    Guest:

    Just a note that we have a new forum to contain discussions relating to the Wordpress plug-in which Daniel Persson originated and has been making great progress on. You'll find it under "Server-Side Solutions."

    /Steve.

Dale Quick

New member
Mar 9, 2019
1
0
Why does the textual version printed from the Android client have 5 * 14 + 8 =78 characters and the one printed from the Windows client have 5 * 5 + 8 = 33 characters?
 

shanedk

Well-known member
May 20, 2018
317
86
Did you rekey? Or maybe Daniel forgot not to include the password with the textual export?
 

sengsational

Well-known member
Feb 17, 2019
115
34
I didn't mean to post that at all, especially from my test ID! But now the cat is out of the bag.

The textual version from when I created my identity on the Android client says "rescue code only version" and is (5 * 14) * 4 + 8 = 288 in size.

The textual version on the Windows client is (5 * 5) * 4 + 8 = 108 in size.

Never rekeyed. If the textual version is available with and without the password, that might explain it.
 

shanedk

Well-known member
May 20, 2018
317
86
The textual version is NEVER supposed to have the password-encrypted version.
 

shanedk

Well-known member
May 20, 2018
317
86
If you restore the ID from the longer textual version, can you unlock it with the same password? If so, we have our answer and this is a bug. If not, something else is going on and we'd need an answer from Daniel as to what else he's putting in there.

SQRL clients can use the S4 system to store other information, and this would make the textual export longer, but they need to be transparent when they do so.
 

kalaspuffar

Well-known member
May 19, 2018
269
91
Sweden
coderinsights.com
Hi.

I will look into this but have not had the time yet. Time flies when you have fun. Been celebrating my birthday so....

But perhaps I can look at it this evening or tomorrow.

The text should only contain part 2 and 3 of the storage system. So the rescue code part and the previous keys.

It might be that there has snook in an error when I added the "without password" feature but I don't know at the moment.

Best regards
Daniel
 

kalaspuffar

Well-known member
May 19, 2018
269
91
Sweden
coderinsights.com
Hi @sengsational

I need more information on how to reproduce this error.

I have a identity made by Steve's client, I printed it to paper 107 characters = 73 bytes. No rekey information.

I typed it in and scanned. The same text was presented after scan. The same goes for all prints and showing of the identity.

Best regards
Daniel
 

sengsational

Well-known member
Feb 17, 2019
115
34
Daniel, My flow was as follows:

  • Install Android Client (for the first time)
  • Follow new identity set-up process on Android client
  • Printed identity (with password option) to generate PDF
 

Dave

Well-known member
May 19, 2018
388
73
Gardner, MA
Hi @sengsational

Ok, so the created identity in Android are larger than on windows. Interesting, will try it.

Best regards
Daniel
I just tried:
  1. created a new identity using the Android client.
  2. exported / printed the new identity with the password from my phone
  3. scanned the printed identity into my desktop using the GRC client and webcam
  4. printed the new identity from the GRC client:
201
 

Dave

Well-known member
May 19, 2018
388
73
Gardner, MA
I just tried:
  1. created a new identity using the Android client.
  2. exported / printed the new identity with the password from my phone
  3. scanned the printed identity into my desktop using the GRC client and webcam
  4. printed the new identity from the GRC client:
Same results in the other direction as well. Hmmm...
 

kalaspuffar

Well-known member
May 19, 2018
269
91
Sweden
coderinsights.com
Hi everyone.

There is one thing that is strange though. When I export a longer rekeyed identity (rekeyed 3 times with the windows client)

I actually get a different result. But just barely.

Seems @Steve added some extra error correction at the end of the identity to be able to show all green in the GUI.
I followed the guide that was available to me and no mentioned about this was present. So for my identity when I create it in the android client the last row is

wKSd jHcZ mnaM egiE p

but when @Steve creates the same identity in the windows client it ends with

wKSd jHcZ mnaM egiE 2t

The import and export works fine though but you can't import the text I create in the Android client into the windows client because the last CRC does not match.

Best regards
Daniel
 

sengsational

Well-known member
Feb 17, 2019
115
34
Hi @sengsational

Ok, so the created identity in Android are larger than on windows. Interesting, will try it.
Actually, the failure I'm testing is not using anything from the Windows client. It is all on the Android client.

The first (critical) step to duplicating the problem is to delete the Android client, re-install, and go through setting up an identity. Then, when you print the PDF, it has 207 characters (unexpected...should have fewer).

Once you get out and go back into the app (and SQRLStorage.needsReload() is true), then going into the PDF shows the PDF with fewer (107+/- ) characters, as expected.

Writing this post gave me an idea...I'll report back shortly.
 

shanedk

Well-known member
May 20, 2018
317
86
Seems @Steve added some extra error correction at the end of the identity to be able to show all green in the GUI.
I followed the guide that was available to me and no mentioned about this was present.
The way it works (my idea! Just bragging ;)) is that the other 19 characters of the line, plus the line number (IIRC, one byte 0-based appended to the end; Steve's addition) are fed through SHA256, and the result is modded with 56 to get the check char.

I seem to remember discussion of an alteration where the entirety of the previously entered text, including those on previous lines (but not the check char) would be hashed, but I'm not sure if that ended up being implemented or not. If the above doesn't work, try this.
 

sengsational

Well-known member
Feb 17, 2019
115
34
Writing this post gave me an idea...I'll report back shortly.
As I suspected, if I forced a storage.read() before the textual version was printed, it printed the right thing. I'm not sure exactly where the best place (in the code) would be to do this forced read, or if, rather than force a read, the exact problem with the state of SQRLStorage at the time of first identity creation can be identified. But to be sure, when I forced read before the text was created, it created the right length of output. Here's the quick and dirty way I "fixed" it:
 

Attachments

sengsational

Well-known member
Feb 17, 2019
115
34
If you can reproduce the issue again with an ID you don't mind publishing, the exact steps and the resulting text would, of course, be invaluable.
This only happens on a new install. It looks like the testing you've done involves making a new identity. To recreate, you'd need to uninstall the app, reinstall, then go through setting up a new identity and try the PDF print option.
 
  • Like
Reactions: Dave