EPIC QR Code Decoder
Go to file
Nemo b23a084ee5 version: 0.9.2 2024-01-06 09:35:57 +05:30
src/eci fix package paths 2024-01-06 09:35:46 +05:30
.gitignore initial commit 2024-01-05 21:52:42 +05:30
LICENSE initial commit 2024-01-05 21:52:42 +05:30
README.md Add a spec 2024-01-05 23:28:59 +05:30
build.hxml minor changes 2024-01-05 22:56:40 +05:30
extraParams.hxml initial commit 2024-01-05 21:52:42 +05:30
haxelib.json version: 0.9.2 2024-01-06 09:35:57 +05:30
release.sh initial commit 2024-01-05 21:52:42 +05:30

README.md

EPIC QR Decoder

Haxe library to decode a QR code on a modern EPIC Card.

TODO

  • Tests.
  • Publish 1.0.
  • Publish releases in other languages.

Usage

import eci.EpicQR;

class Main{
	static function Main(){
		var result = decrypt("Kk0pDEzxYcusltFhJmqL/LLzJtXYHH/a1rJfkK2GjzA1x5jrzaeT1ULEF38L7/lIQ8w3c+H4ePeuVs2HuMYDUg==");
		trace(result.epic);
		trace(result.id);
	}
}

Specification

QR Generation

  1. Generate the input as {"epic_no":"[[EPIC_NO]]","unique_generated_id":ID}. Note that this is not parsed as JSON, so the string needs to be exactly 51 characters long. The EPIC itself uses LUHN algorithm in the numeric part (11th digit is a checksum of the 4-10th character). Sample: NCS1234566 (LUHN(123456) = 6)
  2. Encrypt the input using AES.CBC/PKCS5, with a static KEY and IV (See src/EpicQR.hx for values).
  3. Encode the output as base64. 4 .Generate a QR code with low error correction level.

QR Decoding

  1. Scan the QR Code
  2. Decode using base64.
  3. Decrypt using AES/CBC/PKCS5, with a static KEY and IV (See src/EpicQR.hx for values).
  4. Parse as JSON
  5. Extract epic_no and unique_generated_id keys inside the JSON object.

LICENSE

Licensed under MIT. See LICENCE file for more details.