iPhone - AES256加密使用内置库 [英] iPhone - AES256 Encryption Using Built In Library

查看:115
本文介绍了iPhone - AES256加密使用内置库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,我所有的使用 http://pastie.org/966473 作为参考需要做的是加密使用AES256加密的东西。我创建了一个类,将实现放在我的类的实现之上的pastie中。

  @implementation 
// pastie code
@end

@implementation
//我的类代码
@end

在我的类代码中,我创建一个NSMutableData并尝试调用EncryptAES方法,我收到一个警告,说它可能不会响应。我在这里做错了什么?我需要在其他地方实现pastie代码吗?感谢任何帮助。

解决方案

这只是 @implementation 块。您还需要定义类别。将它放在你的头文件中:

  @interface NSMutableData(AES)
- (NSMutableData *)EncryptAES:(NSString *)键;
- (NSMutableData *)DecryptAES :( NSString *)key
andForData:(NSMutableData *)objEncryptedData;
@end


Hey all, I am using http://pastie.org/966473 as a reference as all I need to do is encrypt something using AES256 encrypting. I created a class and put the implementation in the pastie on top of the implementation for my class.

@implementation
//pastie code
@end

@implementation 
//my class code
@end

In my class code I create a NSMutableData and try to call the EncryptAES method and I get a warning saying it might not respond to that. What am I doing wrong here? do I need to implement the pastie code elsewhere? Thanks for any help.

解决方案

That's just the @implementation block. You also need to define the category. Put this in your header file:

@interface NSMutableData (AES)
    - (NSMutableData*)EncryptAES:(NSString *)key;
    - (NSMutableData*)DecryptAES:(NSString *)key
                      andForData:(NSMutableData*)objEncryptedData;
@end

这篇关于iPhone - AES256加密使用内置库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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