summaryrefslogtreecommitdiffstats
path: root/pki/base/util/src/netscape/security/provider/DSAParameters.java
diff options
context:
space:
mode:
authorAde Lee <alee@redhat.com>2012-01-11 12:57:53 -0500
committerAde Lee <alee@redhat.com>2012-01-11 13:49:04 -0500
commit10cfe7756e967ac91c66d33b392aeab9cf3780fb (patch)
treed5ac9b58442265d2ce5ef60e31f041ddacba1b4f /pki/base/util/src/netscape/security/provider/DSAParameters.java
parentedcb24f65cc3700e75d0a1d14dc2483f210b0ee4 (diff)
downloadpki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.tar.gz
pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.tar.xz
pki-10cfe7756e967ac91c66d33b392aeab9cf3780fb.zip
Formatting (no line wrap in comments or code)
Diffstat (limited to 'pki/base/util/src/netscape/security/provider/DSAParameters.java')
-rwxr-xr-xpki/base/util/src/netscape/security/provider/DSAParameters.java107
1 files changed, 52 insertions, 55 deletions
diff --git a/pki/base/util/src/netscape/security/provider/DSAParameters.java b/pki/base/util/src/netscape/security/provider/DSAParameters.java
index 70b7fa088..cc3012f75 100755
--- a/pki/base/util/src/netscape/security/provider/DSAParameters.java
+++ b/pki/base/util/src/netscape/security/provider/DSAParameters.java
@@ -32,11 +32,11 @@ import netscape.security.util.DerValue;
* This class implements the parameter set used by the
* Digital Signature Algorithm as specified in the FIPS 186
* standard.
- *
+ *
* @author Jan Luehe
- *
+ *
* @version 1.8, 97/12/10
- *
+ *
* @since JDK1.2
*/
@@ -51,82 +51,79 @@ public class DSAParameters extends AlgorithmParametersSpi {
// the base (g)
protected BigInteger g;
- protected void engineInit(AlgorithmParameterSpec paramSpec)
- throws InvalidParameterSpecException {
- if (!(paramSpec instanceof DSAParameterSpec)) {
- throw new InvalidParameterSpecException
- ("Inappropriate parameter specification");
- }
- this.p = ((DSAParameterSpec)paramSpec).getP();
- this.q = ((DSAParameterSpec)paramSpec).getQ();
- this.g = ((DSAParameterSpec)paramSpec).getG();
+ protected void engineInit(AlgorithmParameterSpec paramSpec)
+ throws InvalidParameterSpecException {
+ if (!(paramSpec instanceof DSAParameterSpec)) {
+ throw new InvalidParameterSpecException("Inappropriate parameter specification");
+ }
+ this.p = ((DSAParameterSpec) paramSpec).getP();
+ this.q = ((DSAParameterSpec) paramSpec).getQ();
+ this.g = ((DSAParameterSpec) paramSpec).getG();
}
protected void engineInit(byte[] params) throws IOException {
- DerValue encodedParams = new DerValue(params);
+ DerValue encodedParams = new DerValue(params);
- if (encodedParams.tag != DerValue.tag_Sequence) {
- throw new IOException("DSA params parsing error");
- }
+ if (encodedParams.tag != DerValue.tag_Sequence) {
+ throw new IOException("DSA params parsing error");
+ }
- encodedParams.data.reset();
+ encodedParams.data.reset();
- this.p = encodedParams.data.getInteger().toBigInteger();
- this.q = encodedParams.data.getInteger().toBigInteger();
- this.g = encodedParams.data.getInteger().toBigInteger();
+ this.p = encodedParams.data.getInteger().toBigInteger();
+ this.q = encodedParams.data.getInteger().toBigInteger();
+ this.g = encodedParams.data.getInteger().toBigInteger();
- if (encodedParams.data.available() != 0) {
- throw new IOException("encoded params have " +
- encodedParams.data.available() +
- " extra bytes");
- }
+ if (encodedParams.data.available() != 0) {
+ throw new IOException("encoded params have " +
+ encodedParams.data.available() +
+ " extra bytes");
+ }
}
protected void engineInit(byte[] params, String decodingMethod)
- throws IOException {
- engineInit(params);
+ throws IOException {
+ engineInit(params);
}
protected AlgorithmParameterSpec engineGetParameterSpec(Class paramSpec)
- throws InvalidParameterSpecException {
- try {
- Class dsaParamSpec = Class.forName
- ("java.security.spec.DSAParameterSpec");
- if (dsaParamSpec.isAssignableFrom(paramSpec)) {
- return new DSAParameterSpec(this.p, this.q, this.g);
- } else {
- throw new InvalidParameterSpecException
- ("Inappropriate parameter Specification");
- }
- } catch (ClassNotFoundException e) {
- throw new InvalidParameterSpecException
- ("Unsupported parameter specification: " + e.getMessage());
- }
+ throws InvalidParameterSpecException {
+ try {
+ Class dsaParamSpec = Class.forName
+ ("java.security.spec.DSAParameterSpec");
+ if (dsaParamSpec.isAssignableFrom(paramSpec)) {
+ return new DSAParameterSpec(this.p, this.q, this.g);
+ } else {
+ throw new InvalidParameterSpecException("Inappropriate parameter Specification");
+ }
+ } catch (ClassNotFoundException e) {
+ throw new InvalidParameterSpecException("Unsupported parameter specification: " + e.getMessage());
+ }
}
protected byte[] engineGetEncoded() throws IOException {
- DerOutputStream out = new DerOutputStream();
- DerOutputStream bytes = new DerOutputStream();
-
- bytes.putInteger(new BigInt(p.toByteArray()));
- bytes.putInteger(new BigInt(q.toByteArray()));
- bytes.putInteger(new BigInt(g.toByteArray()));
- out.write(DerValue.tag_Sequence, bytes);
- return out.toByteArray();
+ DerOutputStream out = new DerOutputStream();
+ DerOutputStream bytes = new DerOutputStream();
+
+ bytes.putInteger(new BigInt(p.toByteArray()));
+ bytes.putInteger(new BigInt(q.toByteArray()));
+ bytes.putInteger(new BigInt(g.toByteArray()));
+ out.write(DerValue.tag_Sequence, bytes);
+ return out.toByteArray();
}
protected byte[] engineGetEncoded(String encodingMethod)
- throws IOException {
- return engineGetEncoded();
+ throws IOException {
+ return engineGetEncoded();
}
/*
* Returns a formatted string describing the parameters.
*/
protected String engineToString() {
- return "\n\tp: " + new BigInt(p).toString()
- + "\n\tq: " + new BigInt(q).toString()
- + "\n\tg: " + new BigInt(g).toString()
- + "\n";
+ return "\n\tp: " + new BigInt(p).toString()
+ + "\n\tq: " + new BigInt(q).toString()
+ + "\n\tg: " + new BigInt(g).toString()
+ + "\n";
}
}