1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package java.security.spec; 19 20 import java.math.BigInteger; 21 22 /** 23 * The parameters specifying a DSA public key. 24 */ 25 public class DSAPublicKeySpec implements KeySpec { 26 // Public key 27 private final BigInteger y; 28 // Prime 29 private final BigInteger p; 30 // Sub-prime 31 private final BigInteger q; 32 // Base 33 private final BigInteger g; 34 35 /** 36 * Creates a new {@code DSAPublicKeySpec} with the specified public key, 37 * prime, sub-prime and base. 38 * 39 * @param y 40 * the public key value {@code y}. 41 * @param p 42 * the prime {@code p}. 43 * @param q 44 * the sub-prime {@code q}. 45 * @param g 46 * the base {@code g}. 47 */ 48 public DSAPublicKeySpec(BigInteger y, BigInteger p, 49 BigInteger q, BigInteger g) { 50 this.y = y; 51 this.p = p; 52 this.q = q; 53 this.g = g; 54 } 55 56 /** 57 * Returns the base {@code g}. 58 * 59 * @return the base {@code g}. 60 */ 61 public BigInteger getG() { 62 return g; 63 } 64 65 /** 66 * Returns the prime {@code p}. 67 * 68 * @return the prime {@code p}. 69 */ 70 public BigInteger getP() { 71 return p; 72 } 73 74 /** 75 * Returns the sub-prime {@code q}. 76 * 77 * @return the sub-prime {@code q}. 78 */ 79 public BigInteger getQ() { 80 return q; 81 } 82 83 /** 84 * Returns the public key value {@code y}. 85 * 86 * @return the public key value {@code y}. 87 */ 88 public BigInteger getY() { 89 return y; 90 } 91 } 92