iOS: Is it ok to store a RSA private key (use to decrypt text) in your application document directory?

末鹿安然 提交于 2020-01-06 19:54:11

问题


I want the user to use their RSA private key via file sharing to store in my App's document directory. It is ok if the user has access to the RSA private key, but I don't want anyone else to have access to it. Is this a good idea and if not how can I get the user's to store his/her RSA private key in my App securely.


回答1:


You need to use the keychain to store sensitive information like private keys.

https://developer.apple.com/library/ios/documentation/Security/Conceptual/cryptoservices/KeyManagementAPIs/KeyManagementAPIs.html

Do not attempt to roll your own solution ... iOS has already done the hard work for you (~properly).

Using the keychain will protect your data from other apps.


If you want to do this for OS X rather that iOS, then take a look at

https://developer.apple.com/library/ios/documentation/Security/Conceptual/keychainServConcepts/03tasks/tasks.html#//apple_ref/doc/uid/TP30000897-CH205-TP9



来源:https://stackoverflow.com/questions/31526470/ios-is-it-ok-to-store-a-rsa-private-key-use-to-decrypt-text-in-your-applicati

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