简体   繁体   English

iOS:可以在应用程序文档目录中存储RSA私钥(用于解密文本)吗?

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

I want the user to use their RSA private key via file sharing to store in my App's document directory. 我希望用户通过文件共享使用其RSA私钥存储在我的App的文档目录中。 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. 用户可以访问RSA私钥是可以的,但是我不希望其他任何人都可以访问它。 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. 这是个好主意吗?如果不是,那么如何让用户安全地将他/她的RSA私钥存储在我的App中。

You need to use the keychain to store sensitive information like private keys. 您需要使用keychain来存储敏感信息,例如私钥。

https://developer.apple.com/library/ios/documentation/Security/Conceptual/cryptoservices/KeyManagementAPIs/KeyManagementAPIs.html 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). 不要尝试推出自己的解决方案... iOS已经为您完成了艰苦的工作(正确)。

Using the keychain will protect your data from other apps. 使用keychain将保护您的数据免受其他应用程序的攻击。


If you want to do this for OS X rather that iOS, then take a look at 如果要在OS X而不是iOS上执行此操作,请查看

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM