After a long time searching for the best way to en/decrypt data between PHP and iOS, I’m now asking you for a function in PHP.
I’m using this framework (https://gist.github.com/2507415) in Objective-C and my code is:
NSString *string= @"Affe";
NSString *key = @"12345678901234567890123456789012";
NSLog(%@,[string AES256EnryptWithKey:key];
Output: UUfn34iyNlSK40VaehloaQ==
I’ve tried so much in PHP but nothing works. I hope somebody knows how to decrypt this server-side.
That seems to be using AES 128, with no IV in ECB mode and PKCS-7 compatible padding, try this:
PS: I had forgotten about the base64 encoding, it’s fixed now.