mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-27 14:23:18 +03:00
parent
c373419f9f
commit
78ae0f8c59
@ -191,8 +191,7 @@ class Controller(object):
|
|||||||
if len(key) > 64: # Keys longer than 64 bytes are hashed.
|
if len(key) > 64: # Keys longer than 64 bytes are hashed.
|
||||||
key = hashlib.sha1(key).digest()
|
key = hashlib.sha1(key).digest()
|
||||||
if len(key) > 20:
|
if len(key) > 20:
|
||||||
raise ValueError(
|
return 'Over 20 bytes'
|
||||||
'YubiKey Slots cannot handle TOTP keys over 20 bytes.')
|
|
||||||
key += b'\x00' * (20 - len(key)) # Keys must be padded to 20 bytes.
|
key += b'\x00' * (20 - len(key)) # Keys must be padded to 20 bytes.
|
||||||
dev.driver.program_chalresp(int(slot), key, touch)
|
dev.driver.program_chalresp(int(slot), key, touch)
|
||||||
|
|
||||||
|
@ -115,6 +115,14 @@ DefaultDialog {
|
|||||||
standardButtons: StandardButton.Ok
|
standardButtons: StandardButton.Ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
id: tooLargeKeyError
|
||||||
|
icon: StandardIcon.Critical
|
||||||
|
title: qsTr("Too large key")
|
||||||
|
text: qsTr("YubiKey Slots cannot handle TOTP keys over 20 bytes.")
|
||||||
|
standardButtons: StandardButton.Ok
|
||||||
|
}
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
id: confirmOverWrite
|
id: confirmOverWrite
|
||||||
icon: StandardIcon.Warning
|
icon: StandardIcon.Warning
|
||||||
@ -160,6 +168,9 @@ DefaultDialog {
|
|||||||
if (error === 'Incorrect padding') {
|
if (error === 'Incorrect padding') {
|
||||||
paddingError.open()
|
paddingError.open()
|
||||||
}
|
}
|
||||||
|
if (error === 'Over 20 bytes') {
|
||||||
|
tooLargeKeyError.open()
|
||||||
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user