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
- 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) - Encrypt the input using AES.CBC/PKCS5, with a static KEY and IV (See
src/EpicQR.hxfor values). - Encode the output as base64. 4 .Generate a QR code with low error correction level.
QR Decoding
- Scan the QR Code
- Decode using base64.
- Decrypt using AES/CBC/PKCS5, with a static KEY and IV (See
src/EpicQR.hxfor values). - Parse as JSON
- Extract
epic_noandunique_generated_idkeys inside the JSON object.
LICENSE
Licensed under MIT. See LICENCE file for more details.