任何用于 AES 加密解密的可可源代码? [英] Any cocoa source code for AES encryption decryption?

查看:23
本文介绍了任何用于 AES 加密解密的可可源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一些关于 AES 加密的可可代码,我用谷歌搜索了它.我发现这个非常有用的链接 -http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html.所以我尝试了它,但它对我不起作用.

I am searching for some cocoa code on AES encryption and I did some google search for it. I found this very useful link - http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html. So I tried it but it did not work for me.

谁能给我推荐一些有用的链接或源代码,以帮助我在示例应用程序中实现它.

Can anyone suggest me some useful link or source code which can help me to implement it in my sample application.

推荐答案

AES128 加密在 CommonCrypto 框架中的 iPhone 上可用.相关函数在 CommonCryptor.h 头文件中.

AES128 encryption is available on the iPhone in the CommonCrypto framework. The relevant functions are in the CommonCryptor.h header.

您可以像这样创建密码器:

You can create a cryptor like so:

// Assume key and keylength exist
CCCryptorRef cryptor;
if(kCCSuccess != CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES128, 0, key, keyLength, NULL, &cryptor))
  ; //handle error

// Repeatedly call CCCryptorUpdate to encrypt the data

CCCryptorRelease(cryptor);

从问题和链接看来,您正在寻找 AES 的示例实现.我不推荐这个 - 使用 Apple 的实现!

It seems from the question and the link that you are looking for example implementations of AES. I would not recommend this- use Apple's implementation!

看起来 http://pastie.org/297563.txt 也可能对您有帮助,但是我还没有测试过.

It looks like http://pastie.org/297563.txt might help you also, but I haven't tested it.

这篇关于任何用于 AES 加密解密的可可源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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