From 4c6546e77c9f75fd2deda3883d8cb86dcf0dfd43 Mon Sep 17 00:00:00 2001 From: "Raif S. Naffah" Date: Sat, 25 Mar 2006 11:19:17 +0000 Subject: 2006-03-25 Raif S. Naffah * 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. --- gnu/java/security/key/dss/DSSPublicKey.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'gnu/java/security/key/dss/DSSPublicKey.java') diff --git a/gnu/java/security/key/dss/DSSPublicKey.java b/gnu/java/security/key/dss/DSSPublicKey.java index 93bb64022..058774535 100644 --- a/gnu/java/security/key/dss/DSSPublicKey.java +++ b/gnu/java/security/key/dss/DSSPublicKey.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.key.IKeyPairCodec; @@ -48,12 +49,11 @@ import java.security.interfaces.DSAPublicKey; /** *

An object that embodies a DSS (Digital Signature Standard) public key.

* - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * @see #getEncoded */ public class DSSPublicKey extends DSSKey implements PublicKey, DSAPublicKey { - // Constants and variables // ------------------------------------------------------------------------- @@ -63,6 +63,9 @@ public class DSSPublicKey extends DSSKey implements PublicKey, DSAPublicKey */ private final BigInteger y; + /** String representation of this key. Cached for speed. */ + private transient String str; + // Constructor(s) // ------------------------------------------------------------------------- @@ -198,4 +201,18 @@ public class DSSPublicKey extends DSSKey implements PublicKey, DSAPublicKey DSAPublicKey that = (DSAPublicKey) obj; return super.equals(that) && y.equals(that.getY()); } + + public String toString() + { + if (str == null) + { + String ls = SystemProperties.getProperty("line.separator"); + str = new StringBuilder(this.getClass().getName()).append("(") + .append(super.toString()).append(",").append(ls) + .append("y=0x").append(y.toString(16)).append(ls) + .append(")").toString(); + } + + return str; + } } -- cgit v1.2.1