I use the NSData + AESCrypt category from Jim Dovey and NSString + AESCrypt from Michael Sedlaczek (2011-02-22).
And in PHP, I have a simple script:
<?php
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = '01234567890123456789012345678901';
$plaintext = "myworda";
$ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $plaintext, MCRYPT_MODE_ECB);
$base64encoded_ciphertext = base64_encode($ciphertext);
echo "ciphertext: ".$base64encoded_ciphertext."<br/>";
?>
In ObjC:
NSString *key = @"01234567890123456789012345678901";
NSString *plaintext = [@"+l56Ia4yyK19D2x2+oCXuw==" AES256DecryptWithKey: key];
NSLog(@"plaintext: %@", plaintext);
I modify the $ plaintext variable in PHP, run the script and copy and paste the output cipher into Objective-c to decrypt it.
AND:
"myword" gives me "+ l56Ia4yyK19D2x2 + oCXuw ==", and I decrypt and get "myword" on iOS [OK]
“Good morning” gives me “5UdImsV1pQs60ovXmH74HQ ==”, and I decrypt and get “good morning” on iOS [OK]
- "Schröder" gives me "KqNSCE8nGsYUYVdGZ2tnMw ==" and I decrypt and get "Schröder" on iOS [OK]
- "Schröder" gives me "KqNSCE8nGsYUYVdGZ2tnMw ==" and I decrypt and get "Schröder" on iOS [OK]
- " " "lsa + QF3IHQnAFiOjl2Heyg ==", " " iOS [OK]
- " " "kl/ThEyyyUMmKSqU4/fJSzzJOyvsXrGRt5/zsnqjQww =", iOS [FAIL]
# 5 ? " " Xcode, "kl/ThEyyyUMmKSqU4/fJS90UZoJ73S4gox2uCoWoIL8 =", :
kl/ThEyuyUMmKSqU4/fJS == kl/ThEyuyUMmKSqU4/fJS
zzJOyvsXrGRt5/zsnqjQww!= 90UZoJ73S4gox2uCoWoIL8 =
, , " " Xcode "hVq1AuR8PAXSOztK26pmMw ==", PHP "5UdImsV1pQs60ovXmH74HQ ==", Xcode " " .
, .