iPhone 上的 OpenSSL
我需要弄清楚如何为 iPhone 获取两个 OpenSSL 函数。我试图保留它,这样我就不需要另一个 dylib,因为我不想让苹果因为如此愚蠢的事情而拒绝我的申请。
无论如何,我有一个访问 API 的应用程序,而不是我的 API 之一,所以我无法真正更改它,而且,我不想让任何人知道我的公钥,或使用这个特定的“私有”API,所以我不能只制作一个 PHP 脚本服务器端,这会更容易,但它根本行不通。
我需要能够使用一些东西来密封 OpenSSL 中的请求,并在 OpenSSL 中对公钥进行编码。我有标题,但我似乎无法弄清楚任何事情。
I need to figure out how to get two OpenSSL functions for iPhone. I'm trying to keep it so I don't need another dylib, because I don't want Apple to reject my application for something so silly.
Anyways, I have an app that access an API, not one of my APIs, so I can't really change it, and also, I don't want anyone to know my public key, or use this specific 'private' api, so I can't just make a PHP script server side, which, would be easier, except that it just won't work out.
I need to be able to use something that will seal a request in OpenSSL, and also encode a public key in OpenSSL. I have the headers, and I can't seem to figure anything out.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一般来说,iPhone上加解密最简单的方法是Security.framework,而不是直接使用OpenSSL。
请参阅此处:
http://developer.apple.com/iphone/library/DOCUMENTATION/Security/Conceptual/CertKeyTrustProgGuide/iPhone_Tasks/iPhone_Tasks.html#//apple_ref/doc/uid/TP40001358-CH208-SW9
底部的示例(清单 2-8、2-9 和 2-10)显示了 RSA-1024 密钥对的创建以及加密和解密。
通过使用不同的密钥,您可以控制加密/解密方法以满足服务器的要求。
Generally, the easiest approach to encryption and decryption on the iPhone is the Security.framework, instead of using OpenSSL directly.
See here:
http://developer.apple.com/iphone/library/DOCUMENTATION/Security/Conceptual/CertKeyTrustProgGuide/iPhone_Tasks/iPhone_Tasks.html#//apple_ref/doc/uid/TP40001358-CH208-SW9
The example at the bottom (listings 2-8, 2-9 and 2-10) show RSA-1024 key pair creation plus encryption and decryption.
By using a different key, you can control the encryption/decryption method to match the requirements of your server.
您还可以将 OpenSSL 编译为 iOS 库。这是我的教程:
http: //www.x2on.de/2010/07/13/tutorial-iphone-app-with-compiled-openssl-1-0-0a-library/
You can also compile OpenSSL as a library for iOS. Here is an tutorial from me:
http://www.x2on.de/2010/07/13/tutorial-iphone-app-with-compiled-openssl-1-0-0a-library/
对我来说,我发现从 cocoapods 实现 OpenSSL pod 是最简单的。无需教程。
信息:http://cocoapods.org/?q=openssl
For me I found that implementing the OpenSSL pod from cocoapods was the easiest. No tutorial needed.
Info: http://cocoapods.org/?q=openssl