ios - i如何通过 Secure Enclave 实现安全的 Touch ID 身份验证?
问题描述
我的应用程序通过了渗透测试,并被建议使用钥匙串服务实现 LAContext,以便安全地访问应用程序的触摸 ID。关于如何实现这一目标的任何想法?下面给出了当前的实现,请让我知道我做错了什么?
func showsystemPasswordWindow(){
context = LAContext()
// context.localizedCancelTitle = "Cancel"
// First check if we have the needed hardware support.
var error: NSError?
if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) {
let reason = "Device authentication"
context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason ) { success, error in
if success {
// Move to the main thread because a state update triggers UI changes.
DispatchQueue.main.async { [unowned self] in
self.nav()
}
} else {
print(error?.localizedDescription ?? "Failed to authenticate")
DispatchQueue.main.async {
self.showsystemPasswordWindow()
exit(0)
// self.showsystemPasswordWindow()
}
// Fall back to a asking for username and password.
// ...
}
}
} else {
print(error?.localizedDescription ?? "Can't evaluate policy")
self.makeSignInAsRootViewController()
// Fall back to a asking for username and password.
// ...
}
}
解决方案
推荐阅读
- javascript - 无法读取未定义的属性 -1
- android - 应用程序图标仅在 API21 中显示,但在其他 api 中失败
- c# - 自定义路由未获取查询字符串
- python - 函数在多进程中没有返回,没有错误
- python - 无法使用带有外部 + 代理身份验证的 SessionPool 通过 cx_Oracle 连接
- vue.js - nuxt 查询字符串参数的文件夹/文件结构
- javascript - How to make every word in a sentence start with a capital letter
- flutter - 如何从 Flutter 中的另一个页面/类向 ListView 添加数据
- php - 我需要帮助
- python - Python:根据条件匹配列