iPhone:如何加密字符串 [英] iPhone: How to encrypt a string

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

问题描述

我想在iPhone上用AES 256加密字符串,但没有通过google发现很多。我想做的是将一些数据发布到网站作为我正在创建的游戏的一部分,但我不想让用户能够通过查看它是如何发布,因为它是纯文本的欺骗。所以我想发布一个加密的字符串到我的PHP页面(ala www.test.com/test.php?encrypted= etc ...),然后php脚本将解密它,并做它需要的,如果它是有效的。

I would like to encrypt a string with AES 256 on the iPhone but have not found much via google. What I am trying to do is post some data to a web site as part of a game I am creating, but I do not want the user to be able to cheat by seeing how it is posted because it is plain text. So I want to post one encrypted string to my php page (ala www.test.com/test.php?encrypted= etc...) and then the php script will decrypt it and do what it needs to if it is valid.

推荐答案

一个更容易的方法是使用HTTPS POST,这将给你类似的保护,仍然有困难解决你要攻击的问题。你描述的解决方案的类型通常需要某种共享的秘密,很难使用共享的秘密长期保护代码。您可能会发现这些帖子是有帮助的:

A much easier approach here would be to use an HTTPS POST, which would give you similar protections with far less code, though there are still difficulties for solving the problem you're attacking. The kind of solution you're describing generally requires some kind of shared secret, and it's very hard to protect code using a shared secret for long. You may find these posts helpful:

  • Machine ID for Mac
  • Store an encryption key in Keychain while application installation process
  • Obfuscating Cocoa

仍然,HTTPS可能是比AES更好的解决方案。

Still, HTTPS is probably a much better solution than AES here.

这篇关于iPhone:如何加密字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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