mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
use legacy key alias for keystore aliases
This commit is contained in:
parent
ab0e76d24c
commit
7d20d8bc96
@ -14,7 +14,7 @@ class KeyStoreProvider : KeyProvider {
|
||||
keystore.load(null)
|
||||
}
|
||||
|
||||
override fun hasKey(deviceId: String): Boolean = keystore.containsAlias(deviceId)
|
||||
override fun hasKey(deviceId: String): Boolean = keystore.containsAlias(getAlias(deviceId))
|
||||
|
||||
override fun getKey(deviceId: String): AccessKey? =
|
||||
if (hasKey(deviceId)) {
|
||||
@ -35,7 +35,7 @@ class KeyStoreProvider : KeyProvider {
|
||||
|
||||
|
||||
override fun removeKey(deviceId: String) {
|
||||
keystore.deleteEntry(deviceId)
|
||||
keystore.deleteEntry(getAlias(deviceId))
|
||||
}
|
||||
|
||||
override fun clearAll() {
|
||||
@ -45,9 +45,13 @@ class KeyStoreProvider : KeyProvider {
|
||||
private inner class KeyStoreStoredSigner(val deviceId: String) :
|
||||
AccessKey {
|
||||
val mac: Mac = Mac.getInstance(KeyProperties.KEY_ALGORITHM_HMAC_SHA1).apply {
|
||||
init(keystore.getKey(deviceId, null))
|
||||
init(keystore.getKey(getAlias(deviceId), null), null)
|
||||
}
|
||||
|
||||
override fun calculateResponse(challenge: ByteArray): ByteArray = mac.doFinal(challenge)
|
||||
}
|
||||
|
||||
// return key alias used in legacy app
|
||||
private fun getAlias(deviceId: String) = "$deviceId,0"
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user