1 /**
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one or more
4 * contributor license agreements. See the NOTICE file distributed with
5 * this work for additional information regarding copyright ownership.
6 * The ASF licenses this file to You under the Apache License, Version 2.0
7 * (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.geronimo.util.crypto.params;
20
21 import java.math.BigInteger;
22
23 import org.apache.geronimo.util.crypto.CipherParameters;
24
25 public class DSAParameters
26 implements CipherParameters
27 {
28 private BigInteger g;
29 private BigInteger q;
30 private BigInteger p;
31 private DSAValidationParameters validation;
32
33 public DSAParameters(
34 BigInteger p,
35 BigInteger q,
36 BigInteger g)
37 {
38 this.g = g;
39 this.p = p;
40 this.q = q;
41 }
42
43 public DSAParameters(
44 BigInteger p,
45 BigInteger q,
46 BigInteger g,
47 DSAValidationParameters params)
48 {
49 this.g = g;
50 this.p = p;
51 this.q = q;
52 this.validation = params;
53 }
54
55 public BigInteger getP()
56 {
57 return p;
58 }
59
60 public BigInteger getQ()
61 {
62 return q;
63 }
64
65 public BigInteger getG()
66 {
67 return g;
68 }
69
70 public DSAValidationParameters getValidationParameters()
71 {
72 return validation;
73 }
74
75 public boolean equals(
76 Object obj)
77 {
78 if (!(obj instanceof DSAParameters))
79 {
80 return false;
81 }
82
83 DSAParameters pm = (DSAParameters)obj;
84
85 return (pm.getP().equals(p) && pm.getQ().equals(q) && pm.getG().equals(g));
86 }
87 }