After
$rsa = new Crypt_RSA();
$rsa->loadKey($privateKey);
$rsa->loadKey($rsa->getPublicKey());
We can get the modulus and exponent through:
$pubMod = $rsa->modulus->toBytes();// this gives base 256 encoded string, toString() gives base 10 etc.
$pubExp = $rsa->exponent->toBytes();
the toBytes()
, toString()
and so on methods are found in Math_BigInteger
class
Now it becomes easy for me to base64 encode the modulus and the public exponent and concatenate them into 1 string and send to my Java application