Kimber Warden - 2011-08-26 15:11:31
I am attempting to reproduce a specific example string given in a vendor's SSO documentation. I'm supposed to first encrypt with AES 128-bit in ECB mode and then encode the result in base 64.
This AES128.php script is the only one that even comes close to giving me the output given in the vendor's example, which I don't even understand because I thought ECB mode is supposed to generate the same output every time, as long as the key and plain text don't change. But anyway, AES128.php seems to be my best hope to make this work.
Using the key "foo789" and the plain text "user345", the expected string is Llg%2BmC3cWri/5ob80WQGDg==. However, using this AES128.php file and PHP's "base64_encode" function I get the output Llg+mC3cWri/5ob80WQGDg==. It's almost right, but instead of the expected "%2B" characters in the first string, I get a "+" character instead. This is consistent no matter what plain text I use. "+" is always substituted for "%2B".
I'm not really a programmer, so I don't have a clue what could be causing this small difference, or where to even begin looking. I would HUGELY appreciate any assistance.