Hi there
I normally code PHP, but I'm no encryption expert. My friend has asked me to encrypt a string using PHP so that:
Encryption keystring :
BinHex Encoder for Data
UTF8 Encoder for KeyString
KeyArrayLength : 16 - KeyString is converted to byteArray using UTF8 encoder and then the result byteArray is trimmed upto 16 length (i.e KeyArrayLength)
SaltString = Encryption keystring
SaltString Length = 16
KeySaltTextEncoder = UTF8
Initialization Vector = Salt (Salt is obtained by converting Saltstring to byteArray using UTF8 encoder and then the result byteArray is trimmed upto 16 length i.e. SaltString length)
Uses the RijndaelManaged implementation
KeySize : 256
BlockSize : 128
Mode : Cipher Block Chaining (CBC)
Padding : PaddingMode.PKCS7
I don't understand the English part, so how to do it in PHP? Ideally I need a function where I can feed my string and the key that he supplied which has 44 characters in length.
So far I have this:mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $the_raw_key, $str, MCRYPT_MODE_CBC, $the_raw_key);
(it doesn't work, but even if it did work doesn't mean I'm doing the right thing)
My friend will decrypt the information and the decryption needs to work without too many code changes on the encryption side.
Hope someone can help me!
Many thanks in advance!