fix
This commit is contained in:
@@ -61,25 +61,26 @@ class GnukToken(object):
|
||||
elif not (sw1 == 0x90 and sw2 == 0x00):
|
||||
raise ValueError, ("%02x%02x" % (sw1, sw2))
|
||||
|
||||
def cmd_put_data_remove(self, tagh, tagl):
|
||||
apdu = [0x00, 0xda, tagh, tagl, 0]
|
||||
response, sw1, sw2 = self.connection.transmit(apdu)
|
||||
return response
|
||||
|
||||
def cmd_put_data_key_import_remove(self, keyno):
|
||||
if keyno == 1:
|
||||
keyspec = 0xb6 # SIG
|
||||
elif keyno == 2:
|
||||
keyspec = 0xb8 # DEC
|
||||
else
|
||||
else:
|
||||
keyspec = 0xa4 # AUT
|
||||
apdu = [0x00, 0xdb, 0x3f, 0xff, 0x4d, 0x02, keyspec, 0x00 ]
|
||||
apdu = [0x00, 0xdb, 0x3f, 0xff, 4, 0x4d, 0x02, keyspec, 0x00]
|
||||
response, sw1, sw2 = self.connection.transmit(apdu)
|
||||
if sw1 == 0x61:
|
||||
response = self.cmd_get_response(sw2)
|
||||
elif not (sw1 == 0x90 and sw2 == 0x00):
|
||||
raise ValueError, ("%02x%02x" % (sw1, sw2))
|
||||
return response
|
||||
|
||||
DEFAULT_PW3 = "12345678"
|
||||
BY_ADMIN = 3
|
||||
|
||||
def main(fileid, is_update, data, passwd):
|
||||
def main(passwd):
|
||||
gnuk = GnukToken()
|
||||
|
||||
gnuk.connection.connect()
|
||||
@@ -88,8 +89,14 @@ def main(fileid, is_update, data, passwd):
|
||||
|
||||
gnuk.cmd_verify(BY_ADMIN, passwd)
|
||||
gnuk.cmd_select_openpgp()
|
||||
gnuk.cmd_put_data_remove(0x00, 0xc7) # FP_SIG
|
||||
gnuk.cmd_put_data_remove(0x00, 0xcd) # KGTIME_SIG
|
||||
gnuk.cmd_put_data_key_import_remove(1)
|
||||
gnuk.cmd_put_data_remove(0x00, 0xc8) # FP_DEC
|
||||
gnuk.cmd_put_data_remove(0x00, 0xce) # KGTIME_DEC
|
||||
gnuk.cmd_put_data_key_import_remove(2)
|
||||
gnuk.cmd_put_data_remove(0x00, 0xc9) # FP_AUT
|
||||
gnuk.cmd_put_data_remove(0x00, 0xcf) # KGTIME_AUT
|
||||
gnuk.cmd_put_data_key_import_remove(3)
|
||||
|
||||
gnuk.connection.disconnect()
|
||||
|
||||
Reference in New Issue
Block a user