commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] classpath/gnu/java/security/key rsaRSAKeyPairPK...


From: Raif S. Naffah
Subject: [commit-cp] classpath/gnu/java/security/key rsaRSAKeyPairPK...
Date: Tue, 20 Jun 2006 11:24:43 +0000

CVSROOT:        /cvsroot/classpath
Module name:    classpath
Changes by:     Raif S. Naffah <raif>   06/06/20 11:24:43

Modified files:
        gnu/java/security/key/rsa: RSAKeyPairPKCS8Codec.java 
                                   RSAKeyPairGenerator.java 
                                   GnuRSAKey.java 
                                   RSAKeyPairRawCodec.java 
                                   GnuRSAPrivateKey.java 
                                   RSAKeyPairX509Codec.java 
                                   GnuRSAPublicKey.java 
        .              : ChangeLog 
        gnu/java/security/key: KeyPairCodecFactory.java 
                               KeyPairGeneratorFactory.java 
                               IKeyPairGenerator.java IKeyPairCodec.java 
        gnu/java/security/key/dss: DSSKeyPairRawCodec.java 
                                   DSSPublicKey.java DSSKey.java 
                                   DSSKeyPairGenerator.java 
                                   DSSPrivateKey.java 
                                   DSSKeyPairX509Codec.java 
                                   DSSKeyPairPKCS8Codec.java 
                                   FIPS186.java 

Log message:
        2006-06-20  Raif S. Naffah  <address@hidden>
        
                * gnu/java/security/key/dss/DSSKey.java: Source formatting.
                * gnu/java/security/key/dss/DSSKeyPairGenerator.java: Likewise.
                * gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java: Likewise.
                * gnu/java/security/key/dss/DSSKeyPairRawCodec.java: Likewise.
                * gnu/java/security/key/dss/DSSKeyPairX509Codec.java: Likewise.
                * gnu/java/security/key/dss/DSSPrivateKey.java: Likewise.
                * gnu/java/security/key/dss/DSSPublicKey.java: Likewise.
                * gnu/java/security/key/dss/FIPS186.java: Likewise.
                * gnu/java/security/key/rsa/GnuRSAKey.java: Likewise.
                * gnu/java/security/key/rsa/GnuRSAPrivateKey.java: Likewise.
                * gnu/java/security/key/rsa/GnuRSAPublicKey.java: Likewise.
                * gnu/java/security/key/rsa/RSAKeyPairGenerator.java: Likewise.
                * gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java: Likewise.
                * gnu/java/security/key/rsa/RSAKeyPairRawCodec.java: Likewise.
                * gnu/java/security/key/rsa/RSAKeyPairX509Codec.java: Likewise.
                * gnu/java/security/key/IKeyPairCodec.java: Likewise.
                * gnu/java/security/key/IKeyPairGenerator.java: Likewise.
                * gnu/java/security/key/KeyPairCodecFactory.java: Likewise.
                * gnu/java/security/key/KeyPairGeneratorFactory.java: Likewise.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/rsa/RSAKeyPairGenerator.java?cvsroot=classpath&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/rsa/GnuRSAKey.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java?cvsroot=classpath&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/rsa/GnuRSAPrivateKey.java?cvsroot=classpath&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java?cvsroot=classpath&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/rsa/GnuRSAPublicKey.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.7879&r2=1.7880
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/KeyPairCodecFactory.java?cvsroot=classpath&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/KeyPairGeneratorFactory.java?cvsroot=classpath&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/IKeyPairGenerator.java?cvsroot=classpath&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/IKeyPairCodec.java?cvsroot=classpath&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/dss/DSSKeyPairRawCodec.java?cvsroot=classpath&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/dss/DSSPublicKey.java?cvsroot=classpath&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/dss/DSSKey.java?cvsroot=classpath&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/dss/DSSKeyPairGenerator.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/dss/DSSPrivateKey.java?cvsroot=classpath&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/dss/DSSKeyPairX509Codec.java?cvsroot=classpath&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java?cvsroot=classpath&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/java/security/key/dss/FIPS186.java?cvsroot=classpath&r1=1.4&r2=1.5

Patches:
Index: rsa/RSAKeyPairPKCS8Codec.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- rsa/RSAKeyPairPKCS8Codec.java       11 Jun 2006 12:14:43 -0000      1.5
+++ rsa/RSAKeyPairPKCS8Codec.java       20 Jun 2006 11:24:41 -0000      1.6
@@ -85,7 +85,6 @@
   /**
    * Returns the PKCS#8 ASN.1 <i>PrivateKeyInfo</i> representation of an RSA
    * private key. The ASN.1 specification is as follows:
-   * 
    * <pre>
    *   PrivateKeyInfo ::= SEQUENCE {
    *     version              INTEGER, -- MUST be 0
@@ -98,10 +97,9 @@
    *     parameters  ANY DEFINED BY algorithm OPTIONAL
    *   }
    * </pre>
-   * 
-   * <p>The <i>privateKey</i> field, which is an OCTET STRING, contains the
-   * DER-encoded form of the RSA private key defined as:</p>
-   * 
+   * <p>
+   * The <i>privateKey</i> field, which is an OCTET STRING, contains the
+   * DER-encoded form of the RSA private key defined as:
    * <pre>
    *   RSAPrivateKey ::= SEQUENCE {
    *     version                 INTEGER, -- MUST be 0
@@ -125,7 +123,6 @@
   {
     if (Configuration.DEBUG)
       log.entering(this.getClass().getName(), "encodePrivateKey()", key);
-
     if (! (key instanceof GnuRSAPrivateKey))
       throw new InvalidParameterException("Wrong key type");
 
@@ -217,7 +214,6 @@
   {
     if (Configuration.DEBUG)
       log.entering(this.getClass().getName(), "decodePrivateKey()", input);
-
     if (input == null)
       throw new InvalidParameterException("Input bytes MUST NOT be null");
 
@@ -287,9 +283,8 @@
         y.initCause(x);
         throw y;
       }
-
-    PrivateKey result = new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e,
-                                             d, p, q, dP, dQ, qInv);
+    PrivateKey result = new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID,
+                                             n, e, d, p, q, dP, dQ, qInv);
     if (Configuration.DEBUG)
       log.exiting(this.getClass().getName(), "decodePrivateKey()", result);
     return result;

Index: rsa/RSAKeyPairGenerator.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/rsa/RSAKeyPairGenerator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- rsa/RSAKeyPairGenerator.java        18 Jun 2006 02:43:55 -0000      1.6
+++ rsa/RSAKeyPairGenerator.java        20 Jun 2006 11:24:41 -0000      1.7
@@ -53,25 +53,23 @@
 import java.util.logging.Logger;
 
 /**
- * <p>A key-pair generator for asymetric keys to use in conjunction with the 
RSA
- * scheme.</p>
- *
- * <p>Reference:</p>
+ * A key-pair generator for asymetric keys to use in conjunction with the RSA
+ * scheme.
+ * <p>
+ * Reference:
  * <ol>
- *    <li><a 
href="http://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/rsa-pss.zip";>
- *    RSA-PSS Signature Scheme with Appendix</a>, part B. Primitive
- *    specification and supporting documentation. Jakob Jonsson and Burt 
Kaliski.
- *    </li>
+ * <li><a
+ * 
href="http://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/rsa-pss.zip";>
+ * RSA-PSS Signature Scheme with Appendix</a>, part B. Primitive specification
+ * and supporting documentation. Jakob Jonsson and Burt Kaliski. </li>
  *    <li><a href="http://www.cacr.math.uwaterloo.ca/hac/";>Handbook of Applied
  *    Cryptography</a>, Alfred J. Menezes, Paul C. van Oorschot and Scott A.
  *    Vanstone. Section 11.3 RSA and related signature schemes.</li>
  * </ol>
  */
-public class RSAKeyPairGenerator implements IKeyPairGenerator
+public class RSAKeyPairGenerator
+    implements IKeyPairGenerator
 {
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
   private static final Logger log = 
Logger.getLogger(RSAKeyPairGenerator.class.getName());
 
   /** The BigInteger constant 1. */
@@ -90,8 +88,8 @@
   public static final String SOURCE_OF_RANDOMNESS = "gnu.crypto.rsa.prng";
 
   /**
-   * Property name of an optional address@hidden RSAKeyGenParameterSpec} 
instance to
-   * use for this generator's <code>n</code>, and <code>e</code> values. The
+   * Property name of an optional address@hidden RSAKeyGenParameterSpec} 
instance to use
+   * for this generator's <code>n</code>, and <code>e</code> values. The
    * default is to generate <code>n</code> and use a fixed value for
    * <code>e</.code> (Fermat's F4 number).
    */
@@ -128,27 +126,19 @@
   /** Preferred encoding format of generated keys. */
   private int preferredFormat;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   // implicit 0-arguments constructor
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
-  // gnu.crypto.key.IKeyPairGenerator interface implementation ---------------
-
   public String name()
   {
     return Registry.RSA_KPG;
   }
 
   /**
-   * <p>Configures this instance.</p>
+   * Configures this instance.
    *
    * @param attributes the map of name/value pairs to use.
-   * @exception IllegalArgumentException if the designated MODULUS_LENGTH
-   * value is less than 1024.
+   * @exception IllegalArgumentException if the designated MODULUS_LENGTH value
+   *              is less than 1024.
    */
   public void setup(Map attributes)
   {
@@ -156,10 +146,8 @@
       log.entering(this.getClass().getName(), "setup", attributes);
     // do we have a SecureRandom, or should we use our own?
     rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);
-
     // are we given a set of RSA params or we shall use our own?
     RSAKeyGenParameterSpec params = (RSAKeyGenParameterSpec) 
attributes.get(RSA_PARAMETERS);
-
     // find out the modulus length
     if (params != null)
       {
@@ -171,11 +159,8 @@
         Integer l = (Integer) attributes.get(MODULUS_LENGTH);
         L = (l == null ? DEFAULT_MODULUS_LENGTH : l.intValue());
       }
-
     if (L < 1024)
-      {
         throw new IllegalArgumentException(MODULUS_LENGTH);
-      }
 
     // what is the preferred encoding format
     Integer formatID = (Integer) attributes.get(PREFERRED_ENCODING_FORMAT);
@@ -186,8 +171,10 @@
   }
 
   /**
-   * <p>The algorithm used here is described in <i>nessie-pss-B.pdf</i>
-   * document which is part of the RSA-PSS submission to NESSIE.</p>
+   * <p>
+   * The algorithm used here is described in <i>nessie-pss-B.pdf</i> document
+   * which is part of the RSA-PSS submission to NESSIE.
+   * </p>
    *
    * @return an RSA keypair.
    */
@@ -195,9 +182,7 @@
   {
     if (Configuration.DEBUG)
       log.entering(this.getClass().getName(), "generate");
-
     BigInteger p, q, n, d;
-
     // 1. Generate a prime p in the interval [2**(M-1), 2**M - 1], where
     // M = CEILING(L/2), and such that GCD(p, e) = 1
     int M = (L + 1) / 2;
@@ -210,11 +195,8 @@
         p = new BigInteger(1, kb).setBit(0);
         if (p.compareTo(lower) >= 0 && p.compareTo(upper) <= 0
             && p.isProbablePrime(80) && p.gcd(e).equals(ONE))
-          {
             break step1;
           }
-      }
-
     // 2. Generate a prime q such that the product of p and q is an L-bit
     // number, and such that GCD(q, e) = 1
     step2: while (true)
@@ -222,46 +204,34 @@
         nextRandomBytes(kb);
         q = new BigInteger(1, kb).setBit(0);
         n = p.multiply(q);
-        if (n.bitLength() == L && q.isProbablePrime(80)
-            && q.gcd(e).equals(ONE))
-          {
+        if (n.bitLength() == L && q.isProbablePrime(80) && 
q.gcd(e).equals(ONE))
             break step2;
-          }
-
         // TODO: test for p != q
       }
-
     // TODO: ensure p < q
-
     // 3. Put n = pq. The public key is (n, e).
     // 4. Compute the parameters necessary for the private key K (see
     // Section 2.2).
     BigInteger phi = p.subtract(ONE).multiply(q.subtract(ONE));
     d = e.modInverse(phi);
-
     // 5. Output the public key and the private key.
     PublicKey pubK = new GnuRSAPublicKey(preferredFormat, n, e);
     PrivateKey secK = new GnuRSAPrivateKey(preferredFormat, p, q, e, d);
-
     KeyPair result = new KeyPair(pubK, secK);
     if (Configuration.DEBUG)
       log.exiting(this.getClass().getName(), "generate", result);
     return result;
   }
 
-  // helper methods ----------------------------------------------------------
-
   /**
-   * <p>Fills the designated byte array with random data.</p>
+   * Fills the designated byte array with random data.
    *
    * @param buffer the byte array to fill with random data.
    */
   private void nextRandomBytes(byte[] buffer)
   {
     if (rnd != null)
-      {
         rnd.nextBytes(buffer);
-      }
     else
       getDefaultPRNG().nextBytes(buffer);
   }

Index: rsa/GnuRSAKey.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/rsa/GnuRSAKey.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- rsa/GnuRSAKey.java  29 Apr 2006 06:53:06 -0000      1.5
+++ rsa/GnuRSAKey.java  20 Jun 2006 11:24:41 -0000      1.6
@@ -47,14 +47,11 @@
 import java.security.interfaces.RSAKey;
 
 /**
- * <p>A base asbtract class for both public and private RSA keys.</p>
+ * A base asbtract class for both public and private RSA keys.
  */
-public abstract class GnuRSAKey implements Key, RSAKey
+public abstract class GnuRSAKey
+    implements Key, RSAKey
 {
-
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
   /** The public modulus of an RSA key pair. */
   private final BigInteger n;
 
@@ -62,17 +59,14 @@
   private final BigInteger e;
 
   /**
-   * Identifier of the default encoding format to use when externalizing the
-   * key material.
+   * Identifier of the default encoding format to use when externalizing the 
key
+   * material.
    */
   protected final int defaultFormat;
 
   /** String representation of this key. Cached for speed. */
   private transient String str;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   /**
    * Trivial protected constructor.
    * 
@@ -91,21 +85,11 @@
     this.e = e;
   }
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
-  // Instance methods
-  // -------------------------------------------------------------------------
-
-  // java.security.interfaces.RSAKey interface implementation ----------------
-
   public BigInteger getModulus()
   {
     return getN();
   }
 
-  // java.security.Key interface implementation ------------------------------
-
   public String getAlgorithm()
   {
     return Registry.RSA_KPG;
@@ -122,10 +106,8 @@
     return FormatUtil.getEncodingShortName(defaultFormat);
   }
 
-  // Other instance methods --------------------------------------------------
-
   /**
-   * <p>Returns the modulus <code>n</code>.</p>
+   * Returns the modulus <code>n</code>.
    *
    * @return the modulus <code>n</code>.
    */
@@ -135,7 +117,7 @@
   }
 
   /**
-   * <p>Returns the public exponent <code>e</code>.</p>
+   * Returns the public exponent <code>e</code>.
    *
    * @return the public exponent <code>e</code>.
    */
@@ -145,7 +127,7 @@
   }
 
   /**
-   * <p>Same as address@hidden #getPublicExponent()}.</p>
+   * Same as address@hidden #getPublicExponent()}.
    *
    * @return the public exponent <code>e</code>.
    */
@@ -155,23 +137,21 @@
   }
 
   /**
-   * <p>Returns <code>true</code> if the designated object is an instance of
-   * address@hidden RSAKey} and has the same RSA parameter values as this 
one.</p>
+   * Returns <code>true</code> if the designated object is an instance of
+   * address@hidden RSAKey} and has the same RSA parameter values as this one.
    *
    * @param obj the other non-null RSA key to compare to.
-   * @return <code>true</code> if the designated object is of the same type and
-   * value as this one.
+   * @return <code>true</code> if the designated object is of the same type
+   *         and value as this one.
    */
   public boolean equals(final Object obj)
   {
     if (obj == null)
-      {
         return false;
-      }
-    if (!(obj instanceof RSAKey))
-      {
+
+    if (! (obj instanceof RSAKey))
         return false;
-      }
+
     final RSAKey that = (RSAKey) obj;
     return n.equals(that.getModulus());
   }
@@ -181,7 +161,7 @@
     if (str == null)
       {
         String ls = SystemProperties.getProperty("line.separator");
-        str = new StringBuilder().append(ls)
+        str = new StringBuilder(ls)
             
.append("defaultFormat=").append(defaultFormat).append(",").append(ls)
             .append("n=0x").append(n.toString(16)).append(",").append(ls)
             .append("e=0x").append(e.toString(16))
@@ -190,7 +170,5 @@
     return str;
   }
 
-  // abstract methods to be implemented by subclasses ------------------------
-
   public abstract byte[] getEncoded(int format);
 }

Index: rsa/RSAKeyPairRawCodec.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/rsa/RSAKeyPairRawCodec.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- rsa/RSAKeyPairRawCodec.java 26 Jan 2006 02:25:11 -0000      1.1
+++ rsa/RSAKeyPairRawCodec.java 20 Jun 2006 11:24:41 -0000      1.2
@@ -47,54 +47,41 @@
 import java.security.PublicKey;
 
 /**
- * <p>An object that implements the address@hidden IKeyPairCodec} interface 
for the
- * <i>Raw</i> format to use with RSA keypairs.</p>
+ * An object that implements the address@hidden IKeyPairCodec} interface for 
the <i>Raw</i>
+ * format to use with RSA keypairs.
  *
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
  */
-public class RSAKeyPairRawCodec implements IKeyPairCodec
+public class RSAKeyPairRawCodec
+    implements IKeyPairCodec
 {
-
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   // implicit 0-arguments constructor
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
-  // Instance methods
-  // -------------------------------------------------------------------------
-
-  // gnu.crypto.key.IKeyPairCodec interface implementation -------------------
-
   public int getFormatID()
   {
     return RAW_FORMAT;
   }
 
   /**
-   * <p>Returns the encoded form of the designated RSA public key according to
-   * the <i>Raw</i> format supported by this library.</p>
-   *
-   * <p>The <i>Raw</i> format for an RSA public key, in this implementation, is
-   * a byte sequence consisting of the following:</p>
-   *
+   * Returns the encoded form of the designated RSA public key according to the
+   * <i>Raw</i> format supported by this library.
+   * <p>
+   * The <i>Raw</i> format for an RSA public key, in this implementation, is a
+   * byte sequence consisting of the following:
    * <ol>
    *           <li>4-byte magic consisting of the value of the literal
-   *    address@hidden Registry#MAGIC_RAW_RSA_PUBLIC_KEY},<li>
+   * address@hidden Registry#MAGIC_RAW_RSA_PUBLIC_KEY},</li>
    *           <li>1-byte version consisting of the constant: 0x01,</li>
    *           <li>4-byte count of following bytes representing the RSA 
parameter
    *           <code>n</code> (the modulus) in internet order,</li>
    *           <li>n-bytes representation of a address@hidden BigInteger} 
obtained by invoking
-   *    the <code>toByteArray()</code> method on the RSA parameter 
<code>n</code>,</li>
+   * the <code>toByteArray()</code> method on the RSA parameter <code>n</code>,
+   * </li>
    *           <li>4-byte count of following bytes representing the RSA 
parameter
    *           <code>e</code> (the public exponent) in internet order,</li>
    *           <li>n-bytes representation of a address@hidden BigInteger} 
obtained by invoking
-   *    the <code>toByteArray()</code> method on the RSA parameter 
<code>e</code>.</li>
+   * the <code>toByteArray()</code> method on the RSA parameter <code>e</code>.
+   * </li>
    * </ol>
    *
    * @param key the key to encode.
@@ -104,23 +91,18 @@
    */
   public byte[] encodePublicKey(PublicKey key)
   {
-    if (!(key instanceof GnuRSAPublicKey))
-      {
+    if (! (key instanceof GnuRSAPublicKey))
         throw new IllegalArgumentException("key");
-      }
 
     GnuRSAPublicKey rsaKey = (GnuRSAPublicKey) key;
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
     // magic
     baos.write(Registry.MAGIC_RAW_RSA_PUBLIC_KEY[0]);
     baos.write(Registry.MAGIC_RAW_RSA_PUBLIC_KEY[1]);
     baos.write(Registry.MAGIC_RAW_RSA_PUBLIC_KEY[2]);
     baos.write(Registry.MAGIC_RAW_RSA_PUBLIC_KEY[3]);
-
     // version
     baos.write(0x01);
-
     // n
     byte[] buffer = rsaKey.getModulus().toByteArray();
     int length = buffer.length;
@@ -129,7 +111,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // e
     buffer = rsaKey.getPublicExponent().toByteArray();
     length = buffer.length;
@@ -138,7 +119,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     return baos.toByteArray();
   }
 
@@ -149,68 +129,68 @@
         || k[1] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[1]
         || k[2] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[2]
         || k[3] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[3])
-      {
         throw new IllegalArgumentException("magic");
-      }
 
     // version
     if (k[4] != 0x01)
-      {
         throw new IllegalArgumentException("version");
-      }
-    int i = 5;
 
+    int i = 5;
     int l;
     byte[] buffer;
-
     // n
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger n = new BigInteger(1, buffer);
-
     // e
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger e = new BigInteger(1, buffer);
-
     return new GnuRSAPublicKey(n, e);
   }
 
   /**
-   * <p>Returns the encoded form of the designated RSA private key according to
-   * the <i>Raw</i> format supported by this library.</p>
-   *
-   * <p>The <i>Raw</i> format for an RSA private key, in this implementation,
-   * is a byte sequence consisting of the following:</p>
-   *
+   * Returns the encoded form of the designated RSA private key according to 
the
+   * <i>Raw</i> format supported by this library.
+   * <p>
+   * The <i>Raw</i> format for an RSA private key, in this implementation, is a
+   * byte sequence consisting of the following:
    * <ol>
    *           <li>4-byte magic consisting of the value of the literal
-   *    address@hidden Registry#MAGIC_RAW_RSA_PRIVATE_KEY},<li>
+   * address@hidden Registry#MAGIC_RAW_RSA_PRIVATE_KEY},</li>
    *           <li>1-byte version consisting of the constant: 0x01,</li>
    *           <li>4-byte count of following bytes representing the RSA 
parameter
-   *           <code>p</code> (the first prime factor of the modulus) in 
internet
-   *    order,</li>
+   * <code>p</code> (the first prime factor of the modulus) in internet order,
+   * </li>
    *           <li>n-bytes representation of a address@hidden BigInteger} 
obtained by invoking
-   *    the <code>toByteArray()</code> method on the RSA parameter 
<code>p</code>,</li>
+   * the <code>toByteArray()</code> method on the RSA parameter <code>p</code>,
+   * </li>
    *           <li>4-byte count of following bytes representing the RSA 
parameter
    *           <code>q</code> (the second prime factor of the modulus) in 
internet
    *    order,</li>
    *           <li>n-bytes representation of a address@hidden BigInteger} 
obtained by invoking
-   *    the <code>toByteArray()</code> method on the RSA parameter 
<code>q</code>,</li>
+   * the <code>toByteArray()</code> method on the RSA parameter <code>q</code>,
+   * </li>
    *           <li>4-byte count of following bytes representing the RSA 
parameter
    *           <code>e</code> (the public exponent) in internet order,</li>
    *           <li>n-bytes representation of a address@hidden BigInteger} 
obtained by invoking
-   *    the <code>toByteArray()</code> method on the RSA parameter 
<code>e</code>,</li>
+   * the <code>toByteArray()</code> method on the RSA parameter <code>e</code>,
+   * </li>
    *           <li>4-byte count of following bytes representing the RSA 
parameter
    *           <code>d</code> (the private exponent) in internet order,</li>
    *           <li>n-bytes representation of a address@hidden BigInteger} 
obtained by invoking
-   *    the <code>toByteArray()</code> method on the RSA parameter 
<code>d</code>,</li>
+   * the <code>toByteArray()</code> method on the RSA parameter <code>d</code>,
+   * </li>
    * </ol>
    *
    * @param key the key to encode.
@@ -218,23 +198,18 @@
    */
   public byte[] encodePrivateKey(PrivateKey key)
   {
-    if (!(key instanceof GnuRSAPrivateKey))
-      {
+    if (! (key instanceof GnuRSAPrivateKey))
         throw new IllegalArgumentException("key");
-      }
 
     GnuRSAPrivateKey rsaKey = (GnuRSAPrivateKey) key;
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
     // magic
     baos.write(Registry.MAGIC_RAW_RSA_PRIVATE_KEY[0]);
     baos.write(Registry.MAGIC_RAW_RSA_PRIVATE_KEY[1]);
     baos.write(Registry.MAGIC_RAW_RSA_PRIVATE_KEY[2]);
     baos.write(Registry.MAGIC_RAW_RSA_PRIVATE_KEY[3]);
-
     // version
     baos.write(0x01);
-
     // p
     byte[] buffer = rsaKey.getPrimeP().toByteArray();
     int length = buffer.length;
@@ -243,7 +218,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // q
     buffer = rsaKey.getPrimeQ().toByteArray();
     length = buffer.length;
@@ -252,7 +226,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // e
     buffer = rsaKey.getPublicExponent().toByteArray();
     length = buffer.length;
@@ -261,7 +234,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // d
     buffer = rsaKey.getPrivateExponent().toByteArray();
     length = buffer.length;
@@ -270,7 +242,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     return baos.toByteArray();
   }
 
@@ -281,52 +252,51 @@
         || k[1] != Registry.MAGIC_RAW_RSA_PRIVATE_KEY[1]
         || k[2] != Registry.MAGIC_RAW_RSA_PRIVATE_KEY[2]
         || k[3] != Registry.MAGIC_RAW_RSA_PRIVATE_KEY[3])
-      {
         throw new IllegalArgumentException("magic");
-      }
 
     // version
     if (k[4] != 0x01)
-      {
         throw new IllegalArgumentException("version");
-      }
-    int i = 5;
 
+    int i = 5;
     int l;
     byte[] buffer;
-
     // p
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger p = new BigInteger(1, buffer);
-
     // q
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger q = new BigInteger(1, buffer);
-
     // e
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger e = new BigInteger(1, buffer);
-
     // d
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger d = new BigInteger(1, buffer);
-
     return new GnuRSAPrivateKey(p, q, e, d);
   }
 }

Index: rsa/GnuRSAPrivateKey.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/rsa/GnuRSAPrivateKey.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- rsa/GnuRSAPrivateKey.java   11 Jun 2006 12:14:43 -0000      1.6
+++ rsa/GnuRSAPrivateKey.java   20 Jun 2006 11:24:41 -0000      1.7
@@ -49,18 +49,20 @@
 import java.security.interfaces.RSAPrivateKey;
 
 /**
- * <p>An object that embodies an RSA private key.</p>
- *
- * <p>References:</p>
+ * An object that embodies an RSA private key.
+ * <p>
+ * References:
  * <ol>
- *    <li><a 
href="http://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/rsa-pss.zip";>
+ * <li><a
+ * 
href="http://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/rsa-pss.zip";>
  *    RSA-PSS Signature Scheme with Appendix, part B.</a><br>
  *    Primitive specification and supporting documentation.<br>
  *    Jakob Jonsson and Burt Kaliski.</li>
  * </ol>
  */
-public class GnuRSAPrivateKey extends GnuRSAKey implements PrivateKey,
-    RSAPrivateCrtKey
+public class GnuRSAPrivateKey
+    extends GnuRSAKey
+    implements PrivateKey, RSAPrivateCrtKey
 {
   /** The first prime divisor of the modulus. */
   private final BigInteger p;
@@ -68,8 +70,6 @@
   /** The second prime divisor of the modulus. */
   private final BigInteger q;
 
-  /** The public exponent of an RSA key. */
-  //   private final BigInteger e;
   /** The private exponent of an RSA private key. */
   private final BigInteger d;
 
@@ -85,9 +85,6 @@
   /** String representation of this key. Cached for speed. */
   private transient String str;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   /**
    * Convenience constructor. Calls the constructor with 5 arguments passing
    * address@hidden Registry#RAW_ENCODING_ID} as the identifier of the 
preferred
@@ -98,8 +95,7 @@
    * @param e the public exponent.
    * @param d the private exponent.
    */
-  public GnuRSAPrivateKey(BigInteger p, BigInteger q, BigInteger e,
-                          BigInteger d)
+  public GnuRSAPrivateKey(BigInteger p, BigInteger q, BigInteger e, BigInteger 
d)
   {
     this(Registry.RAW_ENCODING_ID, p, q, e, d);
   }
@@ -118,7 +114,9 @@
   public GnuRSAPrivateKey(int preferredFormat, BigInteger p, BigInteger q,
                           BigInteger e, BigInteger d)
   {
-    this(preferredFormat, p.multiply(q), e, d, p, q, 
+    this(preferredFormat,
+         p.multiply(q),
+         e, d, p, q,
          e.modInverse(p.subtract(BigInteger.ONE)),
          e.modInverse(q.subtract(BigInteger.ONE)),
          q.modInverse(p));
@@ -137,13 +135,14 @@
    * @param p the modulus first prime divisor.
    * @param q the modulus second prime divisor.
    * @param dP the first prime's exponen. A positive integer less than
-   * <code>p</code> and <code>q</code>, satisfying <code>e * dP = 1 (mod p-1)
-   * </code>.
+   *          <code>p</code> and <code>q</code>, satisfying
+   *          <code>e * dP = 1 (mod p-1)</code>.
    * @param dQ the second prime's exponent. A positive integer less than
-   * <code>p</code> and <code>q</code>, satisfying <code>e * dQ = 1 (mod p-1)
-   * </code>.
+   *          <code>p</code> and <code>q</code>, satisfying
+   *          <code>e * dQ = 1 (mod p-1)</code>.
    * @param qInv the Chinese Remainder Theorem coefiicient. A positive integer
-   * less than <code>p</code>, satisfying <code>q * qInv = 1 (mod p)</code>.
+   *          less than <code>p</code>, satisfying
+   *          <code>q * qInv = 1 (mod p)</code>.
    */
   public GnuRSAPrivateKey(int preferredFormat, BigInteger n, BigInteger e,
                           BigInteger d, BigInteger p, BigInteger q,
@@ -152,7 +151,6 @@
     super(preferredFormat == Registry.ASN1_ENCODING_ID ? 
Registry.PKCS8_ENCODING_ID
                                                        : preferredFormat,
           n, e);
-
     this.d = d;
     this.p = p;
     this.q = q;
@@ -167,9 +165,6 @@
     this.qInv = qInv;
   }
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
   /**
    * A class method that takes the output of the 
<code>encodePrivateKey()</code>
    * method of an RSA keypair codec object (an instance implementing
@@ -194,14 +189,10 @@
       catch (IllegalArgumentException ignored)
         {
         }
-
     // try PKCS#8 codec
     return (GnuRSAPrivateKey) new RSAKeyPairPKCS8Codec().decodePrivateKey(k);
   }
 
-  // Instance methods
-  // -------------------------------------------------------------------------
-
   public BigInteger getPrimeP()
   {
     return p;
@@ -227,18 +218,14 @@
     return qInv;
   }
 
-  // java.security.interfaces.RSAPrivateKey interface implementation ---------
-
   public BigInteger getPrivateExponent()
   {
     return d;
   }
 
-  // Other instance methods --------------------------------------------------
-
   /**
-   * Returns the encoded form of this private key according to the
-   * designated format.
+   * Returns the encoded form of this private key according to the designated
+   * format.
    *
    * @param format the desired format identifier of the resulting encoding.
    * @return the byte sequence encoding this key according to the designated
@@ -266,8 +253,8 @@
   }
 
   /**
-   * <p>Returns <code>true</code> if the designated object is an instance of
-   * this class and has the same RSA parameter values as this one.</p>
+   * Returns <code>true</code> if the designated object is an instance of this
+   * class and has the same RSA parameter values as this one.
    *
    * @param obj the other non-null RSA key to compare to.
    * @return <code>true</code> if the designated object is of the same type
@@ -276,9 +263,8 @@
   public boolean equals(final Object obj)
   {
     if (obj == null)
-      {
         return false;
-      }
+
     if (obj instanceof RSAPrivateKey)
       {
         final RSAPrivateKey that = (RSAPrivateKey) obj;
@@ -315,7 +301,8 @@
                                                         : "**...*").append(ls)
             .append("qInv=0x").append(Configuration.DEBUG ? qInv.toString(16)
                                                           : 
"**...*").append(ls)
-            .append(")").toString();
+            .append(")")
+            .toString();
       }
     return str;
   }

Index: rsa/RSAKeyPairX509Codec.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- rsa/RSAKeyPairX509Codec.java        11 Jun 2006 12:14:43 -0000      1.6
+++ rsa/RSAKeyPairX509Codec.java        20 Jun 2006 11:24:41 -0000      1.7
@@ -117,7 +117,6 @@
   {
     if (Configuration.DEBUG)
       log.entering(this.getClass().getName(), "encodePublicKey()", key);
-
     if (! (key instanceof GnuRSAPublicKey))
       throw new InvalidParameterException("key");
 
@@ -158,7 +157,7 @@
       }
     catch (IOException x)
       {
-        InvalidParameterException y = new InvalidParameterException();
+        InvalidParameterException y = new 
InvalidParameterException(x.getMessage());
         y.initCause(x);
         throw y;
       }
@@ -187,7 +186,6 @@
   {
     if (Configuration.DEBUG)
       log.entering(this.getClass().getName(), "decodePublicKey()", input);
-
     if (input == null)
       throw new InvalidParameterException("Input bytes MUST NOT be null");
 
@@ -232,11 +230,10 @@
       }
     catch (IOException x)
       {
-        InvalidParameterException y = new InvalidParameterException();
+        InvalidParameterException y = new 
InvalidParameterException(x.getMessage());
         y.initCause(x);
         throw y;
       }
-
     PublicKey result = new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e);
     if (Configuration.DEBUG)
       log.exiting(this.getClass().getName(), "decodePublicKey()", result);

Index: rsa/GnuRSAPublicKey.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/rsa/GnuRSAPublicKey.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- rsa/GnuRSAPublicKey.java    29 Apr 2006 06:53:06 -0000      1.4
+++ rsa/GnuRSAPublicKey.java    20 Jun 2006 11:24:41 -0000      1.5
@@ -47,28 +47,24 @@
 import java.security.interfaces.RSAPublicKey;
 
 /**
- * <p>An object that encapsulates an RSA public key.</p>
- *
- * <p>References:</p>
+ * An object that encapsulates an RSA public key.
+ * <p>
+ * References:
  * <ol>
- *    <li><a 
href="http://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/rsa-pss.zip";>
+ * <li><a
+ * 
href="http://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/rsa-pss.zip";>
  *    RSA-PSS Signature Scheme with Appendix, part B.</a><br>
  *    Primitive specification and supporting documentation.<br>
  *    Jakob Jonsson and Burt Kaliski.</li>
  * </ol>
  */
-public class GnuRSAPublicKey extends GnuRSAKey implements PublicKey,
-    RSAPublicKey
+public class GnuRSAPublicKey
+    extends GnuRSAKey
+    implements PublicKey, RSAPublicKey
 {
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
   /** String representation of this key. Cached for speed. */
   private transient String str;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   /**
    * Conveience constructor. Calls the constructor with 3 arguments passing
    * address@hidden Registry#RAW_ENCODING_ID} as the identifier of the 
preferred
@@ -98,9 +94,6 @@
           n, e);
   }
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
   /**
    * A class method that takes the output of the <code>encodePublicKey()</code>
    * method of an RSA keypair codec object (an instance implementing
@@ -125,17 +118,13 @@
       catch (IllegalArgumentException ignored)
         {
         }
-
     // try X.509 codec
     return (GnuRSAPublicKey) new RSAKeyPairX509Codec().decodePublicKey(k);
   }
 
-  // Instance methods
-  // -------------------------------------------------------------------------
-
   /**
-   * <p>Returns the encoded form of this public key according to the designated
-   * format.</p>
+   * Returns the encoded form of this public key according to the designated
+   * format.
    *
    * @param format the desired format identifier of the resulting encoding.
    * @return the byte sequence encoding this key according to the designated
@@ -162,23 +151,21 @@
   }
 
   /**
-   * <p>Returns <code>true</code> if the designated object is an instance of
-   * this class and has the same RSA parameter values as this one.</p>
+   * Returns <code>true</code> if the designated object is an instance of this
+   * class and has the same RSA parameter values as this one.
    *
    * @param obj the other non-null RSA key to compare to.
-   * @return <code>true</code> if the designated object is of the same type and
-   * value as this one.
+   * @return <code>true</code> if the designated object is of the same type
+   *         and value as this one.
    */
   public boolean equals(final Object obj)
   {
     if (obj == null)
-      {
         return false;
-      }
-    if (!(obj instanceof RSAPublicKey))
-      {
+
+    if (! (obj instanceof RSAPublicKey))
         return false;
-      }
+
     final RSAPublicKey that = (RSAPublicKey) obj;
     return super.equals(that)
            && getPublicExponent().equals(that.getPublicExponent());
@@ -191,7 +178,8 @@
         String ls = SystemProperties.getProperty("line.separator");
         str = new StringBuilder(this.getClass().getName()).append("(")
             .append(super.toString()).append(",").append(ls)
-            .append(")").toString();
+            .append(")")
+            .toString();
       }
     return str;
   }


Index: KeyPairCodecFactory.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/KeyPairCodecFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- KeyPairCodecFactory.java    19 Feb 2006 01:45:44 -0000      1.3
+++ KeyPairCodecFactory.java    20 Jun 2006 11:24:43 -0000      1.4
@@ -207,10 +207,8 @@
         hs.add(Registry.RSA_KPG + "/" + Registry.PKCS8_ENCODING_SHORT_NAME);
         hs.add(Registry.DH_KPG + "/" + Registry.RAW_ENCODING_SHORT_NAME);
         hs.add(Registry.SRP_KPG + "/" + Registry.RAW_ENCODING_SHORT_NAME);
-
         names = Collections.unmodifiableSet(hs);
       }
-
     return names;
   }
 

Index: KeyPairGeneratorFactory.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/KeyPairGeneratorFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- KeyPairGeneratorFactory.java        3 Apr 2006 11:54:14 -0000       1.3
+++ KeyPairGeneratorFactory.java        20 Jun 2006 11:24:43 -0000      1.4
@@ -48,67 +48,47 @@
 import java.util.Set;
 
 /**
- * <p>A Factory to instantiate asymmetric keypair generators.</p>
+ * A Factory to instantiate asymmetric keypair generators.
  */
 public class KeyPairGeneratorFactory
 {
-
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   /** Trivial constructor to enforce Singleton pattern. */
   private KeyPairGeneratorFactory()
   {
     super();
   }
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
   /**
-   * <p>Returns an instance of a keypair generator given its name.</p>
+   * Returns an instance of a keypair generator given its name.
    *
    * @param name the case-insensitive key generator name.
-   * @return an instance of the keypair generator, or <code>null</code> if none
-   * found.
+   * @return an instance of the keypair generator, or <code>null</code> if
+   *         none found.
    */
   public static IKeyPairGenerator getInstance(String name)
   {
     if (name == null)
-      {
         return null;
-      }
 
     name = name.trim();
     IKeyPairGenerator result = null;
     if (name.equalsIgnoreCase(Registry.DSA_KPG)
         || name.equalsIgnoreCase(Registry.DSS_KPG))
-      {
         result = new DSSKeyPairGenerator();
-      }
     else if (name.equalsIgnoreCase(Registry.RSA_KPG))
-      {
         result = new RSAKeyPairGenerator();
-      }
     else if (name.equalsIgnoreCase(Registry.DH_KPG))
-      {
-        result = makeInstance 
("gnu.javax.crypto.key.dh.GnuDHKeyPairGenerator");
-      }
+      result = makeInstance("gnu.javax.crypto.key.dh.GnuDHKeyPairGenerator");
     else if (name.equalsIgnoreCase(Registry.SRP_KPG))
-      {
-        result = makeInstance 
("gnu.javax.crypto.key.srp6.SRPKeyPairGenerator");
-      }
+      result = makeInstance("gnu.javax.crypto.key.srp6.SRPKeyPairGenerator");
 
     return result;
   }
 
   /**
-   * <p>Returns a address@hidden Set} of keypair generator names supported by 
this
+   * Returns a address@hidden Set} of keypair generator names supported by this
    * <i>Factory</i>. Those keypair generators may be used in conjunction with
-   * the digital signature schemes with appendix supported by this library.</p>
+   * the digital signature schemes with appendix supported by this library.
    *
    * @return a address@hidden Set} of keypair generator names (Strings).
    */
@@ -120,26 +100,21 @@
     hs.add(Registry.RSA_KPG);
     hs.add(Registry.DH_KPG);
     hs.add(Registry.SRP_KPG);
-
     return Collections.unmodifiableSet(hs);
   }
 
-  private static IKeyPairGenerator makeInstance (String clazz)
+  private static IKeyPairGenerator makeInstance(String clazz)
   {
     try
       {
-        Class c = Class.forName (clazz);
-        Constructor ctor = c.getConstructor (new Class[0]);
-        return (IKeyPairGenerator) ctor.newInstance (new Object[0]);
+        Class c = Class.forName(clazz);
+        Constructor ctor = c.getConstructor(new Class[0]);
+        return (IKeyPairGenerator) ctor.newInstance(new Object[0]);
       }
     catch (Exception x)
       {
         throw new IllegalArgumentException(
-            "strong crypto key pair generator not available: " + clazz,
-            x);
+            "strong crypto key pair generator not available: " + clazz, x);
       }
   }
-
-  // Instance methods
-  // -------------------------------------------------------------------------
 }

Index: IKeyPairGenerator.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/IKeyPairGenerator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- IKeyPairGenerator.java      26 Mar 2006 22:57:46 -0000      1.2
+++ IKeyPairGenerator.java      20 Jun 2006 11:24:43 -0000      1.3
@@ -42,26 +42,19 @@
 import java.util.Map;
 
 /**
- * The visible methods of every asymmetric keypair generator.<p>
+ * The visible methods of every asymmetric keypair generator.
  */
 public interface IKeyPairGenerator
 {
-
-  // Constants
-  // -------------------------------------------------------------------------
-
-  // Methods
-  // -------------------------------------------------------------------------
-
   /**
-   * Returns the canonical name of this keypair generator.<p>
+   * Returns the canonical name of this keypair generator.
    *
    * @return the canonical name of this instance.
    */
   String name();
 
   /**
-   * [Re]-initialises this instance for use with a given set of attributes.<p>
+   * [Re]-initialises this instance for use with a given set of attributes.
    *
    * @param attributes a map of name/value pairs to use for setting up the
    * instance.

Index: IKeyPairCodec.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/IKeyPairCodec.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- IKeyPairCodec.java  26 Mar 2006 22:57:46 -0000      1.3
+++ IKeyPairCodec.java  20 Jun 2006 11:24:43 -0000      1.4
@@ -44,16 +44,13 @@
 import java.security.PublicKey;
 
 /**
- * <p>The visible methods of an object that knows how to encode and decode
+ * The visible methods of an object that knows how to encode and decode
  * cryptographic asymmetric keypairs. Codecs are useful for (a) externalising
  * public and private keys for storage and on-the-wire transmission, as well as
- * (b) re-creating their internal Java representation from external 
sources.</p>
+ * (b) re-creating their internal Java representation from external sources.
  */
 public interface IKeyPairCodec
 {
-  // Constants
-  // -------------------------------------------------------------------------
-
   /** Constant identifying the <i>Raw</i> encoding format. */
   int RAW_FORMAT = Registry.RAW_ENCODING_ID;
 
@@ -69,19 +66,16 @@
    */
   int ASN1_FORMAT = Registry.ASN1_ENCODING_ID;
 
-  // Method(s)
-  // -------------------------------------------------------------------------
-
   /**
-   * <p>Returns the unique identifier (within this library) of the format used
-   * to externalise public and private keys.</p>
+   * Returns the unique identifier (within this library) of the format used to
+   * externalise public and private keys.
    *
    * @return the identifier of the format, the object supports.
    */
   int getFormatID();
 
   /**
-   * <p>Encodes an instance of a public key for storage or transmission 
purposes.</p>
+   * Encodes an instance of a public key for storage or transmission purposes.
    *
    * @param key the non-null key to encode.
    * @return a byte sequence representing the encoding of the designated key
@@ -92,7 +86,7 @@
   byte[] encodePublicKey(PublicKey key);
 
   /**
-   * <p>Encodes an instance of a private key for storage or transmission 
purposes.</p>
+   * Encodes an instance of a private key for storage or transmission purposes.
    *
    * @param key the non-null key to encode.
    * @return a byte sequence representing the encoding of the designated key
@@ -103,28 +97,28 @@
   byte[] encodePrivateKey(PrivateKey key);
 
   /**
-   * <p>Decodes an instance of an external public key into its native Java
-   * representation.</p>
+   * Decodes an instance of an external public key into its native Java
+   * representation.
    *
    * @param input the source of the externalised key to decode.
    * @return a concrete instance of a public key, reconstructed from the
    * designated input.
    * @exception IllegalArgumentException if the designated input does not
-   * contain a known representation of a public key for the format supported by
-   * the concrete codec.
+   *              contain a known representation of a public key for the format
+   *              supported by the concrete codec.
    */
   PublicKey decodePublicKey(byte[] input);
 
   /**
-   * <p>Decodes an instance of an external private key into its native Java
-   * representation.</p>
+   * Decodes an instance of an external private key into its native Java
+   * representation.
    *
    * @param input the source of the externalised key to decode.
    * @return a concrete instance of a private key, reconstructed from the
    * designated input.
    * @exception IllegalArgumentException if the designated input does not
-   * contain a known representation of a private key for the format supported
-   * by the concrete codec.
+   *              contain a known representation of a private key for the 
format
+   *              supported by the concrete codec.
    */
   PrivateKey decodePrivateKey(byte[] input);
 }

Index: dss/DSSKeyPairRawCodec.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/dss/DSSKeyPairRawCodec.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- dss/DSSKeyPairRawCodec.java 26 Mar 2006 22:57:46 -0000      1.2
+++ dss/DSSKeyPairRawCodec.java 20 Jun 2006 11:24:43 -0000      1.3
@@ -47,64 +47,50 @@
 import java.security.PublicKey;
 
 /**
- * <p>An object that implements the address@hidden IKeyPairCodec} operations 
for the
- * <i>Raw</i> format to use with DSS keypairs.</p>
+ * An object that implements the address@hidden IKeyPairCodec} operations for 
the
+ * <i>Raw</i> format to use with DSS keypairs.
  */
-public class DSSKeyPairRawCodec implements IKeyPairCodec
+public class DSSKeyPairRawCodec
+    implements IKeyPairCodec
 {
-
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   // implicit 0-arguments constructor
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
-  // Instance methods
-  // -------------------------------------------------------------------------
-
-  // gnu.crypto.keys.IKeyPairCodec interface implementation ------------------
-
   public int getFormatID()
   {
     return RAW_FORMAT;
   }
 
   /**
-   * <p>Returns the encoded form of the designated DSS (Digital Signature
-   * Standard) public key according to the <i>Raw</i> format supported by
-   * this library.</p>
-   *
-   * <p>The <i>Raw</i> format for a DSA public key, in this implementation, is
-   * a byte sequence consisting of the following:</p>
+   * Returns the encoded form of the designated DSS (Digital Signature 
Standard)
+   * public key according to the <i>Raw</i> format supported by this library.
+   * <p>
+   * The <i>Raw</i> format for a DSA public key, in this implementation, is a
+   * byte sequence consisting of the following:
    * <ol>
    *    <li>4-byte magic consisting of the value of the literal
-   *    address@hidden Registry#MAGIC_RAW_DSS_PUBLIC_KEY},<li>
+   * address@hidden Registry#MAGIC_RAW_DSS_PUBLIC_KEY},
+   * <li>
    *    <li>1-byte version consisting of the constant: 0x01,</li>
    *    <li>4-byte count of following bytes representing the DSA parameter
    *    <code>p</code> in internet order,</li>
    *    <li>n-bytes representation of a address@hidden BigInteger} obtained by 
invoking
-   *    the <code>toByteArray()</code> method on the DSA parameter
-   *    <code>p</code>,</li>
+   * the <code>toByteArray()</code> method on the DSA parameter <code>p</code>,
+   * </li>
    *    <li>4-byte count of following bytes representing the DSA parameter
    *    <code>q</code>,</li>
    *    <li>n-bytes representation of a address@hidden BigInteger} obtained by 
invoking
-   *    the <code>toByteArray()</code> method on the DSA parameter
-   *    <code>q</code>,</li>
+   * the <code>toByteArray()</code> method on the DSA parameter <code>q</code>,
+   * </li>
    *    <li>4-byte count of following bytes representing the DSA parameter
    *    <code>g</code>,</li>
    *    <li>n-bytes representation of a address@hidden BigInteger} obtained by 
invoking
-   *    the <code>toByteArray()</code> method on the DSA parameter
-   *    <code>g</code>,</li>
+   * the <code>toByteArray()</code> method on the DSA parameter <code>g</code>,
+   * </li>
    *    <li>4-byte count of following bytes representing the DSA parameter
    *    <code>y</code>,</li>
    *    <li>n-bytes representation of a address@hidden BigInteger} obtained by 
invoking
-   *    the <code>toByteArray()</code> method on the DSA parameter
-   *    <code>y</code>,</li>
+   * the <code>toByteArray()</code> method on the DSA parameter <code>y</code>,
+   * </li>
    * </ol>
    *
    * @param key the key to encode.
@@ -115,23 +101,18 @@
    */
   public byte[] encodePublicKey(PublicKey key)
   {
-    if (!(key instanceof DSSPublicKey))
-      {
+    if (! (key instanceof DSSPublicKey))
         throw new IllegalArgumentException("key");
-      }
 
     DSSPublicKey dssKey = (DSSPublicKey) key;
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
     // magic
     baos.write(Registry.MAGIC_RAW_DSS_PUBLIC_KEY[0]);
     baos.write(Registry.MAGIC_RAW_DSS_PUBLIC_KEY[1]);
     baos.write(Registry.MAGIC_RAW_DSS_PUBLIC_KEY[2]);
     baos.write(Registry.MAGIC_RAW_DSS_PUBLIC_KEY[3]);
-
     // version
     baos.write(0x01);
-
     // p
     byte[] buffer = dssKey.getParams().getP().toByteArray();
     int length = buffer.length;
@@ -140,7 +121,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // q
     buffer = dssKey.getParams().getQ().toByteArray();
     length = buffer.length;
@@ -149,7 +129,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // g
     buffer = dssKey.getParams().getG().toByteArray();
     length = buffer.length;
@@ -158,7 +137,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // y
     buffer = dssKey.getY().toByteArray();
     length = buffer.length;
@@ -167,7 +145,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     return baos.toByteArray();
   }
 
@@ -178,86 +155,85 @@
         || k[1] != Registry.MAGIC_RAW_DSS_PUBLIC_KEY[1]
         || k[2] != Registry.MAGIC_RAW_DSS_PUBLIC_KEY[2]
         || k[3] != Registry.MAGIC_RAW_DSS_PUBLIC_KEY[3])
-      {
         throw new IllegalArgumentException("magic");
-      }
 
     // version
     if (k[4] != 0x01)
-      {
         throw new IllegalArgumentException("version");
-      }
-    int i = 5;
 
+    int i = 5;
     int l;
     byte[] buffer;
-
     // p
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger p = new BigInteger(1, buffer);
-
     // q
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger q = new BigInteger(1, buffer);
-
     // g
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger g = new BigInteger(1, buffer);
-
     // y
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger y = new BigInteger(1, buffer);
-
     return new DSSPublicKey(p, q, g, y);
   }
 
   /**
-   * <p>Returns the encoded form of the designated DSS (Digital Signature
-   * Standard) private key according to the <i>Raw</i> format supported by
-   * this library.</p>
-   *
-   * <p>The <i>Raw</i> format for a DSA private key, in this implementation, is
-   * a byte sequence consisting of the following:</p>
+   * Returns the encoded form of the designated DSS (Digital Signature 
Standard)
+   * private key according to the <i>Raw</i> format supported by this library.
+   * <p>
+   * The <i>Raw</i> format for a DSA private key, in this implementation, is a
+   * byte sequence consisting of the following:
    * <ol>
    *    <li>4-byte magic consisting of the value of the literal
-   *    address@hidden Registry#MAGIC_RAW_DSS_PRIVATE_KEY},<li>
+   * address@hidden Registry#MAGIC_RAW_DSS_PRIVATE_KEY},
+   * <li>
    *    <li>1-byte version consisting of the constant: 0x01,</li>
    *    <li>4-byte count of following bytes representing the DSA parameter
    *    <code>p</code> in internet order,</li>
    *    <li>n-bytes representation of a address@hidden BigInteger} obtained by 
invoking
-   *    the <code>toByteArray()</code> method on the DSA parameter
-   *    <code>p</code>,</li>
+   * the <code>toByteArray()</code> method on the DSA parameter <code>p</code>,
+   * </li>
    *    <li>4-byte count of following bytes representing the DSA parameter
    *    <code>q</code>,</li>
    *    <li>n-bytes representation of a address@hidden BigInteger} obtained by 
invoking
-   *    the <code>toByteArray()</code> method on the DSA parameter
-   *    <code>q</code>,</li>
+   * the <code>toByteArray()</code> method on the DSA parameter <code>q</code>,
+   * </li>
    *    <li>4-byte count of following bytes representing the DSA parameter
    *    <code>g</code>,</li>
    *    <li>n-bytes representation of a address@hidden BigInteger} obtained by 
invoking
-   *    the <code>toByteArray()</code> method on the DSA parameter
-   *    <code>g</code>,</li>
+   * the <code>toByteArray()</code> method on the DSA parameter <code>g</code>,
+   * </li>
    *    <li>4-byte count of following bytes representing the DSA parameter
    *    <code>x</code>,</li>
    *    <li>n-bytes representation of a address@hidden BigInteger} obtained by 
invoking
-   *    the <code>toByteArray()</code> method on the DSA parameter
-   *    <code>x</code>,</li>
+   * the <code>toByteArray()</code> method on the DSA parameter <code>x</code>,
+   * </li>
    * </ol>
    *
    * @param key the key to encode.
@@ -267,23 +243,18 @@
    */
   public byte[] encodePrivateKey(PrivateKey key)
   {
-    if (!(key instanceof DSSPrivateKey))
-      {
+    if (! (key instanceof DSSPrivateKey))
         throw new IllegalArgumentException("key");
-      }
 
     DSSPrivateKey dssKey = (DSSPrivateKey) key;
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
     // magic
     baos.write(Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]);
     baos.write(Registry.MAGIC_RAW_DSS_PRIVATE_KEY[1]);
     baos.write(Registry.MAGIC_RAW_DSS_PRIVATE_KEY[2]);
     baos.write(Registry.MAGIC_RAW_DSS_PRIVATE_KEY[3]);
-
     // version
     baos.write(0x01);
-
     // p
     byte[] buffer = dssKey.getParams().getP().toByteArray();
     int length = buffer.length;
@@ -292,7 +263,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // q
     buffer = dssKey.getParams().getQ().toByteArray();
     length = buffer.length;
@@ -301,7 +271,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // g
     buffer = dssKey.getParams().getG().toByteArray();
     length = buffer.length;
@@ -310,7 +279,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     // x
     buffer = dssKey.getX().toByteArray();
     length = buffer.length;
@@ -319,7 +287,6 @@
     baos.write((length >>> 8) & 0xFF);
     baos.write(length & 0xFF);
     baos.write(buffer, 0, length);
-
     return baos.toByteArray();
   }
 
@@ -330,52 +297,51 @@
         || k[1] != Registry.MAGIC_RAW_DSS_PRIVATE_KEY[1]
         || k[2] != Registry.MAGIC_RAW_DSS_PRIVATE_KEY[2]
         || k[3] != Registry.MAGIC_RAW_DSS_PRIVATE_KEY[3])
-      {
         throw new IllegalArgumentException("magic");
-      }
 
     // version
     if (k[4] != 0x01)
-      {
         throw new IllegalArgumentException("version");
-      }
-    int i = 5;
 
+    int i = 5;
     int l;
     byte[] buffer;
-
     // p
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger p = new BigInteger(1, buffer);
-
     // q
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger q = new BigInteger(1, buffer);
-
     // g
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger g = new BigInteger(1, buffer);
-
     // x
-    l = k[i++] << 24 | (k[i++] & 0xFF) << 16 | (k[i++] & 0xFF) << 8
+    l =  k[i++]         << 24
+      | (k[i++] & 0xFF) << 16
+      | (k[i++] & 0xFF) << 8
         | (k[i++] & 0xFF);
     buffer = new byte[l];
     System.arraycopy(k, i, buffer, 0, l);
     i += l;
     BigInteger x = new BigInteger(1, buffer);
-
     return new DSSPrivateKey(p, q, g, x);
   }
 }

Index: dss/DSSPublicKey.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/dss/DSSPublicKey.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- dss/DSSPublicKey.java       26 Mar 2006 22:57:46 -0000      1.4
+++ dss/DSSPublicKey.java       20 Jun 2006 11:24:43 -0000      1.5
@@ -47,27 +47,23 @@
 import java.security.interfaces.DSAPublicKey;
 
 /**
- * <p>An object that embodies a DSS (Digital Signature Standard) public 
key.</p>
+ * An object that embodies a DSS (Digital Signature Standard) public key.
  * 
  * @see #getEncoded
  */
-public class DSSPublicKey extends DSSKey implements PublicKey, DSAPublicKey
+public class DSSPublicKey
+    extends DSSKey
+    implements PublicKey, DSAPublicKey
 {
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
   /**
-   * <code>y = g<sup>x</sup> mod p</code> where <code>x</code> is the private
-   * part of the DSA key.
+   * <code>y = g<sup>x</sup> mod p</code> where <code>x</code> is the
+   * private part of the DSA key.
    */
   private final BigInteger y;
 
   /** String representation of this key. Cached for speed. */
   private transient String str;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   /**
    * Conveience constructor. Calls the constructor with 5 arguments passing
    * address@hidden Registry#RAW_ENCODING_ID} as the identifier of the 
preferred
@@ -85,8 +81,8 @@
   }
 
   /**
-   * Constructs a new instance of <code>DSSPublicKey</code> given the 
designated
-   * arguments.
+   * Constructs a new instance of <code>DSSPublicKey</code> given the
+   * designated arguments.
    * 
    * @param preferredFormat the identifier of the preferred encoding format to
    *          use when externalizing this key.
@@ -102,13 +98,9 @@
     super(preferredFormat == Registry.ASN1_ENCODING_ID ? 
Registry.X509_ENCODING_ID
                                                        : preferredFormat,
           p, q, g);
-
     this.y = y;
   }
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
   /**
    * A class method that takes the output of the <code>encodePublicKey()</code>
    * method of a DSS keypair codec object (an instance implementing
@@ -133,26 +125,18 @@
       catch (IllegalArgumentException ignored)
         {
         }
-
     // try X.509 codec
     return (DSSPublicKey) new DSSKeyPairX509Codec().decodePublicKey(k);
   }
 
-  // Instance methods
-  // -------------------------------------------------------------------------
-
-  // java.security.interfaces.DSAPublicKey interface implementation ----------
-
   public BigInteger getY()
   {
     return y;
   }
 
-  // Other instance methods --------------------------------------------------
-
   /**
-   * <p>Returns the encoded form of this public key according to the designated
-   * format.</p>
+   * Returns the encoded form of this public key according to the designated
+   * format.
    * 
    * @param format the desired format identifier of the resulting encoding.
    * @return the byte sequence encoding this key according to the designated
@@ -179,24 +163,22 @@
   }
 
   /**
-   * <p>Returns <code>true</code> if the designated object is an instance of
+   * Returns <code>true</code> if the designated object is an instance of
    * address@hidden DSAPublicKey} and has the same DSS (Digital Signature 
Standard)
-   * parameter values as this one.</p>
+   * parameter values as this one.
    * 
    * @param obj the other non-null DSS key to compare to.
-   * @return <code>true</code> if the designated object is of the same type and
-   * value as this one.
+   * @return <code>true</code> if the designated object is of the same type
+   *         and value as this one.
    */
   public boolean equals(Object obj)
   {
     if (obj == null)
-      {
         return false;
-      }
-    if (!(obj instanceof DSAPublicKey))
-      {
+
+    if (! (obj instanceof DSAPublicKey))
         return false;
-      }
+
     DSAPublicKey that = (DSAPublicKey) obj;
     return super.equals(that) && y.equals(that.getY());
   }
@@ -209,9 +191,9 @@
         str = new StringBuilder(this.getClass().getName()).append("(")
         .append(super.toString()).append(",").append(ls)
         .append("y=0x").append(y.toString(16)).append(ls)
-        .append(")").toString();
+            .append(")")
+            .toString();
       }
-
     return str;
   }
 }

Index: dss/DSSKey.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/security/key/dss/DSSKey.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- dss/DSSKey.java     29 Apr 2006 06:53:06 -0000      1.7
+++ dss/DSSKey.java     20 Jun 2006 11:24:43 -0000      1.8
@@ -49,58 +49,56 @@
 import java.security.spec.DSAParameterSpec;
 
 /**
- * <p>A base asbtract class for both public and private DSS (Digital Signature
+ * A base asbtract class for both public and private DSS (Digital Signature
  * Standard) keys. It encapsulates the three DSS numbers: <code>p</code>,
- * <code>q</code> and <code>g</code>.</p>
- *
- * <p>According to the JDK, cryptographic <i>Keys</i> all have a <i>format</i>.
+ * <code>q</code> and <code>g</code>.
+ * <p>
+ * According to the JDK, cryptographic <i>Keys</i> all have a <i>format</i>.
  * The format used in this implementation is called <i>Raw</i>, and basically
  * consists of the raw byte sequences of algorithm parameters. The exact order
- * of the byte sequences and the implementation details are given in each of
- * the relevant <code>getEncoded()</code> methods of each of the private and
- * public keys.</p>
+ * of the byte sequences and the implementation details are given in each of 
the
+ * relevant <code>getEncoded()</code> methods of each of the private and
+ * public keys.
  *
  * @see DSSPrivateKey#getEncoded
  * @see DSSPublicKey#getEncoded
  */
-public abstract class DSSKey implements Key, DSAKey
+public abstract class DSSKey
+    implements Key, DSAKey
 {
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
   /**
-   * A prime modulus, where <code>2<sup>L-1</sup> &lt; p &lt; 
2<sup>L</sup></code>
-   * for <code>512 &lt;= L &lt;= 1024</code> and <code>L</code> a multiple of
+   * A prime modulus, where
+   * <code>2<sup>L-1</sup> &lt; p &lt; 2<sup>L</sup></code> for
+   * <code>512 &lt;= L &lt;= 1024</code> and <code>L</code> a multiple of
    * <code>64</code>.
    */
   protected final BigInteger p;
 
   /**
-   * A prime divisor of <code>p - 1</code>, where <code>2<sup>159</sup> &lt; q
+   * A prime divisor of <code>p - 1</code>, where
+   * <code>2<sup>159</sup> &lt; q
    * &lt; 2<sup>160</sup></code>.
    */
   protected final BigInteger q;
 
   /**
-   * <code>g = h<sup>(p-1)</sup>/q mod p</code>, where <code>h</code> is any
-   * integer with <code>1 &lt; h &lt; p - 1</code> such that <code>h<sup>
-   * (p-1)</sup>/q mod p > 1</code> (<code>g</code> has order <code>q mod p
+   * <code>g = h<sup>(p-1)</sup>/q mod p</code>, where <code>h</code> is
+   * any integer with <code>1 &lt; h &lt; p - 1</code> such that <code>h<sup>
+   * (p-1)</sup>/q mod p > 1</code> (<code>g</code>
+   * has order <code>q mod p
    * </code>).
    */
   protected final BigInteger g;
 
   /**
-   * Identifier of the default encoding format to use when externalizing the
-   * key material.
+   * Identifier of the default encoding format to use when externalizing the 
key
+   * material.
    */
   protected final int defaultFormat;
 
   /** String representation of this key. Cached for speed. */
   private transient String str;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   /**
    * Trivial protected constructor.
    * 
@@ -121,21 +119,11 @@
     this.g = g;
   }
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
-  // Instance methods
-  // -------------------------------------------------------------------------
-
-  // java.security.interfaces.DSAKey interface implementation ----------------
-
   public DSAParams getParams()
   {
     return new DSAParameterSpec(p, q, g);
   }
 
-  // java.security.Key interface implementation ------------------------------
-
   public String getAlgorithm()
   {
     return Registry.DSS_KPG;
@@ -152,27 +140,23 @@
     return FormatUtil.getEncodingShortName(defaultFormat);
   }
 
-  // Other instance methods --------------------------------------------------
-
   /**
-   * <p>Returns <code>true</code> if the designated object is an instance of
+   * Returns <code>true</code> if the designated object is an instance of
    * address@hidden DSAKey} and has the same DSS (Digital Signature Standard) 
parameter
-   * values as this one.</p>
+   * values as this one.
    *
    * @param obj the other non-null DSS key to compare to.
-   * @return <code>true</code> if the designated object is of the same type and
-   * value as this one.
+   * @return <code>true</code> if the designated object is of the same type
+   *         and value as this one.
    */
   public boolean equals(Object obj)
   {
     if (obj == null)
-      {
         return false;
-      }
-    if (!(obj instanceof DSAKey))
-      {
+
+    if (! (obj instanceof DSAKey))
         return false;
-      }
+
     DSAKey that = (DSAKey) obj;
     return p.equals(that.getParams().getP())
            && q.equals(that.getParams().getQ())
@@ -184,18 +168,15 @@
     if (str == null)
       {
         String ls = SystemProperties.getProperty("line.separator");
-        str = new StringBuilder().append(ls)
+        str = new StringBuilder(ls)
         .append("defaultFormat=").append(defaultFormat).append(",").append(ls)
         .append("p=0x").append(p.toString(16)).append(",").append(ls)
         .append("q=0x").append(q.toString(16)).append(",").append(ls)
         .append("g=0x").append(g.toString(16))
         .toString();
       }
-
     return str;
   }
 
-  // abstract methods to be implemented by subclasses ------------------------
-
   public abstract byte[] getEncoded(int format);
 }

Index: dss/DSSKeyPairGenerator.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/dss/DSSKeyPairGenerator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- dss/DSSKeyPairGenerator.java        11 Jun 2006 12:14:44 -0000      1.5
+++ dss/DSSKeyPairGenerator.java        20 Jun 2006 11:24:43 -0000      1.6
@@ -54,55 +54,54 @@
 import java.util.logging.Logger;
 
 /**
- * <p>A key-pair generator for asymetric keys to use in conjunction with the 
DSS
- * (Digital Signature Standard).</p>
- *
- * References:<br>
+ * A key-pair generator for asymetric keys to use in conjunction with the DSS
+ * (Digital Signature Standard).
+ * <p>
+ * References:
+ * <p>
  * <a href="http://www.itl.nist.gov/fipspubs/fip186.htm";>Digital Signature
- * Standard (DSS)</a>, Federal Information Processing Standards Publication 
186.
- * National Institute of Standards and Technology.
+ * Standard (DSS)</a>, Federal Information Processing Standards Publication
+ * 186. National Institute of Standards and Technology.
  */
-public class DSSKeyPairGenerator implements IKeyPairGenerator
+public class DSSKeyPairGenerator
+    implements IKeyPairGenerator
 {
   private static final Logger log = 
Logger.getLogger(DSSKeyPairGenerator.class.getName());
+
   /** The BigInteger constant 2. */
-  private static final BigInteger TWO = new BigInteger("2");
+  private static final BigInteger TWO = BigInteger.valueOf(2L);
 
   /** Property name of the length (Integer) of the modulus (p) of a DSS key. */
   public static final String MODULUS_LENGTH = "gnu.crypto.dss.L";
 
   /**
    * Property name of the Boolean indicating wether or not to use default pre-
-   * computed values of <code>p</code>, <code>q</code> and <code>g</code> for
-   * a given modulus length. The ultimate behaviour of this generator with
+   * computed values of <code>p</code>, <code>q</code> and <code>g</code>
+   * for a given modulus length. The ultimate behaviour of this generator with
    * regard to using pre-computed parameter sets will depend on the value of
    * this property and of the following one address@hidden #STRICT_DEFAULTS}:
-   * 
    * <ol>
-   *   <li>If this property is address@hidden Boolean#FALSE} then this 
generator
-   *   will accept being setup for generating parameters for any modulus length
+   * <li>If this property is address@hidden Boolean#FALSE} then this generator 
will
+   * accept being setup for generating parameters for any modulus length
    *   provided the modulus length is between <code>512</code> and
    *   <code>1024</code>, and is of the form <code>512 + 64 * n</code>. In
    *   addition, a new paramter set will always be generated; i.e. no pre-
    *   computed values are used.</li>
-   *   
    *   <li>If this property is address@hidden Boolean#TRUE} and the value of
    *   address@hidden #STRICT_DEFAULTS} is also address@hidden Boolean#TRUE} 
then this generator
-   *   will only accept being setup for generating parameters for modulus
-   *   lengths of <code>512</code>, <code>768</code> and <code>1024</code>. Any
+   * will only accept being setup for generating parameters for modulus lengths
+   * of <code>512</code>, <code>768</code> and <code>1024</code>. Any
    *   other value, of the modulus length, even if between <code>512</code> and
-   *   <code>1024</code>, and of the form <code>512 + 64 * n</code>, will cause
-   *   an address@hidden IllegalArgumentException} to be thrown. When those 
modulus
-   *   length (<code>512</code>, <code>768</code>, and <code>1024</code>) are
-   *   specified, the paramter set is always the same.</li>
-   *   
+   * <code>1024</code>, and of the form <code>512 + 64 * n</code>, will
+   * cause an address@hidden IllegalArgumentException} to be thrown. When 
those modulus
+   * length (<code>512</code>, <code>768</code>, and <code>1024</code>)
+   * are specified, the paramter set is always the same.</li>
    *   <li>Finally, if this property is address@hidden Boolean#TRUE} and the 
value of
-   *   address@hidden #STRICT_DEFAULTS} is address@hidden Boolean#FALSE} then 
this generator
-   *   will behave as in point 1 above, except that it will use pre-computed
-   *   values when possible; i.e. the modulus length is one of 
<code>512</code>,
+   * address@hidden #STRICT_DEFAULTS} is address@hidden Boolean#FALSE} then 
this generator will
+   * behave as in point 1 above, except that it will use pre-computed values
+   * when possible; i.e. the modulus length is one of <code>512</code>,
    *   <code>768</code>, or <code>1024</code>.</li>
    * </ol>
-   * 
    * The default value of this property is address@hidden Boolean#TRUE}.
    */
   public static final String USE_DEFAULTS = "gnu.crypto.dss.use.defaults";
@@ -127,8 +126,8 @@
 
   /**
    * Property name of an optional address@hidden DSAParameterSpec} instance to 
use for
-   * this generator's <code>p</code>, <code>q</code>, and <code>g</code> 
values.
-   * The default is to generate these values or use pre-computed ones,
+   * this generator's <code>p</code>, <code>q</code>, and <code>g</code>
+   * values. The default is to generate these values or use pre-computed ones,
    * depending on the value of the <code>USE_DEFAULTS</code> attribute.
    */
   public static final String DSS_PARAMETERS = "gnu.crypto.dss.params";
@@ -147,55 +146,41 @@
   private static final int DEFAULT_ENCODING_FORMAT = Registry.RAW_ENCODING_ID;
 
   /** Initial SHS context. */
-  private static final int[] T_SHS = new int[] { 0x67452301, 0xEFCDAB89,
-                                                0x98BADCFE, 0x10325476,
-                                                0xC3D2E1F0 };
+  private static final int[] T_SHS = new int[] {
+      0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0
+  };
 
   // from jdk1.3.1/docs/guide/security/CryptoSpec.html#AppB
   public static final DSAParameterSpec KEY_PARAMS_512 = new DSAParameterSpec(
                                                                              
new BigInteger(
                                                                                
             "fca682ce8e12caba26efccf7110e526db078b05edecbcd1eb4a208f3ae1617ae"
-                                                                               
                 + 
"01f35b91a47e6df63413c5e12ed0899bcd132acd50d99151bdc43ee737592e17",
-                                                                               
             16),
-                                                                             
new BigInteger(
-                                                                               
             "962eddcc369cba8ebb260ee6b6a126d9346e38c5",
-                                                                               
             16),
+        + "01f35b91a47e6df63413c5e12ed0899bcd132acd50d99151bdc43ee737592e17", 
16),
+      new BigInteger("962eddcc369cba8ebb260ee6b6a126d9346e38c5", 16),
                                                                              
new BigInteger(
                                                                                
             "678471b27a9cf44ee91a49c5147db1a9aaf244f05a434d6486931d2d14271b9e"
-                                                                               
                 + 
"35030b71fd73da179069b32e2935630e1c2062354d0da20a6c416e50be794ca4",
-                                                                               
             16));
-
+        + "35030b71fd73da179069b32e2935630e1c2062354d0da20a6c416e50be794ca4", 
16));
   public static final DSAParameterSpec KEY_PARAMS_768 = new DSAParameterSpec(
                                                                              
new BigInteger(
                                                                                
             "e9e642599d355f37c97ffd3567120b8e25c9cd43e927b3a9670fbec5d8901419"
                                                                                
                 + 
"22d2c3b3ad2480093799869d1e846aab49fab0ad26d2ce6a22219d470bce7d77"
-                                                                               
                 + 
"7d4a21fbe9c270b57f607002f3cef8393694cf45ee3688c11a8c56ab127a3daf",
-                                                                               
             16),
-                                                                             
new BigInteger(
-                                                                               
             "9cdbd84c9f1ac2f38d0f80f42ab952e7338bf511",
-                                                                               
             16),
+        + "7d4a21fbe9c270b57f607002f3cef8393694cf45ee3688c11a8c56ab127a3daf", 
16),
+      new BigInteger("9cdbd84c9f1ac2f38d0f80f42ab952e7338bf511", 16),
                                                                              
new BigInteger(
                                                                                
             "30470ad5a005fb14ce2d9dcd87e38bc7d1b1c5facbaecbe95f190aa7a31d23c4"
                                                                                
                 + 
"dbbcbe06174544401a5b2c020965d8c2bd2171d3668445771f74ba084d2029d8"
-                                                                               
                 + 
"3c1c158547f3a9f1a2715be23d51ae4d3e5a1f6a7064f316933a346d3f529252",
-                                                                               
             16));
-
+        + "3c1c158547f3a9f1a2715be23d51ae4d3e5a1f6a7064f316933a346d3f529252", 
16));
   public static final DSAParameterSpec KEY_PARAMS_1024 = new DSAParameterSpec(
                                                                               
new BigInteger(
                                                                                
              "fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400c31e3f80b6512669"
                                                                                
                  + 
"455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b7"
                                                                                
                  + 
"6b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb"
-                                                                               
                  + 
"83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7",
-                                                                               
              16),
-                                                                              
new BigInteger(
-                                                                               
              "9760508f15230bccb292b982a2eb840bf0581cf5",
-                                                                               
              16),
+        + "83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c7", 
16),
+      new BigInteger("9760508f15230bccb292b982a2eb840bf0581cf5", 16),
                                                                               
new BigInteger(
                                                                                
              "f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d078267"
                                                                                
                  + 
"5159578ebad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e1"
                                                                                
                  + 
"3c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243b"
-                                                                               
                  + 
"cca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a",
-                                                                               
              16));
+        + "cca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a", 
16));
 
   private static final BigInteger TWO_POW_160 = TWO.pow(160);
 
@@ -225,30 +210,17 @@
   /** Preferred encoding format of generated keys. */
   private int preferredFormat;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
-  // implicit 0-arguments constructor
-
-  // Class methods
-  // -------------------------------------------------------------------------
-
-  // Instance methods
-  // -------------------------------------------------------------------------
-
-  // gnu.crypto.key.IKeyPairGenerator interface implementation ---------------
-
   public String name()
   {
     return Registry.DSS_KPG;
   }
 
   /**
-   * <p>Configures this instance.</p>
+   * Configures this instance.
    *
    * @param attributes the map of name/value pairs to use.
-   * @exception IllegalArgumentException if the designated MODULUS_LENGTH
-   * value is not greater than 512, less than 1024 and not of the form
+   * @exception IllegalArgumentException if the designated MODULUS_LENGTH value
+   *              is not greater than 512, less than 1024 and not of the form
    * <code>512 + 64j</code>.
    */
   public void setup(Map attributes)
@@ -262,9 +234,7 @@
     // should we use the default pre-computed params?
     Boolean useDefaults = (Boolean) attributes.get(USE_DEFAULTS);
     if (useDefaults == null)
-      {
         useDefaults = Boolean.TRUE;
-      }
 
     Boolean strictDefaults = (Boolean) attributes.get(STRICT_DEFAULTS);
     if (strictDefaults == null)
@@ -316,16 +286,12 @@
         q = null;
         g = null;
       }
-
     // do we have a SecureRandom, or should we use our own?
     rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);
-
     // what is the preferred encoding format
     Integer formatID = (Integer) attributes.get(PREFERRED_ENCODING_FORMAT);
-    preferredFormat = formatID == null
-        ? DEFAULT_ENCODING_FORMAT
+    preferredFormat = formatID == null ? DEFAULT_ENCODING_FORMAT
         : formatID.intValue();
-
     // set the seed-key
     byte[] kb = new byte[20]; // we need 160 bits of randomness
     nextRandomBytes(kb);
@@ -353,66 +319,55 @@
             log.fine("g: " + g.toString(16));
           }
       }
-
     BigInteger x = nextX();
     BigInteger y = g.modPow(x, p);
-
     PublicKey pubK = new DSSPublicKey(preferredFormat, p, q, g, y);
     PrivateKey secK = new DSSPrivateKey(preferredFormat, p, q, g, x);
-
     return new KeyPair(pubK, secK);
   }
 
-  // Other instance methods --------------------------------------------------
-
   /**
-   * <p>This method applies the following algorithm described in 3.1 of
-   * FIPS-186:</p>
-   *
+   * This method applies the following algorithm described in 3.1 of FIPS-186:
    * <ol>
    *    <li>XSEED = optional user input.</li>
    *    <li>XVAL = (XKEY + XSEED) mod 2<sup>b</sup>.</li>
    *    <li>x = G(t, XVAL) mod q.</li>
    *    <li>XKEY = (1 + XKEY + x) mod 2<sup>b</sup>.</li>
    * </ol>
-   *
-   * <p>Where <code>b</code> is the length of a secret b-bit seed-key 
(XKEY).</p>
-   *
-   * <p>Note that in this implementation, XSEED, the optional user input, is
-   * always zero.</p>
+   * <p>
+   * Where <code>b</code> is the length of a secret b-bit seed-key (XKEY).
+   * <p>
+   * Note that in this implementation, XSEED, the optional user input, is 
always
+   * zero.
    */
   private synchronized BigInteger nextX()
   {
     byte[] xk = XKEY.toByteArray();
     byte[] in = new byte[64]; // 512-bit block for SHS
     System.arraycopy(xk, 0, in, 0, xk.length);
-
     int[] H = Sha160.G(T_SHS[0], T_SHS[1], T_SHS[2], T_SHS[3], T_SHS[4], in, 
0);
     byte[] h = new byte[20];
     for (int i = 0, j = 0; i < 5; i++)
       {
-        h[j++] = (byte) (H[i] >>> 24);
-        h[j++] = (byte) (H[i] >>> 16);
-        h[j++] = (byte) (H[i] >>> 8);
+        h[j++] = (byte)(H[i] >>> 24);
+        h[j++] = (byte)(H[i] >>> 16);
+        h[j++] = (byte)(H[i] >>> 8);
         h[j++] = (byte) H[i];
       }
     BigInteger result = new BigInteger(1, h).mod(q);
     XKEY = XKEY.add(result).add(BigInteger.ONE).mod(TWO_POW_160);
-
     return result;
   }
 
   /**
-   * <p>Fills the designated byte array with random data.</p>
+   * Fills the designated byte array with random data.
    *
    * @param buffer the byte array to fill with random data.
    */
   private void nextRandomBytes(byte[] buffer)
   {
     if (rnd != null)
-      {
         rnd.nextBytes(buffer);
-      }
     else
       getDefaultPRNG().nextBytes(buffer);
   }

Index: dss/DSSPrivateKey.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/dss/DSSPrivateKey.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- dss/DSSPrivateKey.java      11 Jun 2006 12:14:44 -0000      1.5
+++ dss/DSSPrivateKey.java      20 Jun 2006 11:24:43 -0000      1.6
@@ -48,24 +48,23 @@
 import java.security.interfaces.DSAPrivateKey;
 
 /**
- * <p>An object that embodies a DSS (Digital Signature Standard) private 
key.</p>
+ * An object that embodies a DSS (Digital Signature Standard) private key.
  *
  * @see #getEncoded
  */
-public class DSSPrivateKey extends DSSKey implements PrivateKey, DSAPrivateKey
+public class DSSPrivateKey
+    extends DSSKey
+    implements PrivateKey, DSAPrivateKey
 {
   /**
-   * <p>A randomly or pseudorandomly generated integer with <code>0 &lt; x &lt;
-   * q</code>.</p>
+   * A randomly or pseudorandomly generated integer with <code>0 &lt; x &lt;
+   * q</code>.
    */
   private final BigInteger x;
 
   /** String representation of this key. Cached for speed. */
   private transient String str;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   /**
    * Convenience constructor. Calls the constructor with 5 arguments passing
    * address@hidden Registry#RAW_ENCODING_ID} as the identifier of the 
preferred
@@ -100,13 +99,9 @@
     super(preferredFormat == Registry.ASN1_ENCODING_ID ? 
Registry.PKCS8_ENCODING_ID
                                                        : preferredFormat,
           p, q, g);
-
     this.x = x;
   }
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
   /**
    * A class method that takes the output of the 
<code>encodePrivateKey()</code>
    * method of a DSS keypair codec object (an instance implementing
@@ -131,26 +126,18 @@
       catch (IllegalArgumentException ignored)
         {
         }
-
     // try PKCS#8 codec
     return (DSSPrivateKey) new DSSKeyPairPKCS8Codec().decodePrivateKey(k);
   }
 
-  // Instance methods
-  // -------------------------------------------------------------------------
-
-  // java.security.interfaces.DSAPrivateKey interface implementation ---------
-
   public BigInteger getX()
   {
     return x;
   }
 
-  // Other instance methods --------------------------------------------------
-
   /**
-   * <p>Returns the encoded form of this private key according to the
-   * designated format.</p>
+   * Returns the encoded form of this private key according to the designated
+   * format.
    *
    * @param format the desired format identifier of the resulting encoding.
    * @return the byte sequence encoding this key according to the designated
@@ -177,24 +164,22 @@
   }
 
   /**
-   * <p>Returns <code>true</code> if the designated object is an instance of
+   * Returns <code>true</code> if the designated object is an instance of
    * address@hidden DSAPrivateKey} and has the same DSS (Digital Signature 
Standard)
-   * parameter values as this one.</p>
+   * parameter values as this one.
    *
    * @param obj the other non-null DSS key to compare to.
-   * @return <code>true</code> if the designated object is of the same type and
-   * value as this one.
+   * @return <code>true</code> if the designated object is of the same type
+   *         and value as this one.
    */
   public boolean equals(Object obj)
   {
     if (obj == null)
-      {
         return false;
-      }
-    if (!(obj instanceof DSAPrivateKey))
-      {
+
+    if (! (obj instanceof DSAPrivateKey))
         return false;
-      }
+
     DSAPrivateKey that = (DSAPrivateKey) obj;
     return super.equals(that) && x.equals(that.getX());
   }
@@ -208,9 +193,9 @@
         .append(super.toString()).append(",").append(ls)
         .append("x=0x").append(Configuration.DEBUG ? x.toString(16)
                                                    : "**...*").append(ls)
-        .append(")").toString();
+            .append(")")
+            .toString();
       }
-
     return str;
   }
 }

Index: dss/DSSKeyPairX509Codec.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/dss/DSSKeyPairX509Codec.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- dss/DSSKeyPairX509Codec.java        23 Feb 2006 12:54:46 -0000      1.3
+++ dss/DSSKeyPairX509Codec.java        20 Jun 2006 11:24:43 -0000      1.4
@@ -157,11 +157,10 @@
       }
     catch (IOException x)
       {
-        InvalidParameterException e = new InvalidParameterException();
+        InvalidParameterException e = new 
InvalidParameterException(x.getMessage());
         e.initCause(x);
         throw e;
       }
-
     return result;
   }
 
@@ -230,11 +229,10 @@
       }
     catch (IOException x)
       {
-        InvalidParameterException e = new InvalidParameterException();
+        InvalidParameterException e = new 
InvalidParameterException(x.getMessage());
         e.initCause(x);
         throw e;
       }
-
     return new DSSPublicKey(Registry.X509_ENCODING_ID, p, q, g, y);
   }
 

Index: dss/DSSKeyPairPKCS8Codec.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- dss/DSSKeyPairPKCS8Codec.java       11 Jun 2006 12:14:44 -0000      1.6
+++ dss/DSSKeyPairPKCS8Codec.java       20 Jun 2006 11:24:43 -0000      1.7
@@ -159,11 +159,10 @@
       }
     catch (IOException e)
       {
-        InvalidParameterException y = new InvalidParameterException();
+        InvalidParameterException y = new 
InvalidParameterException(e.getMessage());
         y.initCause(e);
         throw y;
       }
-
     return result;
   }
 
@@ -187,7 +186,6 @@
   {
     if (Configuration.DEBUG)
       log.entering(this.getClass().getName(), "decodePrivateKey");
-
     if (input == null)
       throw new InvalidParameterException("Input bytes MUST NOT be null");
 
@@ -240,7 +238,7 @@
       }
     catch (IOException e)
       {
-        InvalidParameterException y = new InvalidParameterException();
+        InvalidParameterException y = new 
InvalidParameterException(e.getMessage());
         y.initCause(e);
         throw y;
       }

Index: dss/FIPS186.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/security/key/dss/FIPS186.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- dss/FIPS186.java    18 Jun 2006 02:43:56 -0000      1.4
+++ dss/FIPS186.java    20 Jun 2006 11:24:43 -0000      1.5
@@ -45,20 +45,16 @@
 import java.security.SecureRandom;
 
 /**
- * <p>An implementation of the DSA parameters generation as described in
- * FIPS-186.</p>
- *
- * References:<br>
+ * An implementation of the DSA parameters generation as described in FIPS-186.
+ * <p>
+ * References:
+ * <p>
  * <a href="http://www.itl.nist.gov/fipspubs/fip186.htm";>Digital Signature
- * Standard (DSS)</a>, Federal Information Processing Standards Publication 
186.
- * National Institute of Standards and Technology.
+ * Standard (DSS)</a>, Federal Information Processing Standards Publication
+ * 186. National Institute of Standards and Technology.
  */
 public class FIPS186
 {
-
-  // Constants and variables
-  // -------------------------------------------------------------------------
-
   public static final int DSA_PARAMS_SEED = 0;
 
   public static final int DSA_PARAMS_COUNTER = 1;
@@ -72,7 +68,7 @@
   public static final int DSA_PARAMS_G = 5;
 
   /** The BigInteger constant 2. */
-  private static final BigInteger TWO = new BigInteger("2");
+  private static final BigInteger TWO = BigInteger.valueOf(2L);
 
   private static final BigInteger TWO_POW_160 = TWO.pow(160);
 
@@ -88,9 +84,6 @@
   /** Our default source of randomness. */
   private PRNG prng = null;
 
-  // Constructor(s)
-  // -------------------------------------------------------------------------
-
   public FIPS186(int L, SecureRandom rnd)
   {
     super();
@@ -99,24 +92,18 @@
     this.rnd = rnd;
   }
 
-  // Class methods
-  // -------------------------------------------------------------------------
-
-  // Instance methods
-  // -------------------------------------------------------------------------
-
   /**
    * This method generates the DSS <code>p</code>, <code>q</code>, and
    * <code>g</code> parameters only when <code>L</code> (the modulus length)
    * is not one of the following: <code>512</code>, <code>768</code> and
-   * <code>1024</code>. For those values of <code>L</code>, this implementation
-   * uses pre-computed values of <code>p</code>, <code>q</code>, and
-   * <code>g</code> given in the document <i>CryptoSpec</i> included in the
-   * security guide documentation of the standard JDK distribution.<p>
-   *
+   * <code>1024</code>. For those values of <code>L</code>, this
+   * implementation uses pre-computed values of <code>p</code>,
+   * <code>q</code>, and <code>g</code> given in the document <i>CryptoSpec</i>
+   * included in the security guide documentation of the standard JDK
+   * distribution.
+   * <p>
    * The DSS requires two primes , <code>p</code> and <code>q</code>,
    * satisfying the following three conditions:
-   *
    * <ul>
    *    <li><code>2<sup>159</sup> &lt; q &lt; 2<sup>160</sup></code></li>
    *    <li><code>2<sup>L-1</sup> &lt; p &lt; 2<sup>L</sup></code> for a
@@ -124,13 +111,12 @@
    *    <code>0 &lt;= j &lt;= 8</code></li>
    *    <li>q divides p - 1.</li>
    * </ul>
-   *
    * The algorithm used to find these primes is as described in FIPS-186,
    * section 2.2: GENERATION OF PRIMES. This prime generation scheme starts by
-   * using the address@hidden Sha160} and a user supplied <i>SEED</i>
-   * to construct a prime, <code>q</code>, in the range 2<sup>159</sup> &lt; q
-   * &lt; 2<sup>160</sup>. Once this is accomplished, the same <i>SEED</i>
-   * value is used to construct an <code>X</code> in the range <code>2<sup>L-1
+   * using the address@hidden Sha160} and a user supplied <i>SEED</i> to 
construct a
+   * prime, <code>q</code>, in the range 2<sup>159</sup> &lt; q &lt; 
2<sup>160</sup>.
+   * Once this is accomplished, the same <i>SEED</i> value is used to construct
+   * an <code>X</code> in the range <code>2<sup>L-1
    * </sup> &lt; X &lt; 2<sup>L</sup>. The prime, <code>p</code>, is then
    * formed by rounding <code>X</code> to a number congruent to <code>1 mod
    * 2q</code>. In this implementation we use the same <i>SEED</i> value given
@@ -168,9 +154,8 @@
                 u = sha.digest();
               }
             for (int i = 0; i < a.length; i++)
-              {
                 a[i] ^= u[i];
-              }
+
             U = new BigInteger(1, a);
             // 3. Form q from U by setting the most significant bit (the
             // 2**159 bit) and the least significant bit to 1. In terms of
@@ -183,11 +168,8 @@
             // most 1/2**80.
             // 5. If q is not prime, go to step 1.
             if (q.isProbablePrime(80))
-              {
                 break step1;
-              }
           } // step1
-
         // 6. Let counter = 0 and offset = 2.
         counter = 0;
         offset = 2;
@@ -200,9 +182,9 @@
               {
                 for (int k = 0; k <= n; k++)
                   {
-                    a = SEED_PLUS_OFFSET.add(
-                                             BigInteger.valueOf(k & 
0xFFFFFFFFL)).mod(
-                                                                               
       TWO_POW_160).toByteArray();
+                    a = SEED_PLUS_OFFSET
+                        .add(BigInteger.valueOf(k & 0xFFFFFFFFL))
+                        .mod(TWO_POW_160).toByteArray();
                     sha.update(a, 0, a.length);
                     V[k] = new BigInteger(1, sha.digest());
                   }
@@ -213,9 +195,8 @@
             // Note that 0 <= W < 2**(L-1) and hence 2**(L-1) <= X < 2**L.
             W = V[0];
             for (int k = 1; k < n; k++)
-              {
                 W = W.add(V[k].multiply(TWO.pow(k * 160)));
-              }
+
             W = W.add(V[n].mod(TWO.pow(b)).multiply(TWO.pow(n * 160)));
             X = W.add(TWO.pow(L - 1));
             // 9. Let c = X mod 2q and set p = X - (c - 1).
@@ -228,21 +209,16 @@
                 // 11. Perform a robust primality test on p.
                 // 12. If p passes the test performed in step 11, go to step 
15.
                 if (p.isProbablePrime(80))
-                  {
                     break algorithm;
                   }
-              }
             // 13. Let counter = counter + 1 and offset = offset + n + 1.
             counter++;
             offset += n + 1;
             // 14. If counter >= 4096 go to step 1, otherwise go to step 7.
             if (counter >= 4096)
-              {
                 continue algorithm;
-              }
           } // step7
       } // algorithm
-
     // compute g. from FIPS-186, Appendix 4:
     // 1. Generate p and q as specified in Appendix 2.
     // 2. Let e = (p - 1) / q
@@ -257,17 +233,12 @@
         // 4. Set g = h**e mod p
         g = h.modPow(e, p);
         // 5. If g = 1, go to step 3
-        if (!g.equals(BigInteger.ONE))
-          {
+        if (! g.equals(BigInteger.ONE))
             break;
           }
-      }
-
     return new BigInteger[] { SEED, BigInteger.valueOf(counter), q, p, e, g };
   }
 
-  // helper methods ----------------------------------------------------------
-
   /**
    * Fills the designated byte array with random data.
    *
@@ -276,9 +247,7 @@
   private void nextRandomBytes(byte[] buffer)
   {
     if (rnd != null)
-      {
         rnd.nextBytes(buffer);
-      }
     else
       getDefaultPRNG().nextBytes(buffer);
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]