Braclayrab Posted January 17, 2007 Share Posted January 17, 2007 Hi,I'm trying to implement the RSA library available from Pear(http://pear.php.net/package/Crypt_RSA/). I'm having trouble getting it working. I'm passing the public key to my client which then encrypt a password with javascript. I retrieve it from CryptRSA(the php library) with the following code:bin2hex($_SESSION['key_pair']->getPublicKey()->getExponent())Similarly for the modulus. However, the javascript library is not functional with the keys that are being generated by CryptRSA If I pass the public key to the javascript library as well I can't even use it to decrypt on the client(javascript) side.CryptRSA also appears to sometimes generate even numbers for p and q! Am I misunderstanding something? do p and q not actually need to be prime?Has anyone else ever gotten CryptRSA working in this way? Is there perhaps a better way for me to be doing the encryption on the client side? Does anyone know of another PHP RSA library that I can try?TIA!-Clay Quote Link to comment Share on other sites More sharing options...
Braclayrab Posted January 17, 2007 Author Share Posted January 17, 2007 Update:I may have figured out the issue, looks like and endianness problem. The math libraries are possibly spitting out the numbers in the wrong order. Here's a bunch of p's, The second digit is always odd and the same is true for the moduli:0bcdd4dce4ecf3fb9daeb6bec6ced6dea3a8b0b8c0c8d0d8a9b8c0c8d0d8e0e7adccd4dce4ecf4fca5adb6bec6ced6dd8fa0a8b0b8c0c7cff9c1cad2d9e2e9f1c1c5cdd5dee7eff7a1a1acb4bcc4ccd4b5cad2dae2eaf2f925c9d0d8e0e8f0f89bacb5bdc5cdd4dcc5abb3bbc3cbd3dbcdc9d2dae2e9f1f9c5cdd5dde5edf4fc19b6bdc6ced6dee6bfc9d1d9e1e9f1f925c9d0d8e0e8f0f813bfc6ced6dee5ede9a6afb7bfc7cfdcbfc9d1d9e1e9f1f9adc3cbd3dbe2eaf2d5b2bac2cad2dce41dc2cad2dae2e9f19fb0b8c0c8d0d8e0bda7afb7bec6ced6c5c2cad2dae2e9f18ba3acb4bcc5cdd5b9d0d8e0e8f0f7ffc1cdd5dde5edf5fd49525b636a727ae69399a1a9b0b8c0c8e9b0b8c0c8d0d7dfe9c5ced5dde5edf5adb2bbc3cad2dae2b3b3bac2cbd3dbe2d5cbd3dbe3ebf3fa Quote Link to comment Share on other sites More sharing options...
afzdeveloper Posted February 4, 2007 Share Posted February 4, 2007 Hi,can post your solution?(it's urgent for me)thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.