summaryrefslogtreecommitdiff
path: root/gnu/java/security/key/dss/DSSKey.java
diff options
context:
space:
mode:
authorRaif S. Naffah <raif@swiftdsl.com.au>2006-03-25 11:19:17 +0000
committerRaif S. Naffah <raif@swiftdsl.com.au>2006-03-25 11:19:17 +0000
commit4c6546e77c9f75fd2deda3883d8cb86dcf0dfd43 (patch)
tree1dd4227079f351746a87ba14975a17150a921fac /gnu/java/security/key/dss/DSSKey.java
parentab9dc3bbbe7479e7129a75f6523afbafe316dc51 (diff)
downloadclasspath-4c6546e77c9f75fd2deda3883d8cb86dcf0dfd43.tar.gz
2006-03-25 Raif S. Naffah <raif@swiftdsl.com.au>
* gnu/java/security/pkcs/SignerInfo.java (log): New field. (DEBUG): Removed. (debug): Likewise. (SignerInfo(BERReader)): Updated javadoc. Use JDK logging. (SignerInfo(X500Principal,BigInteger,OID,byte[],OID,byte[],byte[])): New constructor. (encode): New method. * gnu/java/security/pkcs/PKCS7SignedData.java (log): New field. (PKCS7_DATA): Removed. (DEBUG): Likewise. (debug): Likewise. (PKCS7SignedData(BERReader)): Updated javadoc. Use JDK logging. (PKCS7SignedData(Set,PKCS7Data,Certificate[],X509CRL[],Set)): New constructor. (encode): New method. * gnu/java/security/pkcs/PKCS7Data.java: New file. * gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java (log): New field. (encodePrivateKey): Encode x (private MPN) as an OCTET STRING. (decodePrivateKey): Decode x from an OCTET STRING. * gnu/java/security/key/dss/DSSPublicKey.java (str): New field. (toString): New method. * gnu/java/security/key/dss/DSSPrivateKey.java (DEBUG): New field. (str): Likewise. (toString): New method. * gnu/java/security/key/dss/DSSKey.java (str): New Field. (toString): New method. * gnu/java/security/provider/DSAParameterGenerator.java: Removed.
Diffstat (limited to 'gnu/java/security/key/dss/DSSKey.java')
-rw-r--r--gnu/java/security/key/dss/DSSKey.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/gnu/java/security/key/dss/DSSKey.java b/gnu/java/security/key/dss/DSSKey.java
index 428cab1e7..f73df3584 100644
--- a/gnu/java/security/key/dss/DSSKey.java
+++ b/gnu/java/security/key/dss/DSSKey.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.security.key.dss;
+import gnu.classpath.SystemProperties;
import gnu.java.security.Registry;
import gnu.java.security.util.FormatUtil;
@@ -59,7 +60,7 @@ import java.security.spec.DSAParameterSpec;
* the relevant <code>getEncoded()</code> methods of each of the private and
* public keys.</p>
*
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
* @see DSSPrivateKey#getEncoded
* @see DSSPublicKey#getEncoded
*/
@@ -95,6 +96,9 @@ public abstract class DSSKey implements Key, DSAKey
*/
protected final int defaultFormat;
+ /** String representation of this key. Cached for speed. */
+ private transient String str;
+
// Constructor(s)
// -------------------------------------------------------------------------
@@ -176,6 +180,21 @@ public abstract class DSSKey implements Key, DSAKey
&& g.equals(that.getParams().getG());
}
+ public String toString()
+ {
+ if (str == null)
+ {
+ String ls = SystemProperties.getProperty("line.separator");
+ str = new StringBuilder().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);