Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/provider/DSAPublicKeyImpl.java
38830 views
/*1* Copyright (c) 2005, 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 {4344private static final long serialVersionUID = 7819830118247182730L;4546/**47* Make a DSA public key out of a public key and three parameters.48* The p, q, and g parameters may be null, but if so, parameters will need49* to be supplied from some other source before this key can be used in50* cryptographic operations. PKIX RFC2459bis explicitly allows DSA public51* keys without parameters, where the parameters are provided in the52* issuer's DSA public key.53*54* @param y the actual key bits55* @param p DSA parameter p, may be null if all of p, q, and g are null.56* @param q DSA parameter q, may be null if all of p, q, and g are null.57* @param g DSA parameter g, may be null if all of p, q, and g are null.58*/59public DSAPublicKeyImpl(BigInteger y, BigInteger p, BigInteger q,60BigInteger g)61throws InvalidKeyException {62super(y, p, q, g);63}6465/**66* Make a DSA public key from its DER encoding (X.509).67*/68public DSAPublicKeyImpl(byte[] encoded) throws InvalidKeyException {69super(encoded);70}7172protected Object writeReplace() throws java.io.ObjectStreamException {73return new KeyRep(KeyRep.Type.PUBLIC,74getAlgorithm(),75getFormat(),76getEncoded());77}78}798081