Search code examples
qr-codezxingflutter-qrcode

QR Code URL data not readable or encrypted


There is an app which I use, which can read the name of a location from a qr code.

Recently, the qr code was changed so that the name of the location is no longer readable by zxing or any other barcode reader that I can find. Instead, I get a long string of numbers and letters. (The data that I need comes after the '&ln=' or '&eln=' in the url that is returned.)

The first example below is the new qr code. It returns the following URL: https://mysejahtera.malaysia.gov.my/qrscan?lId=62419209a90dcd50091c36cb&eln=TW9qaXRvJ3MgQmVlciBCYXI=&formType=REGULAR&isExternal=false

Non-plain text / encrypted qr code

The second one returns this: https://mysejahtera.malaysia.gov.my/qrscan?lId=5edc745eb9e6850245c07e4b&ln=Osdin_Lighting_Enterprise

Human readable

The original app can read the long location string in both the encrypted and human readable format. I want to be able to do the same. For example, the location of the first url is "Mojito's Beer Bar." The original app can read this and displays it correctly.

My feeling is that there must be a private key encryption which the app used to decipher the code. However, is it possible that there is a simple reason that a normal barcode/qrcode reader can't get the plain readable location text?

All I am looking for here is some pointers of where I should be looking. I have the decompiled source code from the MySejahtera app and have been digging through it without any luck. I'm happy to share this if anyone would be willing to help.


Solution

  • The "encoded" URL contains the value TW9qaXRvJ3MgQmVlciBCYXI= for the attribute eln. This is obviously a Base64 encoded value.

    If you run the value through a Base64 decoder (e.g. https://www.base64decode.org/), the result is:

    Mojito's Beer Bar
    

    Base64 doesn't specify what text encoding is used. But likely it is UTF-8.