View Full Version : RSA encryption function is not working

12-14-2010, 07:27 PM
I've been working on RSA encryption using javascript and php for quite some time but i'm not able to do it properly. i'm using the standard RSA.js,BigInt.js and Barrett.js javascript files for the javascript part but the thing that i have noticed is the public exponent is always 10001 or 3 . only then the function works. but the problem is the php file generates a comparatively larger public key exponent. if i use that in the javascript function it crashes. is there anyway out of this ?

12-19-2010, 08:08 AM
10001 is hex for 65,537 and is a pretty common public key exponent, per this:


Anyway, here's a demo of RSA encryption / decryption using PHP:


The source:


It uses phpseclib, a pure PHP RSA implementation (http://phpseclib.sourceforge.net/) and a javascript biginteger library by a guy named Tom Wu (http://www-cs-students.stanford.edu/~tjw/jsbn/).