01: package org.bouncycastle.crypto.params;
02:
03: import java.math.BigInteger;
04: import java.security.SecureRandom;
05:
06: import org.bouncycastle.crypto.KeyGenerationParameters;
07:
08: public class RSAKeyGenerationParameters extends KeyGenerationParameters {
09: private BigInteger publicExponent;
10: private int certainty;
11:
12: public RSAKeyGenerationParameters(BigInteger publicExponent,
13: SecureRandom random, int strength, int certainty) {
14: super (random, strength);
15:
16: if (strength < 12) {
17: throw new IllegalArgumentException("key strength too small");
18: }
19:
20: //
21: // public exponent cannot be even
22: //
23: if (!publicExponent.testBit(0)) {
24: throw new IllegalArgumentException(
25: "public exponent cannot be even");
26: }
27:
28: this .publicExponent = publicExponent;
29: this .certainty = certainty;
30: }
31:
32: public BigInteger getPublicExponent() {
33: return publicExponent;
34: }
35:
36: public int getCertainty() {
37: return certainty;
38: }
39: }
|