Deutsch

Guide

Sign in with a QR code on Android handhelds: scan the password instead of typing it

Instead of typing user name and password on a handheld, you scan a QR code that holds both, encrypted, and enter a short PIN. In Industrial Kiosk Browser a small script does this without any change to the web app. Whoever copies the QR code can try a short numeric PIN quickly, though – letters and digits, 10 characters or more, last long.

By Jo Pfattheicher Software development, products and AI · ICT Baden · Last updated:

Why signing in on a handheld is so tedious

On a handheld the on-screen keyboard is small, people often wear gloves, and devices are handed over between shifts – so people sign in a lot. Long passwords with special characters take time, typos lock accounts. In practice this ends with notes stuck to the device or one shared account for everyone – both worse than a personal account that signs in quickly.

The options at a glance

  • Type the password

    Always works, needs nothing. Slow and error-prone on small keyboards; invites short or written-down passwords.

  • Barcode with the password in plain text

    Fast, but every scanner and every camera reads the password. Not recommended.

  • Sign-in through a central identity system with badge or NFC

    Strongest, if the web app supports such a system: hold the badge to the device, signed in. Needs infrastructure and support in the web app.

  • Encrypted QR code with PIN

    The middle way without changing the web app: user name and password are encrypted in the QR code and only decrypted with the PIN on the device. How well that protects depends on the PIN length – see “What the PIN protects”.

How signing in with a QR code works

  1. Create the QR code

    In the generator on this website enter user name, password and PIN, optionally an expiry date. The generator computes in the browser only, nothing is sent. Print the QR code, for example on the back of the badge; hand out the PIN separately.

  2. Open the sign-in page and scan

    On the device, the sign-in page of the web app is open in Industrial Kiosk Browser. The script takes the scan out of the page – the encrypted text never lands in a field – and asks for the PIN.

  3. Enter the PIN

    With the right PIN the script decrypts the code, fills user name and password into the form and presses the sign-in button. A wrong PIN is refused; after five wrong PINs in a row the script ignores login codes for 15 minutes.

Industrial Kiosk Browser with QR login: above the sign-in page the prompt “Sign in with QR code” with a PIN field, Cancel and Sign in.
PIN after the scan The login QR code is not typed into a field: the script asks for the PIN.

Technically: AES-256-GCM, the key comes from the PIN with PBKDF2-SHA256 and 600,000 iterations. A code is about 130 to 200 characters – a QR code every scan engine and the camera read. On a Zebra device with Android 15 decrypting takes about half a second. The format and the script are open, see the guide.

What the PIN protects – and what not

Whoever has QR code and PIN can sign in – so treat the code like a key. The PIN protects a lost code against quick tries on the device: after five wrong PINs there is a 15-minute pause. That lock lives in the page; it is a speed bump, not a lock.

Against someone who copies the QR code – a photo is enough – a short PIN helps little: they try on their own computer without a limit. The 600,000 iterations make each try slow, but a current graphics card still manages roughly 15,000 tries per second:

Time to try all PINs – estimate for one graphics card
PINPossibilitiesTime (approx.)
4 digits10,000under a second
6 digits1,000,000about a minute
8 digits100 millionabout 2 hours
10 characters, letters and digitsabout 8 × 10¹⁷far longer than any password lifetime

Order of magnitude from benchmarks for PBKDF2-SHA256, converted to 600,000 iterations; the generator shows the estimate for the PIN you enter.

  • Use it for accounts whose password you would also write on a card: personal accounts with only the rights needed on the handheld – not administrator accounts.
  • Where codes can be copied, use a longer PIN of letters and digits (10 characters or more).
  • Set an expiry date and create new codes after a password change – an old code then simply stops working.
  • When a code is lost: change the password of the account.

Trade-off: when QR login is worth it – and when not

Put plainly: with a strong password in a QR code behind a 6-digit PIN, for anyone who gets hold of the code the account is only as well protected as the PIN. QR login does not make a password stronger – it makes it more convenient. Whether that is a gain depends on what happens without it.

And there, practice often looks worse: whoever has to type long passwords on a handheld every day picks short ones, writes them on a note on the device or simply prints the password as an ordinary QR code – unencrypted, readable by every scanner and every phone camera. Against those shortcuts an encrypted code with a PIN is clearly better. Against a strong password that really gets typed, it is weaker.

  • Fits: accounts only for work on the handheld

    Separate accounts with few rights (goods receipt only, picking only), reachable only in the company network, on managed devices in kiosk mode – plus an expiry date and new codes with every password change.

  • Fits: where plain-text QR codes or notes are the alternative

    If passwords are already written down, printed as barcodes or shared between colleagues, the encrypted code with a PIN is the better choice – and usually the one that actually gets used.

  • Does not fit: the central company password

    If the password is the same as for email, computer and VPN, a copied code with a short PIN exposes all of that. Then set up a separate account for the handheld application – or do not use QR login.

  • Does not fit: administrator accounts and access from the internet

    Accounts with far-reaching rights, or sign-in pages reachable from outside without a second factor, do not belong on a card – not even encrypted.

  • Warning: obscurity is not security

    A QR code nobody can read looks safe – but it is only as safe as the PIN is long. The encryption (AES-256) is strong; the short PIN is the weak spot. That is why the format is deliberately open: security must not depend on nobody knowing how the code is built, only on the PIN. Whoever needs more protection uses a long PIN of letters and digits, or another option from “Options”.

Step by step: set up QR login in Industrial Kiosk Browser

  1. Add the script to the profile of the web app

    Take the script qr-login.js into the profile as a resource and add it as an injection for the sign-in page. It is ready to adapt in the example configuration qr-login.json.

  2. Name the fields if needed

    The script looks for usual field names such as username, fields of type email and the first password field. If the fields are named differently, an injection before it names the CSS selectors.

  3. Test on the device

    Open the sign-in page, scan the QR code, enter the PIN. If the keyboard does not open by itself, tap the PIN field once.

"injections": [
  { "match": { "url": "https://login.example.com/", "type": "prefix" }, "when": "pageLoaded", "js": "res:qr-login.js" }
]
The injection for the sign-in page (from the guide): res:qr-login.js is the script as a resource of the profile.
{ "match": { "url": "https://login.example.com/", "type": "prefix" }, "when": "pageLoaded",
  "js": "window.IKB_QR_LOGIN = { user: '#j_username', password: '#j_password', submit: true };" }
Naming your own fields: an injection before the script with user, password and submit; there are also maxTries and lockMinutes.

Requirement: the sign-in page runs over https. Encryption in the browser (WebCrypto) is only available on secure pages; on an http:// page the script says so and does nothing else. Sign-ins over several pages or with a second factor need their own selectors or a small change to the script – it only fills in user name and password.

Industrial Kiosk Browser with QR login: sign-in page with the user name m.weber filled in and the password hidden.
Signed in With the right PIN, user name and password are in the form – then the script presses “Sign in”.

Our product

Industrial Kiosk Browser – Kiosk browser for rugged Android devices

Kiosk browser for web apps on rugged Android devices: scans into the focused field, kiosk mode, allow list, JavaScript injections such as the QR login script, configuration through your MDM – open source, no device licence.

Status: Available

Frequently asked questions

Does the web app have to be changed to sign in with a QR code?

No. The script runs as an injection in Industrial Kiosk Browser, fills user name and password into the existing sign-in form and presses its sign-in button. The page only has to run over https.

Isn’t a QR code with a password insecure?

In plain text, yes. Here it is encrypted with AES-256, and only the PIN gives the key. How long that holds against someone who copies the code depends on the PIN: a 6-digit numeric PIN is tried in about a minute, letters and digits with 10 characters or more last far longer.

Is a QR code with a PIN more secure than a strong password?

No – against someone who copies the code it is only as strong as the PIN. It is more convenient, and far more secure than a written-down password or a password as an unencrypted QR code. It fits accounts with few rights on managed devices, not the central company password or administrator accounts.

Are password or PIN sent anywhere?

No. The generator encrypts in the browser, the script decrypts on the device. Only what the sign-in form of the web app sends anyway is sent.

What happens with a wrong PIN?

The sign-in is refused. After five wrong PINs in a row the script ignores login codes for 15 minutes. That lock does not protect against a copy of the code – only a long PIN does.

Does a QR login code expire?

If an expiry date was set when it was created, yes: after that the script reports the code as expired. Without one it is valid until the password of the account changes.

Portrait of Jo Pfattheicher

About the author

Jo Pfattheicher – Software development, products and AI, ICT Baden

Jo Pfattheicher builds the products of ICT Baden and takes care of releases and testing. Before that he worked as head of IT and security officer in IT companies – he knows how software is rolled out, secured and operated in large environments.

More about us

More guides

QR Code is a registered trademark of DENSO WAVE INCORPORATED; Android is a trademark of Google LLC; JavaScript is a trademark of Oracle. Industrial Kiosk Browser is an independent product of ICT Baden.

Contact

Questions about your setup?

Tell us what you are looking for – we will get back to you personally.

info@ict-baden.de +49 172-7207196

Seboldstraße 9, 76227 Karlsruhe, Germany · Directions (PDF, German)