iPhone上的OpenSSL [英] OpenSSL on iPhone

查看:110
本文介绍了iPhone上的OpenSSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要弄清楚如何为iPhone获取两个OpenSSL函数。我试图保留它,所以我不需要另一个dylib,因为我不希望苹果拒绝我的应用程序来实现这么愚蠢的行为。



无论如何,我有一个访问API的应用程序,而不是我的API之一,所以我不能真正改变它,并且我也不希望任何人知道我的公钥,或者使用这个特定的'私人'api,所以我可以只是做一个PHP脚本服务器端,这将更容易,除非它不会工作。



我需要能够使用的东西将在OpenSSL中封装请求,并在OpenSSL中编码公钥。我有这些头文件,而且我似乎无法找出任何结果。

解决方案

一般来说,最简单的加密和解密方法在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密钥对的创建以及加密和解密。



通过使用不同的密钥,您可以控制加密/解密方法以匹配服务器的要求。


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.

解决方案

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.

这篇关于iPhone上的OpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆