tests/ update for signature counter
authorNIIBE Yutaka <gniibe@fsij.org>
Sat, 15 Oct 2016 09:35:21 +0000 (18:35 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Sat, 15 Oct 2016 09:35:21 +0000 (18:35 +0900)
tests/test_empty_card.py
tests/test_personalize_card.py

index db22521..72a63ad 100644 (file)
@@ -64,8 +64,8 @@ def test_url(card):
     assert check_null(url)
 
 def test_ds_counter(card):
-    c = get_data_object(card, 0x93)
-    assert c == None or c == b'\x00\x00\x00'
+    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)
index 5914f7c..0f1a251 100644 (file)
@@ -136,6 +136,13 @@ def test_timestamp_3_put(card):
     r = card.cmd_put_data(0x00, 0xd0, timestamp3)
     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):
     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')
     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):
     digestinfo = rsa_keys.compute_digestinfo(PLAIN_TEXT0)
     r = card.cmd_internal_authenticate(digestinfo)