001 /*
002 * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package java.security.spec;
027
028 import java.math.BigInteger;
029
030 /**
031 * This class specifies a DSA public key with its associated parameters.
032 *
033 * @author Jan Luehe
034 *
035 * @version 1.25, 05/05/07
036 *
037 * @see java.security.Key
038 * @see java.security.KeyFactory
039 * @see KeySpec
040 * @see DSAPrivateKeySpec
041 * @see X509EncodedKeySpec
042 *
043 * @since 1.2
044 */
045
046 public class DSAPublicKeySpec implements KeySpec {
047
048 private BigInteger y;
049 private BigInteger p;
050 private BigInteger q;
051 private BigInteger g;
052
053 /**
054 * Creates a new DSAPublicKeySpec with the specified parameter values.
055 *
056 * @param y the public key.
057 *
058 * @param p the prime.
059 *
060 * @param q the sub-prime.
061 *
062 * @param g the base.
063 */
064 public DSAPublicKeySpec(BigInteger y, BigInteger p, BigInteger q,
065 BigInteger g) {
066 this .y = y;
067 this .p = p;
068 this .q = q;
069 this .g = g;
070 }
071
072 /**
073 * Returns the public key <code>y</code>.
074 *
075 * @return the public key <code>y</code>.
076 */
077 public BigInteger getY() {
078 return this .y;
079 }
080
081 /**
082 * Returns the prime <code>p</code>.
083 *
084 * @return the prime <code>p</code>.
085 */
086 public BigInteger getP() {
087 return this .p;
088 }
089
090 /**
091 * Returns the sub-prime <code>q</code>.
092 *
093 * @return the sub-prime <code>q</code>.
094 */
095 public BigInteger getQ() {
096 return this .q;
097 }
098
099 /**
100 * Returns the base <code>g</code>.
101 *
102 * @return the base <code>g</code>.
103 */
104 public BigInteger getG() {
105 return this.g;
106 }
107 }
|