Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 956 Bytes

README.md

File metadata and controls

24 lines (20 loc) · 956 Bytes

AES128

#import "NSData+AES.h"
#import "Base64.h"

NSData *cipherData;
NSString *base64Text, *plainText;
NSString *key    = @"";
//############## Request(crypt) ##############
plainText  = @"123456789";
cipherData = [[plainText dataUsingEncoding:NSUTF8StringEncoding] AES128EncryptedDataWithKey:key];
base64Text = [cipherData base64Encoding];
NSLog(@"%@", base64Text);

base64Text = @"uvNcRgwpu6KL1yRMdO686Q==";
cipherData = [base64Text base64DecodedData];
plainText  = [[NSString alloc] initWithData:[cipherData AES128DecryptedDataWithKey:key] encoding:NSUTF8StringEncoding];
NSLog(@"%@", plainText);