开发者

How to decrypt the iPhone encrypted AES256 text in PHP

开发者 https://www.devze.com 2023-02-18 21:25 出处:网络
I would like to know how to decrypt some text encrypted on iPhone using AES256 and PKCS7Padding with a PHP function.

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

精彩评论

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