Fix tool/.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 3 Apr 2018 06:12:58 +0000 (15:12 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 3 Apr 2018 08:17:51 +0000 (17:17 +0900)
ChangeLog
tool/gnuk_remove_keys_libusb.py
tool/gnuk_token.py
tool/upgrade_by_passwd.py

index 28cffdf..157270a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-03  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * tool/upgrade_by_passwd.py (main): Fix for byte compare.
+       * tool/gnuk_remove_keys_libusb.py (main): Likewise.
+
 2018-04-02  NIIBE Yutaka  <gniibe@fsij.org>
 
        * tool/gnuk_token.py (parse_kdf_data): New.
index 2b7d3fc..185bdca 100755 (executable)
@@ -52,7 +52,7 @@ def main(passwd):
     gnuk.cmd_select_openpgp()
     # Compute passwd data
     kdf_data = gnuk.cmd_get_data(0x00, 0xf9).tostring()
-    if kdf_data == "":
+    if kdf_data == b"":
         passwd_data = passwd.encode('UTF-8')
     else:
         algo, subalgo, iters, salt_user, salt_reset, salt_admin, \
index bff9fa7..c80d35d 100644 (file)
@@ -642,7 +642,7 @@ def parse_kdf_data(kdf_data):
     elif len(kdf_data) == 110:
         single_salt = False
     else:
-        raise ValueError("length does not much")
+        raise ValueError("length does not much", kdf_data)
 
     if kdf_data[0:2] != b'\x81\x01':
         raise ValueError("data does not much")
index e4dd604..3e038b5 100755 (executable)
@@ -52,7 +52,7 @@ def main(wait_e, keyno, passwd, data_regnual, data_upgrade):
     gnuk.cmd_select_openpgp()
     # Compute passwd data
     kdf_data = gnuk.cmd_get_data(0x00, 0xf9).tostring()
-    if kdf_data == "":
+    if kdf_data == b"":
         passwd_data = passwd.encode('UTF-8')
     else:
         algo, subalgo, iters, salt_user, salt_reset, salt_admin, \