开发者

How to decrypt the iPhone encrypted AES256 text in PHP

I would like to know how to decrypt some text encrypted on iPhone using AES256 and PKCS7Padding with a PHP function.

I use following Objective-C code.

https://gist.github.com/838614

- (NSString *)AES256EncryptWithKey:(NSString *)key
{
   NSData *plainData = [self dataUsingEncoding:NSUTF8StringEncoding开发者_开发知识库];
   NSData *encryptedData = [plainData AES256EncryptWithKey:key];

   NSString *encryptedString = [encryptedData base64Encoding];

   return encryptedString;
}


The following PHP snippet covers removing PKCS7 padding, which combined with this SO question (but substituting MCRYPT_RIJNDAEL_128 for MCRYPT_RIJNDAEL_256 in your case) should give you what you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜