如何在钥匙串中保存 CFUUID
我正在开发 iPhone 应用程序。
应用程序访问一些 Web 服务,该服务与其他事物相关,应识别设备 ID。
由于 UDID 已被弃用,因此我需要调用 CFUUIDCreate 来生成我自己的 UUID。
ID 是安全敏感的:我的所有网络通信都是加密的,除了我的证书验证服务器之外,我不想让任何人知道该 UUID。
此外,我希望这个标识符能够在重新安装后继续存在。
使用钥匙串来存储 UUID 似乎是一个显而易见的解决方案。
我该怎么做?
在互联网上,有一些如何存储用户名和名称的示例。钥匙串中的密码。我既没有用户名也没有密码,只有 16 字节 UUID(或单个 NSString)。
我需要使用哪个 kSecClass?
我需要设置和检索哪些属性?
哪些属性是可选的,哪些是强制的?
什么标头/框架定义了 CSSM_ALGORITHMS?
该文档提到 cssmtype.h,xcode 自动完成有
从常理来说,“身份”应该是最合适的。然而,文档说“身份是私钥和证书的组合”,我两者都没有。另外,我没有看到“关键字节”属性。
提前致谢!
I'm developing an iPhone application.
The application access some web service that aboug other things should recognize the device ID.
Since UDID is deprecated, I need to call CFUUIDCreate to generate my own UUID for this purpose.
The ID is security-sensitive: all my network communication is encrypted, and I don't want nobody but my certificate-authenticated server to know that UUID.
Besides, I want this identifier to survive re-install.
Using the keychain to store that UUID seems like an obvious solution.
How do I do that?
On the internets, there're some samples how to store user name & password in keychain. I have neither user nor password, just 16 bytes UUID (or a single NSString).
Which kSecClass do I need to use?
Which attributes do I need to set and retrieve?
Which attributes are optional and which are mandatory?
What header/framework defines the CSSM_ALGORITHMS?
The doc mentions cssmtype.h, xcode autocompletion has <Security/cssmtype.h> however the xcode compiler says "file not found".
From the common sense, "Identity" should fit best. The docs however say "an identity is the combination of a private key and a certificate", I have neither of them. Also, I don't see the "key bytes" attribute.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 SSKeychain 包装器。另请查看此问题的答案以了解一些基本用法:
如何选择 SSKeychain 的帐户和服务值
You could use the SSKeychain wrapper. Also check out the answer on this question for some basic usage stuff:
How to choose account and service values for SSKeychain