summaryrefslogtreecommitdiff
path: root/gnu/java/security/key/rsa/GnuRSAKey.java
diff options
context:
space:
mode:
authorRaif S. Naffah <raif@swiftdsl.com.au>2006-06-20 11:24:41 +0000
committerRaif S. Naffah <raif@swiftdsl.com.au>2006-06-20 11:24:41 +0000
commitc2396fba423be31a4de8db3dbe09d42a04db32dc (patch)
tree09a4cc2b18491b62d6d60663b6b82e1f76856234 /gnu/java/security/key/rsa/GnuRSAKey.java
parent4d800c50a7257f4febca55b7c94b0901e816916a (diff)
downloadclasspath-c2396fba423be31a4de8db3dbe09d42a04db32dc.tar.gz
2006-06-20 Raif S. Naffah <raif@swiftdsl.com.au>
* 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.
Diffstat (limited to 'gnu/java/security/key/rsa/GnuRSAKey.java')
-rw-r--r--gnu/java/security/key/rsa/GnuRSAKey.java66
1 files changed, 22 insertions, 44 deletions
diff --git a/gnu/java/security/key/rsa/GnuRSAKey.java b/gnu/java/security/key/rsa/GnuRSAKey.java
index 3009dd71f..6ff740184 100644
--- a/gnu/java/security/key/rsa/GnuRSAKey.java
+++ b/gnu/java/security/key/rsa/GnuRSAKey.java
@@ -47,14 +47,11 @@ import java.security.Key;
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 @@ public abstract class GnuRSAKey implements Key, RSAKey
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 @@ public abstract class GnuRSAKey implements Key, RSAKey
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,11 +106,9 @@ public abstract class GnuRSAKey implements Key, RSAKey
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>.
*/
public BigInteger getN()
@@ -135,8 +117,8 @@ public abstract class GnuRSAKey implements Key, RSAKey
}
/**
- * <p>Returns the public exponent <code>e</code>.</p>
- *
+ * Returns the public exponent <code>e</code>.
+ *
* @return the public exponent <code>e</code>.
*/
public BigInteger getPublicExponent()
@@ -145,8 +127,8 @@ public abstract class GnuRSAKey implements Key, RSAKey
}
/**
- * <p>Same as {@link #getPublicExponent()}.</p>
- *
+ * Same as {@link #getPublicExponent()}.
+ *
* @return the public exponent <code>e</code>.
*/
public BigInteger getE()
@@ -155,23 +137,21 @@ public abstract class GnuRSAKey implements Key, RSAKey
}
/**
- * <p>Returns <code>true</code> if the designated object is an instance of
- * {@link RSAKey} and has the same RSA parameter values as this one.</p>
- *
+ * Returns <code>true</code> if the designated object is an instance of
+ * {@link 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))
- {
- return false;
- }
+ return false;
+
+ if (! (obj instanceof RSAKey))
+ return false;
+
final RSAKey that = (RSAKey) obj;
return n.equals(that.getModulus());
}
@@ -181,7 +161,7 @@ public abstract class GnuRSAKey implements Key, RSAKey
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 @@ public abstract class GnuRSAKey implements Key, RSAKey
return str;
}
- // abstract methods to be implemented by subclasses ------------------------
-
public abstract byte[] getEncoded(int format);
}