2010-12-15 120 views
2

j'ai sur mon code php:AES256 cryptage Enfiler PHP et le déchiffrement sur iPhone

$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); 
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); 
$key = "bla"; 
$text = json_encode($rows); 
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv) 
print base64_encode($crypttext); 

et celui-ci l'iphone:

NSString *response = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.bla.com/myinfo.php"] encoding:NSUTF8StringEncoding error:&error]; 
    response = [[NSData base64DataFromString:response] AESDecryptWithPassphrase:@"bla"]; 
    response = [[[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding] autorelease]; 
    NSLog(response); 

mais il ne fonctionne pas, quelqu'un a une méthode qui fonctionne?
merci

Répondre