add messages to pinpad-test.py

This commit is contained in:
NIIBE Yutaka 2011-12-19 12:28:01 +09:00
parent 4a75aa47df
commit a08669dfcd

View File

@ -178,19 +178,45 @@ def main(who, method, add_a_byte, pinmax, change_by_two_steps):
card.cmd_select_openpgp() card.cmd_select_openpgp()
if method == "verify": if method == "verify":
if who == BY_USER:
print "Please input User's PIN"
else:
print "Please input Admin's PIN"
card.cmd_verify_pinpad(who) card.cmd_verify_pinpad(who)
elif method == "change": elif method == "change":
if change_by_two_steps: if change_by_two_steps:
if who == BY_USER:
print "Please input User's PIN"
else:
print "Please input Admin's PIN"
card.cmd_verify_pinpad(who) card.cmd_verify_pinpad(who)
if who == BY_USER:
print "Please input New User's PIN twice"
else:
print "Please input New Admin's PIN twice"
card.cmd_change_reference_data_pinpad(self, who, True) card.cmd_change_reference_data_pinpad(self, who, True)
else: else:
if who == BY_USER:
print "Please input User's PIN"
print "and New User's PIN twice"
else:
print "Please input Admin's PIN"
print "and New Admin's PIN twice"
card.cmd_change_reference_data_pinpad(self, who, False) card.cmd_change_reference_data_pinpad(self, who, False)
elif method == "unblock": elif method == "unblock":
# It's always by single step # It's always by single step
if who == BY_USER:
print "Please input reset code"
print "and New User's PIN twice"
else:
print "Please input Admin's PIN"
print "and New User's PIN twice"
card.cmd_reset_retry_counter_pinpad(who) card.cmd_reset_retry_counter_pinpad(who)
elif method == "put": elif method == "put":
# It's always by two steps # It's always by two steps
print "Please input Admin's PIN"
card.cmd_verify_pinpad(BY_ADMIN) card.cmd_verify_pinpad(BY_ADMIN)
print "Please input New Reset Code twice"
card.cmd_put_resetcode_pinpad() card.cmd_put_resetcode_pinpad()
else: else:
raise ValueError, method raise ValueError, method
@ -215,9 +241,14 @@ def print_usage():
print "\t\t--pinmax:\tspecify maximum length of PIN\t\t[15]" print "\t\t--pinmax:\tspecify maximum length of PIN\t\t[15]"
print "EXAMPLES:" print "EXAMPLES:"
print " $ pinpad-test # verify user's PIN " print " $ pinpad-test # verify user's PIN "
print " $ pinpad-test --admin --change # change admin's PIN " print " $ pinpad-test --admin # verify admin's PIN "
print " $ pinpad-test --admin --unblock # change user's PIN by admin's PIN" print " $ pinpad-test --change # change user's PIN "
print " $ pinpad-test --change --admin # change admin's PIN "
print " $ pinpad-test --change2 # change user's PIN by two steps"
print " $ pinpad-test --change2 --admin # change admin's PIN by two steps"
print " $ pinpad-test --unblock # change user's PIN by reset code" print " $ pinpad-test --unblock # change user's PIN by reset code"
print " $ pinpad-test --unblock --admin # change user's PIN by admin's PIN"
print " $ pinpad-test --put # setup resetcode "
if __name__ == '__main__': if __name__ == '__main__':
who = BY_USER who = BY_USER
@ -252,3 +283,5 @@ if __name__ == '__main__':
else: else:
raise ValueError, option raise ValueError, option
main(who, method, add_a_byte, pinmax, change_by_two_steps) main(who, method, add_a_byte, pinmax, change_by_two_steps)
# 69 82: security error: pin doesn't match