Path: blob/master/src/java.base/share/classes/sun/security/provider/DSAPublicKeyImpl.java
41159 views
/*1* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.security.provider;2627import java.math.BigInteger;28import java.security.KeyRep;29import java.security.InvalidKeyException;3031/**32* An X.509 public key for the Digital Signature Algorithm.33*34* The difference between DSAPublicKeyImpl and DSAPublicKey is that35* DSAPublicKeyImpl calls writeReplace with KeyRep, and DSAPublicKey36* calls writeObject.37*38* See the comments in DSAKeyFactory, 4532506, and 6232513.39*40*/4142public final class DSAPublicKeyImpl extends DSAPublicKey {4344@java.io.Serial45private static final long serialVersionUID = 7819830118247182730L;4647/**48* Make a DSA public key out of a public key and three parameters.49* The p, q, and g parameters may be null, but if so, parameters will need50* to be supplied from some other source before this key can be used in51* cryptographic operations. PKIX RFC2459bis explicitly allows DSA public52* keys without parameters, where the parameters are provided in the53* issuer's DSA public key.54*55* @param y the actual key bits56* @param p DSA parameter p, may be null if all of p, q, and g are null.57* @param q DSA parameter q, may be null if all of p, q, and g are null.58* @param g DSA parameter g, may be null if all of p, q, and g are null.59*/60public DSAPublicKeyImpl(BigInteger y, BigInteger p, BigInteger q,61BigInteger g)62throws InvalidKeyException {63super(y, p, q, g);64}6566/**67* Make a DSA public key from its DER encoding (X.509).68*/69public DSAPublicKeyImpl(byte[] encoded) throws InvalidKeyException {70super(encoded);71}7273@java.io.Serial74protected Object writeReplace() throws java.io.ObjectStreamException {75return new KeyRep(KeyRep.Type.PUBLIC,76getAlgorithm(),77getFormat(),78getEncoded());79}80}818283