Last active
May 14, 2017 13:36
-
-
Save landgenoot/609ec9fed009f48d78b5321909b6e734 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
from pypassport import epassport, reader | |
from pypassport import fingerPrint | |
from pypassport.doc9303 import converter | |
import os | |
import base64 | |
from ecdsa import VerifyingKey, BRAINPOOLP320r1 | |
from hashlib import sha256 | |
MRZ = "" | |
r = reader.ReaderManager().waitForCard(10) | |
ep = epassport.EPassport(r, MRZ) | |
ep.doBasicAccessControl() | |
data = b'hahahaha' | |
signature = ep._iso7816.internalAuthentication(data) | |
public = ep._getDG(15).body | |
# Public key must be extracted from ASN1 structure in public | |
vk = VerifyingKey.from_string(str(bytearray.fromhex("BA84829F88E4FB32CCE40FD11BD324A1333CD4C2D22F20A764B8ED7F35D28F3683670A1F7877468A35F773AB8B88E565F28C9C878BE1E60C5A3A6D0C1D4BB261AB7D8A2E7F9077627C3AXXXXXXXXXXXX")), curve=BRAINPOOLP320r1) | |
print vk.verify(signature, data, hashfunc=sha256) # True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment