After a lot of rumors, Apple has announced the new iPhone 5s will have a biometric fingerprint sensor (Touch ID).
经过大量传闻,苹果公司宣布新款iPhone 5s将拥有生物识别指纹传感器(Touch ID)。
Has apple already released the API/SDK for this sensor? If so, can an example be provided?
苹果已经发布了这款传感器的API / SDK吗?如果是这样,可以提供一个例子吗?
1 个解决方案
#1
26
Update iOS >= 8
As of iOS 8, the old part of this answer is no longer true. Apple has introduced the Local Authentication Framework, which allows you to utilize Touch ID in your applications
从iOS 8开始,这个答案的旧部分已不再适用。 Apple推出了本地身份验证框架,允许您在应用程序中使用Touch ID
Quote + Sample code (Local Authentication Framework Reference)
Quote +示例代码(本地身份验证框架参考)
The Local Authentication framework provides facilities for requesting authentication from users with specified security policies. For example, to request that the user authenticate using Touch ID you would use code such as this:
本地身份验证框架为使用指定安全策略的用户请求身份验证提供了便利。例如,要请求用户使用Touch ID进行身份验证,您可以使用以下代码:
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = <#String explaining why app needs authentication#>;
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL succes, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
} else {
// User did not authenticate successfully, look at error and take appropriate action
}
}];
} else {
// Could not evaluate policy; look at authError and present an appropriate message to user
}
Old answer iOS < 7
From the September 10, 2013 keynote approximately 61 minutes into the presentation:
从2013年9月10日的主题演讲开始大约61分钟:
All fingerprint info is encrypted and stored inside the secure enclave in our new A7 chip. Here, it is locked away from everything else, accessible only by the Touch ID sensor. It’s never available to other software, it’s never stored on Apple’s servers or backed up to iCloud.
所有指纹信息都经过加密并存储在我们新A7芯片的安全区域内。在这里,它远离其他一切,只能通过Touch ID传感器访问。它永远不可用于其他软件,它从未存储在Apple的服务器上或备份到iCloud。
As of yet, this is all the information that is available. That being said, this is speculation, but I think it's likely that there won't be an API for this. If anything, usage of the sensor, will only be done through interaction with the keychain allowing the OS to interact with the sensor, while keeping your app separate in its cozy little sandbox.
到目前为止,这是所有可用的信息。话虽如此,这是猜测,但我认为可能没有这方面的API。如果有的话,传感器的使用只能通过与钥匙串的交互来完成,从而允许操作系统与传感器进行交互,同时将您的应用程序与其舒适的小沙箱分开。
EDIT:
It looks like it's true that we can't access the sensor. Here's a quote from an ALLThingsD article (linked below).Apple Senior Vice President Phil Schiller confirmed to AllThingsD that developers won’t get access to use a fingerprint as a means of authentication. He declined to comment on whether that might come in the future.
Apple高级副总裁Phil Schiller向AllThingsD证实,开发人员无法使用指纹作为身份验证手段。他拒绝评论未来是否会出现这种情况。
#1
26
Update iOS >= 8
As of iOS 8, the old part of this answer is no longer true. Apple has introduced the Local Authentication Framework, which allows you to utilize Touch ID in your applications
从iOS 8开始,这个答案的旧部分已不再适用。 Apple推出了本地身份验证框架,允许您在应用程序中使用Touch ID
Quote + Sample code (Local Authentication Framework Reference)
Quote +示例代码(本地身份验证框架参考)
The Local Authentication framework provides facilities for requesting authentication from users with specified security policies. For example, to request that the user authenticate using Touch ID you would use code such as this:
本地身份验证框架为使用指定安全策略的用户请求身份验证提供了便利。例如,要请求用户使用Touch ID进行身份验证,您可以使用以下代码:
LAContext *myContext = [[LAContext alloc] init];
NSError *authError = nil;
NSString *myLocalizedReasonString = <#String explaining why app needs authentication#>;
if ([myContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:&authError]) {
[myContext evaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics
localizedReason:myLocalizedReasonString
reply:^(BOOL succes, NSError *error) {
if (success) {
// User authenticated successfully, take appropriate action
} else {
// User did not authenticate successfully, look at error and take appropriate action
}
}];
} else {
// Could not evaluate policy; look at authError and present an appropriate message to user
}
Old answer iOS < 7
From the September 10, 2013 keynote approximately 61 minutes into the presentation:
从2013年9月10日的主题演讲开始大约61分钟:
All fingerprint info is encrypted and stored inside the secure enclave in our new A7 chip. Here, it is locked away from everything else, accessible only by the Touch ID sensor. It’s never available to other software, it’s never stored on Apple’s servers or backed up to iCloud.
所有指纹信息都经过加密并存储在我们新A7芯片的安全区域内。在这里,它远离其他一切,只能通过Touch ID传感器访问。它永远不可用于其他软件,它从未存储在Apple的服务器上或备份到iCloud。
As of yet, this is all the information that is available. That being said, this is speculation, but I think it's likely that there won't be an API for this. If anything, usage of the sensor, will only be done through interaction with the keychain allowing the OS to interact with the sensor, while keeping your app separate in its cozy little sandbox.
到目前为止,这是所有可用的信息。话虽如此,这是猜测,但我认为可能没有这方面的API。如果有的话,传感器的使用只能通过与钥匙串的交互来完成,从而允许操作系统与传感器进行交互,同时将您的应用程序与其舒适的小沙箱分开。
EDIT:
It looks like it's true that we can't access the sensor. Here's a quote from an ALLThingsD article (linked below).Apple Senior Vice President Phil Schiller confirmed to AllThingsD that developers won’t get access to use a fingerprint as a means of authentication. He declined to comment on whether that might come in the future.
Apple高级副总裁Phil Schiller向AllThingsD证实,开发人员无法使用指纹作为身份验证手段。他拒绝评论未来是否会出现这种情况。