Generate a secure key if it is not found.
Should fix #23. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -442,7 +442,7 @@ def attestation(vdr, args):
|
|||||||
vdr.upload_ea(cert.public_bytes(Encoding.DER))
|
vdr.upload_ea(cert.public_bytes(Encoding.DER))
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
print('Pico Fido Tool v1.5')
|
print('Pico Fido Tool v1.6')
|
||||||
print('Author: Pol Henarejos')
|
print('Author: Pol Henarejos')
|
||||||
print('Report bugs to https://github.com/polhenarejos/pico-fido/issues')
|
print('Report bugs to https://github.com/polhenarejos/pico-fido/issues')
|
||||||
print('')
|
print('')
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ def get_secure_key():
|
|||||||
try:
|
try:
|
||||||
backend = get_backend(False)
|
backend = get_backend(False)
|
||||||
key = backend.get_password(DOMAIN, USERNAME)[0]
|
key = backend.get_password(DOMAIN, USERNAME)[0]
|
||||||
except keyring.errors.KeyringError:
|
if (key is None):
|
||||||
|
raise TypeError
|
||||||
|
except (keyring.errors.KeyringError, TypeError):
|
||||||
try:
|
try:
|
||||||
key = generate_secure_key(False)[0] # It should be True, but secure enclave causes python segfault
|
key = generate_secure_key(False)[0] # It should be True, but secure enclave causes python segfault
|
||||||
except keyring.errors.PasswordSetError:
|
except keyring.errors.PasswordSetError:
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
|
||||||
import base64
|
|
||||||
|
|
||||||
DOMAIN = "PicoKeys.com"
|
DOMAIN = "PicoKeys.com"
|
||||||
USERNAME = "Pico-Fido"
|
USERNAME = "Pico-Fido"
|
||||||
@@ -39,6 +37,8 @@ def get_secure_key():
|
|||||||
key = None
|
key = None
|
||||||
try:
|
try:
|
||||||
key = keyring.get_password(DOMAIN, USERNAME)
|
key = keyring.get_password(DOMAIN, USERNAME)
|
||||||
except keyring.errors.KeyringError:
|
if (key is None):
|
||||||
|
raise TypeError
|
||||||
|
except (keyring.errors.KeyringError, TypeError):
|
||||||
key = generate_secure_key()
|
key = generate_secure_key()
|
||||||
return get_d(key.encode())
|
return get_d(key.encode())
|
||||||
|
|||||||
Reference in New Issue
Block a user