Converting RSA Encryption From Javascript To PHP
I am trying to login to a website (Steam) which encrypts the plaintext password using Javascript RSA as to send the ciphertext in the POST request as a parameter. I am having troub
Solution 1:
My first thought... you may need to do define('CRYPT_RSA_PKCS15_COMPAT', true)
. phpseclib - which you're using on the PHP side - uses a padding technique defined in PKCS1 v2.0+, which differs slightly from the padding technique described in PKCS1 v1.5. Doing define('CRYPT_RSA_PKCS15_COMPAT', true)
before you do the encryption might help.
Failing that, it might be worthwhile to try to do $rsa->publicExponent = new Math_BigInteger($exp, -16)
I'll try to play around with this some more when I get home from work..
Solution 2:
Instead of rolling your own solution, you should consider using the openssl_{public,private}_{encrypt,decrypt}
functions.
Post a Comment for "Converting RSA Encryption From Javascript To PHP"