зеркало из https://github.com/github/SoftU2F.git
send counter value prior to having incremented it
This commit is contained in:
Родитель
de42213a09
Коммит
007eee7e98
|
@ -45,12 +45,15 @@ class Keychain {
|
|||
|
||||
let err = SecItemDelete(queryDict)
|
||||
|
||||
if err != errSecSuccess {
|
||||
switch err {
|
||||
case errSecSuccess:
|
||||
return true
|
||||
case errSecItemNotFound:
|
||||
return false
|
||||
default:
|
||||
print("Error from keychain: \(err)")
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Get the given attribute for the given SecKey.
|
||||
|
|
|
@ -152,10 +152,12 @@ class U2FAuthenticator {
|
|||
return
|
||||
}
|
||||
|
||||
let counter = reg.counter
|
||||
|
||||
let sigPayload = DataWriter()
|
||||
sigPayload.writeData(req.applicationParameter)
|
||||
sigPayload.write(UInt8(0x01)) // user present
|
||||
sigPayload.write(reg.counter)
|
||||
sigPayload.write(counter)
|
||||
sigPayload.writeData(req.challengeParameter)
|
||||
|
||||
guard let sig = reg.sign(sigPayload.buffer) else {
|
||||
|
@ -163,7 +165,7 @@ class U2FAuthenticator {
|
|||
return
|
||||
}
|
||||
|
||||
let resp = AuthenticationResponse(userPresence: 0x01, counter: reg.counter, signature: sig)
|
||||
let resp = AuthenticationResponse(userPresence: 0x01, counter: counter, signature: sig)
|
||||
self.sendMsg(msg: resp, cid: cid)
|
||||
return
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче