fix test/

This commit is contained in:
NIIBE Yutaka
2016-10-12 15:32:51 +09:00
parent 979992c046
commit f1773c146b
4 changed files with 21 additions and 10 deletions

View File

@@ -1,3 +1,9 @@
2016-10-12 Niibe Yutaka <gniibe@fsij.org>
* test/features/steps.py (cmd_reset_retry_counter): Fix.
* tool/gnuk_token.py (gnuk_token.cmd_reset_retry_counter): Fix.
(gnuk_token.cmd_select_openpgp): Fix P2.
2016-09-02 Niibe Yutaka <gniibe@fsij.org>
* src/configure (REVISION): Fix the detection of .git.

View File

@@ -36,7 +36,7 @@ def cmd_put_data(tag_str,content_str_repr):
@Given("cmd_reset_retry_counter with (.*) and \"(.*)\"")
def cmd_reset_retry_counter(how_str, data):
how = int(how_str)
scc.result = glc.token.cmd_reset_retry_counter(how, data)
scc.result = glc.token.cmd_reset_retry_counter(how, 0x81, data)
@Given("a RSA key pair (.*)")
def set_rsa_key(keyno_str):

View File

@@ -205,7 +205,6 @@ class OpenPGP_Card(object):
def cmd_pso_longdata(self, p1, p2, data):
if self.__reader.is_tpdu_reader():
cmd_data = iso7816_compose(0x2a, p1, p2, data, le=256)
print(cmd_data)
r = self.__reader.send_cmd(cmd_data)
if len(r) < 2:
raise ValueError(r)

View File

@@ -289,13 +289,19 @@ class gnuk_token(object):
count += 1
def cmd_select_openpgp(self):
cmd_data = iso7816_compose(0xa4, 0x04, 0x0c, b"\xD2\x76\x00\x01\x24\x01")
sw = self.icc_send_cmd(cmd_data)
if len(sw) != 2:
raise ValueError(sw)
if not (sw[0] == 0x90 and sw[1] == 0x00):
raise ValueError("%02x%02x" % (sw[0], sw[1]))
cmd_data = iso7816_compose(0xa4, 0x04, 0x00, b"\xD2\x76\x00\x01\x24\x01")
r = self.icc_send_cmd(cmd_data)
if len(r) < 2:
raise ValueError(r)
sw = r[-2:]
r = r[0:-2]
if sw[0] == 0x61:
self.cmd_get_response(sw[1])
return True
elif sw[0] == 0x90 and sw[1] == 0x00:
return True
else:
raise ValueError("%02x%02x" % (sw[0], sw[1]))
def cmd_get_data(self, tagh, tagl):
cmd_data = iso7816_compose(0xca, tagh, tagl, b"")
@@ -341,8 +347,8 @@ class gnuk_token(object):
raise ValueError("%02x%02x" % (sw[0], sw[1]))
return True
def cmd_reset_retry_counter(self, how, data):
cmd_data = iso7816_compose(0x2c, how, 0x00, data)
def cmd_reset_retry_counter(self, how, who, data):
cmd_data = iso7816_compose(0x2c, how, who, data)
sw = self.icc_send_cmd(cmd_data)
if len(sw) != 2:
raise ValueError(sw)