Looking at JSBN, RSAGenerate(B,E)
takes the bit length B
and the public key E
as arguments. Does that mean it the public key can only be generated separately and be provided as an argument? Does that also mean Forge can't generate the key pair like BigInt http://www.leemon.com/crypto/BigInt.html?
Thanks
RSAGenerate
doesn't take a public key, but a public key exponent in hex. Note that you have to choose this carefully because it has to be coprime to φ(n). A good value is10001
(in hex) for compatibility with other implementations.The public key can be created from the private key by setting n and e:
The forge docs contain three different examples how an RSA key pairs are generated with the same public exponent as above: