Open d-e-s-o opened 5 years ago
Hi! Sorry for delay. I believe smart card synchronization code is indeed at fault here. I can add a workaround to libnitrokey to avoid this case. Is it still blocking the development for nitrocli?
Related: https://github.com/Nitrokey/nitrokey-pro-firmware/issues/37
No worries. We went ahead and merged the code for now (with the proposed addition of NK_get_user_retry_count
as a work around).
I won't release it until the root cause is understood, so it would be great if that could be investigated. My peeking at the firmware code was unfortunately not very successful in that respect, but I am not familiar with it so that was a long shot.
Apparently, this is not only triggered by a factory reset, but also after writing to a PWS slot, see: https://github.com/d-e-s-o/nitrocli/pull/149
(this issue is somewhat similar to https://github.com/Nitrokey/nitrokey-storage-firmware/issues/80 but the symptoms are different and it only occurs on Pro devices)
When running build_aes_key after factory_reset on a Nitrokey Pro, I see a WrongPassword error being emitted (you may have to reset the card using gpg first).
The problem can seemingly be mitigated by inserting certain commands before the build_aes_key step. E.g.,