Home | History | Annotate | Download | only in params
      1 package org.bouncycastle.crypto.params;
      2 
      3 import java.math.BigInteger;
      4 import java.security.SecureRandom;
      5 
      6 import org.bouncycastle.crypto.KeyGenerationParameters;
      7 
      8 public 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