View Javadoc
1   package org.bouncycastle.crypto;
2   
3   /*-
4    * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
5    * SNMP Java Client
6    * ჻჻჻჻჻჻
7    * Copyright 2023 MetricsHub, 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      private SecureRandom random;
32      private int strength;
33  
34      /**
35       * initialise the generator with a source of randomness
36       * and a strength (in bits).
37       *
38       * @param random   the random byte source.
39       * @param strength the size, in bits, of the keys we want to produce.
40       */
41      public KeyGenerationParameters(
42              SecureRandom random,
43              int strength) {
44          this.random = random;
45          this.strength = strength;
46      }
47  
48      /**
49       * return the random source associated with this
50       * generator.
51       *
52       * @return the generators random source.
53       */
54      public SecureRandom getRandom() {
55          return random;
56      }
57  
58      /**
59       * return the bit strength for keys produced by this generator,
60       *
61       * @return the strength of the keys this generator produces (in bits).
62       */
63      public int getStrength() {
64          return strength;
65      }
66  }