How to save CFUUID in keychain

橙三吉。 提交于 2019-12-06 02:26:04

问题


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!


回答1:


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



来源:https://stackoverflow.com/questions/8210705/how-to-save-cfuuid-in-keychain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!