monich / harbour-foilauth

Secure OTP (One-Time Password) generator for Sailfish OS
https://openrepos.net/content/slava/foil-auth
Other
11 stars 7 forks source link

unable to QR scan some totp codes, tutanota example #11

Closed zaggynl closed 4 years ago

zaggynl commented 4 years ago

Attached QR code cannot be scanned with Foil Auth yet.

-example removed-

monich commented 4 years ago

I can't scan this QR code with Core Reader, either - probably because it's got pixel-resized in a weird way (so that different pixels have different sizes).

BTW, don't publish real OTP QR codes - they contain your authentication secret which you're not supposed to share with anyone.

zaggynl commented 4 years ago

Noted, I've removed the example. Please note that I'm able to scan the previously attached QR code fine with the google authenticator app.

monich commented 4 years ago

Too late, I've copied it :) But even after I cleaned it up and restored the original geometry, it still doesn't get recognized :/ It could be some kind of format not supported by ZXing QR code recognition machinery that I'm using (same as in Code Reader). I'll check if there are any updates somewhere that can fix this problem...

monich commented 4 years ago

Pulled in zxing updates, no luck :/

It actually recognizes it as a QR code but fails to decode it:

(gdb) bt
#0  zxing::Exception::Exception (this=0xab66d0e8, msg=0xaab845c8 "Error locator degree does not match number of roots") at zxing/Exception.cpp:34
#1  0xaab1dae8 in zxing::ReedSolomonException::ReedSolomonException (this=0xab66d0e8, msg=0xaab845c8 "Error locator degree does not match number of roots")
    at zxing/common/reedsolomon/ReedSolomonException.cpp:25
#2  0xaab1d5b0 in zxing::ReedSolomonDecoder::findErrorLocations (this=0xab534d60, errorLocator=...)
    at zxing/common/reedsolomon/ReedSolomonDecoder.cpp:148
#3  0xaab1cb74 in zxing::ReedSolomonDecoder::decode (this=0xab534d60, received=..., twoS=22) at zxing/common/reedsolomon/ReedSolomonDecoder.cpp:61
#4  0xaab659ea in zxing::qrcode::Decoder::correctErrors (this=0xab534d60, codewordBytes=..., numDataCodewords=18)
    at zxing/qrcode/decoder/QRDecoder.cpp:55
#5  0xaab65c5a in zxing::qrcode::Decoder::decode (this=0xab534d60, bits=...) at zxing/qrcode/decoder/QRDecoder.cpp:98
#6  0xaab5a5fc in zxing::qrcode::QRCodeReader::decode (this=0xab534d58, image=..., hints=...) at zxing/qrcode/QRCodeReader.cpp:39
#7  0xaab06a1c in zxing::MultiFormatReader::decodeInternal (this=0xab66b408, image=...) at zxing/MultiFormatReader.cpp:143
#8  0xaab063ae in zxing::MultiFormatReader::decode (this=0xab66b408, image=..., hints=...) at zxing/MultiFormatReader.cpp:61
#9  0xaaaf46be in Decoder::Private::decode (this=0xab4e6e60, aSource=...) at Decoder.cpp:163
#10 0xaaaf488e in Decoder::decode (this=0xd93da940, aSource=...) at Decoder.cpp:188
#11 0xaaaf1594 in BarcodeScanner::Private::decodingThread (this=0xaae95c28) at BarcodeScanner.cpp:337

Since I didn't write that, it's hard for me to tell what error locator degree is and why it doesn't match number of roots :/

And yet, zxing Android app does read that QR code. It's a different codebase though. AFAICT the java version of zxing is the original and the C++ variant that I used is some kind of rewrite, slightly resembling the original Java version....

monich commented 4 years ago

I've found some differences between C++ and Java code, copied them over and now your QR code gets decoded \o/

It was some sort of "inverted" QR code.

monich commented 4 years ago

Try version 1.0.7, it should fix the problem. The build is already uploaded to OpenRepos and will appear in Jolla Store too, some time next week.

zaggynl commented 4 years ago

Thanks! Will try once it appears in Jolla Store.

monich commented 4 years ago

Does it work now? Can this issue be closed?

zaggynl commented 4 years ago

Sorry about that, yes it is working now, thank you.