Is there a way to generate a RSA private key in java, when the public key is known, say 3 ?
I can't find a way to do this with Class KeyPairGenerator, from java.security package...
my question is very simple, I'm not looking for info related to cryptography. Just want to know, if I have the public exponent for RSA, is there a way in java to get the private exponent, for that public exponent, for a given modulus length , e.g. 2048? This should shed some light on the topic: https://en.wikipedia.org/wiki/RSA_(cryptosystem)#Key_generation https://en.wikipedia.org/wiki/65,537
Sort answer is "no".
Long answer is to use sunrsasign Provider, which implements RSAKeyPairGenerator such that the public exponent is 65537: *"/** * RSA keypair generation. Standard algorithm, minimum key length 512 bit. * We generate two random primes until we find two where phi is relative * prime to the public exponent. Default exponent is 65537. It has only bit 0 * and bit 4 set, which makes it particularly efficient. **/*
if you want a different public exponent you need to create your own provider and integrate it with JCA.
more on the math behind this here.