def test_signature_authkey(card): msg = b"Sign me please to authenticate" pk = card.cmd_get_public_key(3) pk_info = (pk[9:9 + 256], pk[9 + 256 + 2:9 + 256 + 2 + 3]) digest = rsa_keys.compute_digestinfo(msg) sig = int(hexlify(card.cmd_internal_authenticate(digest)), 16) r = rsa_keys.verify_signature(pk_info, digest, sig) assert r
def test_signature_sigkey(card): msg = b"Sign me please" pk = card.cmd_get_public_key(1) pk_info = (pk[9:9 + 256], pk[9 + 256 + 2:9 + 256 + 2 + 3]) digest = rsa_keys.compute_digestinfo(msg) sig = int(hexlify(card.cmd_pso(0x9e, 0x9a, digest)), 16) r = rsa_keys.verify_signature(pk_info, digest, sig) assert r
def verify_signature(): scc.result = rsa_keys.verify_signature(scc.pubkey_info, scc.digestinfo, scc.sig)