Reputation: 805
I have a problem with generating public key for RSA in java. I use KeyPairGenerator and I get public, private key, p, q and modulus. It is fine. But everytime public key is a 65537. Is there any posibility to generate different public key each time?
Code:
KeyPair keys;
KeyPairGenerator generator;
try {
generator = KeyPairGenerator.getInstance("RSA");
generator.initialize(1024);
keys = generator.genKeyPair();
} catch (NoSuchAlgorithmException ex) {}
Upvotes: 1
Views: 2473
Reputation: 42640
The value 65537 is the commonly used exponent of RSA keys. It is nothing unusual that this value is fixed and has no security implications.
There are a number of known weak exponents known - but this value does not belong to it.
Upvotes: 3
Reputation: 3855
The public key can't be simply 65537, since in RSA a public key is a pair (n,e) where n is the modulus and e is the exponent. Typically, the exponent is equal to 65537, and it is the modulus that changes.
So, in order to make sure you are generating different keys every time, check that the modulus is changing.
Upvotes: 1