fix key deletion in fido2

This commit is contained in:
bunnie 2023-01-25 22:36:15 +08:00
parent 8974a86f24
commit e9ae3fe72b

View file

@ -502,14 +502,18 @@ impl<'a> ActionManager<'a> {
if choice.is_none() { if choice.is_none() {
// we're dealing with FIDO stuff, use the custom code path // we're dealing with FIDO stuff, use the custom code path
match self.pddb.borrow().get(U2F_APP_DICT, entry.key_name.as_str().unwrap_or("UTF8-error"), let dictionary = match entry.key_name.as_str().unwrap_or("UTF8-error").parse::<usize>() {
Ok(fido_key) => persistent_store::store::OPENSK2_DICT,
Err(_) => U2F_APP_DICT,
};
match self.pddb.borrow().get(dictionary, entry.key_name.as_str().unwrap_or("UTF8-error"),
None, false, false, None, None::<fn()> None, false, false, None, None::<fn()>
) { ) {
Ok(candidate) => { Ok(candidate) => {
let attr = candidate.attributes().expect("couldn't get key attributes"); let attr = candidate.attributes().expect("couldn't get key attributes");
match self.pddb.borrow() match self.pddb.borrow()
.delete_key( .delete_key(
U2F_APP_DICT, dictionary,
entry.key_name.as_str().unwrap_or("UTF8-error"), entry.key_name.as_str().unwrap_or("UTF8-error"),
Some(&attr.basis) Some(&attr.basis)
) { ) {