gnuk/tool/gnuk_get_random.py
NIIBE Yutaka 4d15700580 Python3 update things.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2021-02-19 13:12:48 +09:00

22 lines
513 B
Python
Executable File

#! /usr/bin/python3
from gnuk_token import get_gnuk_device, gnuk_token
from binascii import hexlify
import sys
if __name__ == '__main__':
count = 0
gnuk = get_gnuk_device()
gnuk.cmd_select_openpgp()
looping = (len(sys.argv) > 1)
while True:
try:
challenge = gnuk.cmd_get_challenge().tobytes()
except Exception as e:
print(count)
raise e
print(hexlify(challenge))
count = count + 1
if not looping:
break