-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to work with PHP #1
Comments
Just tought you should know that I was able to make it work. The encrypted string FclBlowfish was generating was missing some special unicode characters, so the decryption never worked. Once I opened the .m file and changed from NSISOLatin1StringEncoding in the decrypt method and from NSASCIIStringEncoding in the encrypt method both to NSWindowsCP1252StringEncoding it worked like a charm. So, maybe using Fcl only inside iOS may work well, but with PHP it needed a tweak. I posted a question and answer here by the way: Thanks |
You can use random ascii coded string to create iv in php $initializationVectorSize = mcrypt_get_iv_size(MCRYPT_BLOWFISH, 'ecb');
$initializationVector = mcrypt_create_iv($initializationVectorSize, MCRYPT_RAND);
$initializationVector = substr(base64_encode($initializationVector), 0, $initializationVectorSize); You got the idea. In order to work properly with encoding in ios i done it this way Thanks for your contributions |
The problem is I don't have access to the PHP code since it's hosted and ran by a 3rd party company. They were only kind enought to share with me the methods to encrypt/decrypt and I had to make the iOS code match the encryption/decryption. So, changing the Encoding you were using in the encrypt and decrypt method to the * NSWindowsCP1252StringEncoding* made the encrypted strings have the same characters as the one in PHP. Using Latin or Ascii limits the symbols used by the encryption and they were not matching. But thank you for the awesome Lib, I wouldn't have patience to do that own my own! |
Hi There,
I have the encryption and decryption code in PHP working fine, but I cannot decrypt or encrypt in iOS using this lib.
My encryption and decryption code in PHP are:
Decrypt
Encrypt
one example is the following encrypted string:
cCVGRSYKtjQhyaLfn+lumQ==
In my PHP code it decrypts fines, with the result "21988882121" (without quotes).
But in my decryption code on iOS, I don't know how to properly initialize the vector following the PHP standard.
Any help is much appreciated!
Thanks!
The text was updated successfully, but these errors were encountered: