View Javadoc
1   package org.bouncycastle.crypto;
2   
3   /*-
4    * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
5    * SNMP Java Client
6    * ჻჻჻჻჻჻
7    * Copyright 2023 Sentry Software, Westhawk
8    * ჻჻჻჻჻჻
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   *
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   *
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
23   */
24  
25  import java.security.SecureRandom;
26  
27  /**
28   * The base class for parameters to key generators.
29   */
30  public class KeyGenerationParameters
31  {
32      private SecureRandom    random;
33      private int             strength;
34  
35      /**
36       * initialise the generator with a source of randomness
37       * and a strength (in bits).
38       *
39       * @param random the random byte source.
40       * @param strength the size, in bits, of the keys we want to produce.
41       */
42      public KeyGenerationParameters(
43          SecureRandom    random,
44          int             strength)
45      {
46          this.random = random;
47          this.strength = strength;
48      }
49  
50      /**
51       * return the random source associated with this
52       * generator.
53       *
54       * @return the generators random source.
55       */
56      public SecureRandom getRandom()
57      {
58          return random;
59      }
60  
61      /**
62       * return the bit strength for keys produced by this generator,
63       *
64       * @return the strength of the keys this generator produces (in bits).
65       */
66      public int getStrength()
67      {
68          return strength;
69      }
70  }