Can't use pico-fido-tool.py secure function #23

Closed
opened 2023-11-03 14:56:48 +08:00 by M11158002 · 9 comments
M11158002 commented 2023-11-03 14:56:48 +08:00 (Migrated from github.com)

An error occurred while enabling the secure feature using pico-fido-tool.py

Pico Fido Tool v1.5
Author: Pol Henarejos
Report bugs to https://github.com/polhenarejos/pico-fido/issues


Traceback (most recent call last):
  File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 469, in <module>
    run()
  File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 466, in run
    main(args)
  File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 458, in main
    secure(vdr, args)
  File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 416, in secure
    vdr.enable_device_aut()
  File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 375, in enable_device_aut
    ct = self.get_skey()
         ^^^^^^^^^^^^^^^
  File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 371, in get_skey
    ct = self.encrypt_chacha(self._get_key_device())
                             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 367, in _get_key_device
    return skey.get_secure_key()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Documents/pico/pico-fido/tools/secure_key/windows.py", line 44, in get_secure_key
    return get_d(key.encode())
                 ^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'encode'
An error occurred while enabling the secure feature using pico-fido-tool.py ```shell Pico Fido Tool v1.5 Author: Pol Henarejos Report bugs to https://github.com/polhenarejos/pico-fido/issues Traceback (most recent call last): File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 469, in <module> run() File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 466, in run main(args) File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 458, in main secure(vdr, args) File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 416, in secure vdr.enable_device_aut() File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 375, in enable_device_aut ct = self.get_skey() ^^^^^^^^^^^^^^^ File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 371, in get_skey ct = self.encrypt_chacha(self._get_key_device()) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/Documents/pico/pico-fido/tools/pico-fido-tool.py", line 367, in _get_key_device return skey.get_secure_key() ^^^^^^^^^^^^^^^^^^^^^ File "/home/user/Documents/pico/pico-fido/tools/secure_key/windows.py", line 44, in get_secure_key return get_d(key.encode()) ^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'encode' ```
polhenarejos commented 2023-11-03 20:11:13 +08:00 (Migrated from github.com)

Open your python

  • 1st:
DOMAIN = "PicoKeys.com"
USERNAME = "Pico-Fido"

import keyring

key = keyring.get_password(DOMAIN, USERNAME)

Does key return NoneType or raises an exception?

  • 2nd:
import keyring
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption, load_pem_private_key
from cryptography.hazmat.primitives.asymmetric import ec
pkey = ec.generate_private_key(ec.SECP256R1())
keyring.set_password("test", "test", pkey.private_bytes(Encoding.PEM, PrivateFormat.PKCS8, NoEncryption()).decode())
key = keyring.get_password(DOMAIN, USERNAME)

Does key return NoneType or raises an exception?

Open your python - 1st: ``` DOMAIN = "PicoKeys.com" USERNAME = "Pico-Fido" import keyring key = keyring.get_password(DOMAIN, USERNAME) ``` Does `key` return `NoneType` or raises an exception? - 2nd: ``` import keyring from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption, load_pem_private_key from cryptography.hazmat.primitives.asymmetric import ec pkey = ec.generate_private_key(ec.SECP256R1()) keyring.set_password("test", "test", pkey.private_bytes(Encoding.PEM, PrivateFormat.PKCS8, NoEncryption()).decode()) key = keyring.get_password(DOMAIN, USERNAME) ``` Does `key` return `NoneType` or raises an exception?
M11158002 commented 2023-11-04 00:08:28 +08:00 (Migrated from github.com)

None of these two
1st:No
2nd:No

None of these two 1st:No 2nd:No
polhenarejos commented 2023-11-04 18:57:19 +08:00 (Migrated from github.com)

Sorry, the 2nd is wrong. Please use this:

import keyring
DOMAIN = "PicoKeys.com"
USERNAME = "Pico-Fido"
from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption, load_pem_private_key
from cryptography.hazmat.primitives.asymmetric import ec
pkey = ec.generate_private_key(ec.SECP256R1())
keyring.set_password(DOMAIN, USERNAME, pkey.private_bytes(Encoding.PEM, PrivateFormat.PKCS8, NoEncryption()).decode())
key = keyring.get_password(DOMAIN, USERNAME)
Sorry, the 2nd is wrong. Please use this: ``` import keyring DOMAIN = "PicoKeys.com" USERNAME = "Pico-Fido" from cryptography.hazmat.primitives.serialization import Encoding, PrivateFormat, NoEncryption, load_pem_private_key from cryptography.hazmat.primitives.asymmetric import ec pkey = ec.generate_private_key(ec.SECP256R1()) keyring.set_password(DOMAIN, USERNAME, pkey.private_bytes(Encoding.PEM, PrivateFormat.PKCS8, NoEncryption()).decode()) key = keyring.get_password(DOMAIN, USERNAME) ```
M11158002 commented 2023-11-04 21:54:17 +08:00 (Migrated from github.com)

Both of these can be executed normally

Both of these can be executed normally
polhenarejos commented 2023-11-06 00:49:51 +08:00 (Migrated from github.com)

But in the 3rd code, is key of NoneType or exists?

But in the 3rd code, is `key` of `NoneType` or exists?
M11158002 commented 2023-11-06 10:59:03 +08:00 (Migrated from github.com)

key return str

-----BEGIN PRIVATE KEY-----
******************************************************
******************************************************
**********************************************
-----END PRIVATE KEY-----
key return str ```shell -----BEGIN PRIVATE KEY----- ****************************************************** ****************************************************** ********************************************** -----END PRIVATE KEY----- ```
polhenarejos commented 2023-11-06 16:50:37 +08:00 (Migrated from github.com)

Now that you've generated the key, does backup work?

Now that you've generated the key, does `backup` work?
M11158002 commented 2023-11-06 19:47:16 +08:00 (Migrated from github.com)

Refer to the backup process mentioned in #22 and the execution of "python3 pico-fido-tool.py --pin 123456 secure enable" pico-fido-tool.py will not end.
After debugging, I saw that it stopped at line 94 "enable_device_aut _call"

Refer to the backup process mentioned in #22 and the execution of "python3 pico-fido-tool.py --pin 123456 secure enable" pico-fido-tool.py will not end. After debugging, I saw that it stopped at line 94 "enable_device_aut _call"
M11158002 commented 2023-11-06 20:11:13 +08:00 (Migrated from github.com)

Refer to the backup process mentioned in #22 and the execution of "python3 pico-fido-tool.py --pin 123456 secure enable" pico-fido-tool.py will not end. After debugging, I saw that it stopped at line 94 "enable_device_aut _call"

Sorry, it can run normally after compiling the development version of the firmware. Thanks.

> Refer to the backup process mentioned in #22 and the execution of "python3 pico-fido-tool.py --pin 123456 secure enable" pico-fido-tool.py will not end. After debugging, I saw that it stopped at line 94 "enable_device_aut _call" Sorry, it can run normally after compiling the development version of the firmware. Thanks.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dearsky/pico-fido#23