Home | History | Annotate | Download | only in crypto
      1 package org.bouncycastle.crypto;
      2 
      3 import java.security.SecureRandom;
      4 
      5 /**
      6  * The base class for parameters to key generators.
      7  */
      8 public class KeyGenerationParameters
      9 {
     10     private SecureRandom    random;
     11     private int             strength;
     12 
     13     /**
     14      * initialise the generator with a source of randomness
     15      * and a strength (in bits).
     16      *
     17      * @param random the random byte source.
     18      * @param strength the size, in bits, of the keys we want to produce.
     19      */
     20     public KeyGenerationParameters(
     21         SecureRandom    random,
     22         int             strength)
     23     {
     24         this.random = random;
     25         this.strength = strength;
     26     }
     27 
     28     /**
     29      * return the random source associated with this
     30      * generator.
     31      *
     32      * @return the generators random source.
     33      */
     34     public SecureRandom getRandom()
     35     {
     36         return random;
     37     }
     38 
     39     /**
     40      * return the bit strength for keys produced by this generator,
     41      *
     42      * @return the strength of the keys this generator produces (in bits).
     43      */
     44     public int getStrength()
     45     {
     46         return strength;
     47     }
     48 }
     49