I have a public key exponent (e) and public key modulus (n) which I need to use to encrypt some text. First of all - is knowing of these two values enough to be able to encrypt plaintext by RSA and send it back to owner, so he can decrypt it using his private key?
If yes, how to achieve that in phpseclib ( http://phpseclib.sourceforge.net/ ) library? Theirs examples (http://phpseclib.sourceforge.net/new/rsa/examples.html) aren't very clear. However, my understanding of RSA isn't very clear either (that's why I am currently playing with it), so I will need some help.
Sadly, this is what I have been able to do so far
define('CRYPT_RSA_EXPONENT', $e);
$rsa = new Crypt_RSA();
The Crypt_RSA class provides functions like "loadKey($key)" and "setPublicKey($key)". I guess I will be using one of them, but first I need to know public key. So .. do I know the public key? As I said, I have public key exponent and public key modulus, but is it possible to construct public key based on those two values?
I will be very happy for some explanation or working example.