epicqr

Scan a EPIC QR code in an Indian Voter ID
https://github.com/captn3m0/epicqr

To install, run:

haxelib install epicqr 0.9.2 

See using Haxelib in Haxelib documentation for more information.

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.

Contributors
captn3m0
Version
0.9.2
Published
2 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂