1 package org.bouncycastle.crypto.params;
2
3 import java.security.SecureRandom;
4
5 import org.bouncycastle.crypto.CipherParameters;
6
7 public class ParametersWithRandom
8 implements CipherParameters
9 {
10 private SecureRandom random;
11 private CipherParameters parameters;
12
13 public ParametersWithRandom(
14 CipherParameters parameters,
15 SecureRandom random)
16 {
17 this.random = random;
18 this.parameters = parameters;
19 }
20
21 public ParametersWithRandom(
22 CipherParameters parameters)
23 {
24 this.random = null;
25 this.parameters = parameters;
26 }
27
28 public SecureRandom getRandom()
29 {
30 if (random == null)
31 {
32 random = new SecureRandom();
33 }
34 return random;
35 }
36
37 public CipherParameters getParameters()
38 {
39 return parameters;
40 }
41 }
42