How can I get cleartext values from a Central configuration QR code?

I have a Central configuration QR code. How can I get cleartext values from it?

I have removed the QR code image because it appears to contain real credentials. In general, Collect configuration QR codes should be treated as confidential.

You used the word "decrypt" in your original question. There is no encryption on QR codes, they are compressed clear text.

https://docs.getodk.org/collect-import-export/#making-your-own-qr-code describes how to build a QR code that Collect can read. You can use the reverse process to get values out of an existing QR code. Can you please describe what your use case is?

FWIW, I do this rather a lot - mainly to extract the server_url for programmatic OpenRosa API requests. So what I do (on Mac) is:

  1. Get your App User's QR code image from Central's (Legacy or Managed) and decode the image online; eg https://zxing.org/w/decode.jspx

  2. Copy QR=’xxx’ from above. This is the raw base64 text encoded by the QR image.

  3. brew install pigz
    Although I try to avoid pulling in additional packages unless absolutely necessary, unzipping stdio on macOS is remarkably a bit of a PITA, but pigz makes it trivial.

  4. echo $QR | base64 --decode | pigz -d -c
    This will give you the decoded JSON with all the Collect settings. eg for a ‘Managed’ style QR code:

    {"general":{"server_url":"``https://central.my.org/v1/key/XXXXXYYYYYZZZZZ/projects/16","form_update_mode":"match_exactly","autosend":"wifi_and_cellular"},"project":{"name":"``Xiphware"},"admin":{}}

Optional: I like my JSON pretty, so I pipe it thru jq. jq also lets me parse out exactly what I want.

echo $QR | base64 --decode | pigz -d -c | jq .general.server_url
"https://central.my.org/v1/key/XXXXXYYYYYZZZZZ/projects/16"

Be aware that the QR code contains real credentials so you need to trust the service that is decoding the image. A more secure solution is to decode the QR code locally with a command line tool. I use zbarimg on linux, and I think zbar is the equivalent for mac.

Yup.

brew install zbar
zbarimg -q MyQR.png | cut -f2 -d: | base64 --decode | pigz -d -c | jq .general.server_url
"https://cental.my.org/v1/key/XXXXXYYYYYZZZZZ/projects/6"

Note, zbar will install a lot of dependencies. (BTW I’m using homebrew to install these sundry utility packages on macOS).