iPhone - AES256 Encryption Using Built In Library

青春壹個敷衍的年華 提交于 2019-12-10 12:20:39

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/2878267/iphone-aes256-encryption-using-built-in-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!