1package org.bouncycastle.crypto.params;
2
3import java.math.BigInteger;
4import java.security.SecureRandom;
5
6import org.bouncycastle.crypto.KeyGenerationParameters;
7
8public class RSAKeyGenerationParameters
9    extends KeyGenerationParameters
10{
11    private BigInteger publicExponent;
12    private int certainty;
13
14    public RSAKeyGenerationParameters(
15        BigInteger      publicExponent,
16        SecureRandom    random,
17        int             strength,
18        int             certainty)
19    {
20        super(random, strength);
21
22        if (strength < 12)
23        {
24            throw new IllegalArgumentException("key strength too small");
25        }
26
27        //
28        // public exponent cannot be even
29        //
30        if (!publicExponent.testBit(0))
31        {
32                throw new IllegalArgumentException("public exponent cannot be even");
33        }
34
35        this.publicExponent = publicExponent;
36        this.certainty = certainty;
37    }
38
39    public BigInteger getPublicExponent()
40    {
41        return publicExponent;
42    }
43
44    public int getCertainty()
45    {
46        return certainty;
47    }
48}
49