Skip to content

Commit b4ff7c9

Browse files
committed
fix: 修复安卓密钥库读取密钥时重复重建导致的解密失败
1 parent e6a3207 commit b4ff7c9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/HuiYi.Android/Platform/AndroidKeyStore.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ public bool RunSelfTest()
166166
}
167167
}
168168

169-
private static ISecretKey GetOrCreateSecretKey()
169+
private static IKey GetOrCreateSecretKey()
170170
{
171171
var keyStore = KeyStore.GetInstance(KeyStoreProvider)
172172
?? throw new InvalidOperationException("AndroidKeyStore provider unavailable.");
173173
keyStore.Load(null);
174174

175-
if (keyStore.ContainsAlias(KeyAlias) && keyStore.GetKey(KeyAlias, null) is ISecretKey existing)
175+
if (keyStore.ContainsAlias(KeyAlias) && keyStore.GetKey(KeyAlias, null) is { } existing)
176176
return existing;
177177

178178
var generator = KeyGenerator.GetInstance(KeyProperties.KeyAlgorithmAes!, KeyStoreProvider)

0 commit comments

Comments
 (0)