tests/ update for signature counter

This commit is contained in:
NIIBE Yutaka
2016-10-15 18:35:21 +09:00
parent 4de605ed63
commit 350528e1f4
2 changed files with 13 additions and 2 deletions

View File

@@ -64,8 +64,8 @@ def test_url(card):
assert check_null(url) assert check_null(url)
def test_ds_counter(card): def test_ds_counter(card):
c = get_data_object(card, 0x93) c = get_data_object(card, 0x7a)
assert c == None or c == b'\x00\x00\x00' assert c == b'\x93\x03\x00\x00\x00'
def test_pw1_status(card): def test_pw1_status(card):
s = get_data_object(card, 0xc4) s = get_data_object(card, 0xc4)

View File

@@ -136,6 +136,13 @@ def test_timestamp_3_put(card):
r = card.cmd_put_data(0x00, 0xd0, timestamp3) r = card.cmd_put_data(0x00, 0xd0, timestamp3)
assert r assert r
def test_ds_counter_0(card):
c = get_data_object(card, 0x7a)
assert c == b'\x93\x03\x00\x00\x00'
def test_pw1_status(card):
s = get_data_object(card, 0xc4)
assert match(b'\x01...\x03[\x00\x03]\x03', s, DOTALL)
def test_public_key_1(card): def test_public_key_1(card):
pk = card.cmd_get_public_key(1) pk = card.cmd_get_public_key(1)
@@ -247,6 +254,10 @@ def test_sign_1(card):
sig_bytes = sig.to_bytes(int((sig.bit_length()+7)/8), byteorder='big') sig_bytes = sig.to_bytes(int((sig.bit_length()+7)/8), byteorder='big')
assert r == sig_bytes assert r == sig_bytes
def test_ds_counter_1(card):
c = get_data_object(card, 0x7a)
assert c == b'\x93\x03\x00\x00\x02'
def test_sign_auth_0(card): def test_sign_auth_0(card):
digestinfo = rsa_keys.compute_digestinfo(PLAIN_TEXT0) digestinfo = rsa_keys.compute_digestinfo(PLAIN_TEXT0)
r = card.cmd_internal_authenticate(digestinfo) r = card.cmd_internal_authenticate(digestinfo)