iPhone 上的 OpenSSL [英] OpenSSL on iPhone

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

问题描述

我需要弄清楚如何为 iPhone 获取两个 OpenSSL 函数.我正在努力保留它,这样我就不需要另一个 dylib,因为我不希望 Apple 因一些愚蠢的事情而拒绝我的申请.

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.

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

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.

我需要能够使用一些东西来密封 OpenSSL 中的请求,并在 OpenSSL 中对公钥进行编码.我有标题,但我似乎无法弄清楚任何事情.

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.

推荐答案

一般来说,在 iPhone 上加密和解密最简单的方法是 Security.framework,而不是直接使用 OpenSSL.

Generally, the easiest approach to encryption and decryption on the iPhone is the Security.framework, instead of using OpenSSL directly.

看这里:

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 密钥对的创建以及加密和解密.

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天全站免登陆