summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape/security/provider/DSAPublicKey.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2011-12-07 16:58:12 -0500
committerAde Lee <alee@redhat.com>2011-12-07 16:58:12 -0500
commit32150d3ee32f8ac27118af7c792794b538c78a2f (patch)
tree52dd96f664a6fa51be25b28b6f10adc5f2c9f660 /pki/base/util/src/netscape/security/provider/DSAPublicKey.java
parentf05d58a46795553beb8881039cc922974b40db34 (diff)
downloadpki-32150d3ee32f8ac27118af7c792794b538c78a2f.tar.gz
pki-32150d3ee32f8ac27118af7c792794b538c78a2f.tar.xz
pki-32150d3ee32f8ac27118af7c792794b538c78a2f.zip
Formatting
Formatted project according to eclipse project settings
Diffstat (limited to 'pki/base/util/src/netscape/security/provider/DSAPublicKey.java')
-rw-r--r--pki/base/util/src/netscape/security/provider/DSAPublicKey.java97
1 files changed, 48 insertions, 49 deletions
diff --git a/pki/base/util/src/netscape/security/provider/DSAPublicKey.java b/pki/base/util/src/netscape/security/provider/DSAPublicKey.java
index c3a6896ce..b6e87f696 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 @@ implements java.security.interfaces.DSAPublicKey, Serializable {
private BigInteger y;
/*
- * Keep this constructor for backwards compatibility with JDK1.1.
+ * Keep this constructor for backwards compatibility with JDK1.1.
*/
public DSAPublicKey() {
}
@@ -62,27 +62,26 @@ implements java.security.interfaces.DSAPublicKey, Serializable {
/**
* 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);
}
/**
@@ -90,44 +89,44 @@ implements java.security.interfaces.DSAPublicKey, Serializable {
* 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());
+ }
}
}