diff options
author | Ade Lee <alee@redhat.com> | 2011-12-08 21:15:59 -0500 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2011-12-08 21:15:59 -0500 |
commit | 171aaece4f23709d33d180cf36eb3af5e454b0c9 (patch) | |
tree | 1485f9f0a7bd10de4ff25030db575dbb8dafae74 /pki/base/util/src/netscape/security/provider/DSAPublicKey.java | |
parent | adad2fcee8a29fdb82376fbce07dedb11fccc182 (diff) | |
download | pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.gz pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.tar.xz pki-171aaece4f23709d33d180cf36eb3af5e454b0c9.zip |
Revert "Formatting"
This reverts commit 32150d3ee32f8ac27118af7c792794b538c78a2f.
Diffstat (limited to 'pki/base/util/src/netscape/security/provider/DSAPublicKey.java')
-rw-r--r-- | pki/base/util/src/netscape/security/provider/DSAPublicKey.java | 97 |
1 files changed, 49 insertions, 48 deletions
diff --git a/pki/base/util/src/netscape/security/provider/DSAPublicKey.java b/pki/base/util/src/netscape/security/provider/DSAPublicKey.java index b6e87f696..c3a6896ce 100644 --- a/pki/base/util/src/netscape/security/provider/DSAPublicKey.java +++ b/pki/base/util/src/netscape/security/provider/DSAPublicKey.java @@ -34,18 +34,18 @@ import netscape.security.x509.X509Key; /** * An X.509 public key for the Digital Signature Algorithm. - * - * @author Benjamin Renaud - * + * + * @author Benjamin Renaud + * * @version 1.52, 97/12/10 - * + * * @see DSAPrivateKey * @see AlgIdDSA * @see DSA */ -public final class DSAPublicKey extends X509Key implements - java.security.interfaces.DSAPublicKey, Serializable { +public final class DSAPublicKey extends X509Key +implements java.security.interfaces.DSAPublicKey, Serializable { /** use serialVersionUID from JDK 1.1. for interoperability */ private static final long serialVersionUID = -2994193307391104133L; @@ -54,7 +54,7 @@ public final class DSAPublicKey extends X509Key implements private BigInteger y; /* - * Keep this constructor for backwards compatibility with JDK1.1. + * Keep this constructor for backwards compatibility with JDK1.1. */ public DSAPublicKey() { } @@ -62,26 +62,27 @@ public final class DSAPublicKey extends X509Key implements /** * Make a DSA public key out of a public key and three parameters. */ - public DSAPublicKey(BigInteger y, BigInteger p, BigInteger q, BigInteger g) - throws InvalidKeyException { - this.y = y; - algid = new AlgIdDSA(p, q, g); + public DSAPublicKey(BigInteger y, BigInteger p, BigInteger q, + BigInteger g) + throws InvalidKeyException { + this.y = y; + algid = new AlgIdDSA(p, q, g); - try { - key = new DerValue(DerValue.tag_Integer, y.toByteArray()) - .toByteArray(); - encode(); - } catch (IOException e) { - throw new InvalidKeyException("could not DER encode y: " - + e.getMessage()); - } + try { + key = new DerValue(DerValue.tag_Integer, + y.toByteArray()).toByteArray(); + encode(); + } catch (IOException e) { + throw new InvalidKeyException("could not DER encode y: " + + e.getMessage()); + } } /** * Make a DSA public key from its DER encoding (X.509). */ public DSAPublicKey(byte[] encoded) throws InvalidKeyException { - decode(encoded); + decode(encoded); } /** @@ -89,44 +90,44 @@ public final class DSAPublicKey extends X509Key implements * parameters could not be parsed. */ public DSAParams getParams() { - try { - if (algid instanceof DSAParams) { - return (DSAParams) algid; - } else { - DSAParameterSpec paramSpec; - AlgorithmParameters algParams = algid.getParameters(); - if (algParams == null) { - return null; - } - paramSpec = (DSAParameterSpec) algParams - .getParameterSpec(DSAParameterSpec.class); - return (DSAParams) paramSpec; - } - } catch (InvalidParameterSpecException e) { - return null; - } + try { + if (algid instanceof DSAParams) { + return (DSAParams)algid; + } else { + DSAParameterSpec paramSpec; + AlgorithmParameters algParams = algid.getParameters(); + if (algParams == null) { + return null; + } + paramSpec = (DSAParameterSpec)algParams.getParameterSpec + (DSAParameterSpec.class); + return (DSAParams)paramSpec; + } + } catch (InvalidParameterSpecException e) { + return null; + } } - + /** * Get the raw public value, y, without the parameters. - * + * */ public BigInteger getY() { - return y; + return y; } public String toString() { - return "Sun DSA Public Key\n Parameters:" + algid + "\n y:\n" - + (new BigInt(y)).toString() + "\n"; + return "Sun DSA Public Key\n Parameters:" + algid + + "\n y:\n" + (new BigInt(y)).toString() + "\n"; } protected void parseKeyBits() throws InvalidKeyException { - try { - DerInputStream in = new DerInputStream(key); - y = in.getInteger().toBigInteger(); - } catch (IOException e) { - throw new InvalidKeyException("Invalid key: y value\n" - + e.getMessage()); - } + try { + DerInputStream in = new DerInputStream(key); + y = in.getInteger().toBigInteger(); + } catch (IOException e) { + throw new InvalidKeyException("Invalid key: y value\n" + + e.getMessage()); + } } } |