001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.geronimo.util.crypto.params;
019
020 import java.math.BigInteger;
021
022 import org.apache.geronimo.util.crypto.CipherParameters;
023
024 public class DSAParameters
025 implements CipherParameters
026 {
027 private BigInteger g;
028 private BigInteger q;
029 private BigInteger p;
030 private DSAValidationParameters validation;
031
032 public DSAParameters(
033 BigInteger p,
034 BigInteger q,
035 BigInteger g)
036 {
037 this.g = g;
038 this.p = p;
039 this.q = q;
040 }
041
042 public DSAParameters(
043 BigInteger p,
044 BigInteger q,
045 BigInteger g,
046 DSAValidationParameters params)
047 {
048 this.g = g;
049 this.p = p;
050 this.q = q;
051 this.validation = params;
052 }
053
054 public BigInteger getP()
055 {
056 return p;
057 }
058
059 public BigInteger getQ()
060 {
061 return q;
062 }
063
064 public BigInteger getG()
065 {
066 return g;
067 }
068
069 public DSAValidationParameters getValidationParameters()
070 {
071 return validation;
072 }
073
074 public boolean equals(
075 Object obj)
076 {
077 if (!(obj instanceof DSAParameters))
078 {
079 return false;
080 }
081
082 DSAParameters pm = (DSAParameters)obj;
083
084 return (pm.getP().equals(p) && pm.getQ().equals(q) && pm.getG().equals(g));
085 }
086 }