harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r462723 - in /incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security: provider/cert/ x509/
Date Wed, 11 Oct 2006 07:27:08 GMT
Author: smishura
Date: Wed Oct 11 00:27:06 2006
New Revision: 462723

URL: http://svn.apache.org/viewvc?view=rev&rev=462723
Log:
Apply patch for HARMONY-1798 ([classlib][security] Add toString() functionality to X.509 framework)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLDistributionPoints.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Certificate.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateList.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificatePolicies.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPoint.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPointName.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtensionValue.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralSubtree.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InhibitAnyPolicy.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/KeyUsage.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/NameConstraints.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyConstraints.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyInformation.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/SubjectKeyIdentifier.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java
    incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertificate.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/provider/cert/X509CRLImpl.java Wed Oct 11 00:27:06 2006
@@ -453,7 +453,7 @@
      * method documentation for more info
      */
     public String toString() {
-        return "X509CRLImpl: " + crl.toString(); //$NON-NLS-1$
+        return crl.toString();
     }
 
     // ---------------------------------------------------------------------

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AlgorithmIdentifier.java Wed Oct 11 00:27:06 2006
@@ -24,6 +24,7 @@
 
 import java.util.Arrays;
 
+import org.apache.harmony.crypto.utils.AlgNameMapper;
 import org.apache.harmony.security.asn1.ASN1Any;
 import org.apache.harmony.security.asn1.ASN1Oid;
 import org.apache.harmony.security.asn1.ASN1Sequence;
@@ -51,6 +52,8 @@
 
     // the value of algorithm field
     private String algorithm;
+    // the name of the algorithm
+    private String algorithmName;
     // the value of parameters field
     private byte[] parameters;
     // the encoding of AlgorithmIdentifier value
@@ -95,6 +98,22 @@
     }
 
     /**
+     * Returns the name of the algorithm corresponding to
+     * its OID. If there is no the such correspondence,
+     * algorithm OID is returned.
+     * @return  algorithm
+     */
+    public String getAlgorithmName() {
+        if (algorithmName == null) {
+            algorithmName = AlgNameMapper.map2AlgName(algorithm);
+            if (algorithmName == null) {
+                algorithmName = algorithm;
+            }
+        }
+        return algorithmName;
+    }
+
+    /**
      * Returns the value of parameters field of the structure.
      * @return  parameters
      */
@@ -124,6 +143,20 @@
                     : Arrays.equals(parameters, algid.parameters));
     }
     
+    /**
+     * Places the string representation into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer) {
+        buffer.append(getAlgorithmName());
+        if (parameters == null) {
+            buffer.append(", no params, "); //$NON-NLS-1$
+        } else {
+            buffer.append(", params unparsed, "); //$NON-NLS-1$
+        }
+        buffer.append("OID = "); //$NON-NLS-1$
+        buffer.append(getAlgorithm());
+    }
+
     /**
      * Custom AlgorithmIdentifier DER encoder/decoder
      */

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/AuthorityKeyIdentifier.java Wed Oct 11 00:27:06 2006
@@ -31,6 +31,7 @@
 import org.apache.harmony.security.asn1.ASN1Sequence;
 import org.apache.harmony.security.asn1.ASN1Type;
 import org.apache.harmony.security.asn1.BerInputStream;
+import org.apache.harmony.security.utils.Array;
 
 /**
  * The class incapsulates the ASN.1 DER encoding/decoding work
@@ -78,6 +79,28 @@
             encoding = ASN1.encode(this);
         }
         return encoding;
+    }
+
+    /**
+     * Places the string representation of extension value 
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("AuthorityKeyIdentifier [\n"); //$NON-NLS-1$
+        if (keyIdentifier != null) {
+            buffer.append(prefix).append("  keyIdentifier:\n"); //$NON-NLS-1$
+            buffer.append(Array.toString(keyIdentifier, prefix + "    ")); //$NON-NLS-1$
+        }
+        if (authorityCertIssuer != null) {
+            buffer.append(prefix).append("  authorityCertIssuer: [\n"); //$NON-NLS-1$
+            authorityCertIssuer.dumpValue(buffer, prefix + "    "); //$NON-NLS-1$
+            buffer.append(prefix).append("  ]\n"); //$NON-NLS-1$
+        }
+        if (authorityCertSerialNumber != null) {
+            buffer.append(prefix).append("  authorityCertSerialNumber: ") //$NON-NLS-1$
+                .append(authorityCertSerialNumber).append('\n');
+        }
+        buffer.append(prefix).append("]\n"); //$NON-NLS-1$
     }
 
     public static ASN1Type ASN1 = new ASN1Sequence(

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/BasicConstraints.java Wed Oct 11 00:27:06 2006
@@ -94,10 +94,12 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("BasicConstraints [\n  CA: ").append(cA)
-            .append("\n  pathLenConstraint: ").append(pathLenConstraint)
-            .append("\n]\n");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("BasicConstraints [\n").append(prefix) //$NON-NLS-1$
+            .append("  CA: ").append(cA) //$NON-NLS-1$
+            .append("\n  ").append(prefix).append("pathLenConstraint: ") //$NON-NLS-1$ //$NON-NLS-2$
+            .append(pathLenConstraint).append('\n').append(prefix)
+            .append("]\n"); //$NON-NLS-1$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLDistributionPoints.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLDistributionPoints.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLDistributionPoints.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLDistributionPoints.java Wed Oct 11 00:27:06 2006
@@ -103,6 +103,21 @@
     }
 
     /**
+     * Places the string representation of extension value
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("CRL Distribution Points: [\n"); //$NON-NLS-1$
+        int number = 0;
+        for (Iterator it=distributionPoints.iterator();
+                it.hasNext();) {
+            buffer.append(prefix).append("  [").append(++number).append("]\n"); //$NON-NLS-1$ //$NON-NLS-2$
+            ((DistributionPoint) it.next()).dumpValue(buffer, prefix + "  "); //$NON-NLS-1$
+        }
+        buffer.append(prefix).append("]\n"); //$NON-NLS-1$
+    }
+    
+    /**
      * Custom X.509 decoder.
      */
     public static final ASN1Type ASN1 = 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CRLNumber.java Wed Oct 11 00:27:06 2006
@@ -77,8 +77,8 @@
      * into the StringBuffer object.
      */
     public void dumpValue(StringBuffer buffer, String prefix) {
-        buffer.append(prefix).append("CRL Number: [ ").append(number).append(
-                " ]\n");
+        buffer.append(prefix).append("CRL Number: [ ").append(number).append( //$NON-NLS-1$
+                " ]\n"); //$NON-NLS-1$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Certificate.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Certificate.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Certificate.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Certificate.java Wed Oct 11 00:27:06 2006
@@ -27,6 +27,7 @@
 import org.apache.harmony.security.asn1.ASN1Type;
 import org.apache.harmony.security.asn1.BerInputStream;
 import org.apache.harmony.security.asn1.BitString;
+import org.apache.harmony.security.utils.Array;
 
 /**
  * The class incapsulates the ASN.1 DER encoding/decoding work 
@@ -112,19 +113,16 @@
     }
 
     public String toString() {
-        StringBuffer res = new StringBuffer();
-        res.append("X509 Certificate: \n["); //$NON-NLS-1$
-        res.append("\n  tbsCertificate:\n  ["); //$NON-NLS-1$
-        res.append(tbsCertificate.toString());
-        res.append("\n  ]"); //$NON-NLS-1$
-        res.append("\n  signatureAlgorithm:\n  ["); //$NON-NLS-1$
-        res.append(signatureAlgorithm.toString());
-        res.append("\n  ]"); //$NON-NLS-1$
-        res.append("\n  signatureValue:\n  ["); //$NON-NLS-1$
-        //res.append(Arrays.toString(signatureValue));
-        res.append("\n  ]"); //$NON-NLS-1$
-        res.append("\n]"); //$NON-NLS-1$
-        return res.toString();
+        StringBuffer buffer = new StringBuffer();
+        buffer.append("X.509 Certificate:\n[\n"); //$NON-NLS-1$
+        tbsCertificate.dumpValue(buffer);
+        buffer.append("\n  Algorithm: ["); //$NON-NLS-1$
+        signatureAlgorithm.dumpValue(buffer);
+        buffer.append(']');
+        buffer.append("\n  Signature Value:\n"); //$NON-NLS-1$
+        buffer.append(Array.toString(signatureValue, "")); //$NON-NLS-1$
+        buffer.append(']');
+        return buffer.toString();
     }
     
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateIssuer.java Wed Oct 11 00:27:06 2006
@@ -70,18 +70,18 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("Certificate Issuer: ");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("Certificate Issuer: "); //$NON-NLS-1$
         if (issuer == null) {
             try {
                 issuer = getIssuer();
             } catch (IOException e) {
                 // incorrect extension value encoding
-                buffer.append("Unparseable (incorrect!) extension value:\n");
+                buffer.append("Unparseable (incorrect!) extension value:\n"); //$NON-NLS-1$
                 super.dumpValue(buffer);
             }
         }
-        buffer.append(issuer).append("\n");
+        buffer.append(issuer).append('\n');
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateList.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateList.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateList.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificateList.java Wed Oct 11 00:27:06 2006
@@ -27,6 +27,7 @@
 import org.apache.harmony.security.asn1.ASN1Type;
 import org.apache.harmony.security.asn1.BerInputStream;
 import org.apache.harmony.security.asn1.BitString;
+import org.apache.harmony.security.utils.Array;
 
 /**
  * The class incapsulates the ASN.1 DER encoding/decoding work 
@@ -113,17 +114,9 @@
 
     public String toString() {
         StringBuffer res = new StringBuffer();
-        res.append("X509 CertList: \n["); //$NON-NLS-1$
-        res.append("\n  tbsCertList:\n  ["); //$NON-NLS-1$
-        res.append(tbsCertList.toString());
-        res.append("\n  ]"); //$NON-NLS-1$
-        res.append("\n  signatureAlgorithm:\n  ["); //$NON-NLS-1$
-        res.append(signatureAlgorithm.toString());
-        res.append("\n  ]"); //$NON-NLS-1$
-        res.append("\n  signatureValue:\n  ["); //$NON-NLS-1$
-        //res.append(Arrays.toString(signatureValue));
-        res.append("\n  ]"); //$NON-NLS-1$
-        res.append("\n]"); //$NON-NLS-1$
+        tbsCertList.dumpValue(res);
+        res.append("\nSignature Value:\n"); //$NON-NLS-1$
+        res.append(Array.toString(signatureValue, "")); //$NON-NLS-1$
         return res.toString();
     }
     

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificatePolicies.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificatePolicies.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificatePolicies.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/CertificatePolicies.java Wed Oct 11 00:27:06 2006
@@ -25,6 +25,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
 
 import org.apache.harmony.security.asn1.ASN1SequenceOf;
@@ -114,6 +115,21 @@
             encoding = ASN1.encode(this);
         }
         return encoding;
+    }
+
+    /**
+     * Places the string representation of extension value 
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("CertificatePolicies [\n"); //$NON-NLS-1$
+        for (Iterator it=policyInformations.iterator(); it.hasNext();) {
+            buffer.append(prefix);
+            buffer.append("  "); //$NON-NLS-1$
+            ((PolicyInformation) it.next()).dumpValue(buffer);
+            buffer.append('\n');
+        }
+        buffer.append(prefix).append("]\n"); //$NON-NLS-1$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPoint.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPoint.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPoint.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPoint.java Wed Oct 11 00:27:06 2006
@@ -91,6 +91,30 @@
     }
 
     /**
+     * Places the string representation of extension value
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix);
+        buffer.append("Distribution Point: [\n"); //$NON-NLS-1$
+        if (distributionPoint != null) {
+            distributionPoint.dumpValue(buffer, prefix + "  "); //$NON-NLS-1$
+        }
+        if (reasons != null) {
+            reasons.dumpValue(buffer, prefix + "  "); //$NON-NLS-1$
+        }
+        if (cRLIssuer != null) {
+            buffer.append(prefix);
+            buffer.append("  CRL Issuer: [\n"); //$NON-NLS-1$
+            cRLIssuer.dumpValue(buffer, prefix + "    "); //$NON-NLS-1$
+            buffer.append(prefix);
+            buffer.append("  ]\n"); //$NON-NLS-1$
+        }
+        buffer.append(prefix);
+        buffer.append("]\n"); //$NON-NLS-1$
+    }
+
+    /**
      * Custom X.509 decoder.
      */
     public static final ASN1Sequence ASN1 = new ASN1Sequence(new ASN1Type[] {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPointName.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPointName.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPointName.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DistributionPointName.java Wed Oct 11 00:27:06 2006
@@ -22,13 +22,17 @@
 
 package org.apache.harmony.security.x509;
 
+import java.io.IOException;
+import javax.security.auth.x500.X500Principal;
+
 import org.apache.harmony.security.asn1.ASN1Choice;
 import org.apache.harmony.security.asn1.ASN1Implicit;
 import org.apache.harmony.security.asn1.ASN1Type;
+import org.apache.harmony.security.asn1.BerInputStream;
 import org.apache.harmony.security.x501.Name;
 
 /**
- * The class incapsulates the ASN.1 DER encoding/decoding work 
+ * The class encapsulates the ASN.1 DER encoding/decoding work 
  * with the DistributionPointName structure which is the part 
  * of X.509 CRL
  * (as specified in RFC 3280 -
@@ -67,7 +71,8 @@
    
     private final GeneralNames fullName;
     private final Name nameRelativeToCRLIssuer;
-    
+
+
     public DistributionPointName(GeneralNames fullName) {
         this.fullName = fullName;
         this.nameRelativeToCRLIssuer = null;
@@ -78,6 +83,25 @@
         this.nameRelativeToCRLIssuer = nameRelativeToCRLIssuer;
     }
 
+    /**
+     * Places the string representation of extension value
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix);
+        buffer.append("Distribution Point Name: [\n"); //$NON-NLS-1$
+        if (fullName != null) {
+            fullName.dumpValue(buffer, prefix + "  "); //$NON-NLS-1$
+        } else {
+            buffer.append(prefix);
+            buffer.append("  "); //$NON-NLS-1$
+            buffer.append(nameRelativeToCRLIssuer.getName(
+                        X500Principal.RFC2253));
+        } 
+        buffer.append(prefix);
+        buffer.append("]\n"); //$NON-NLS-1$
+    }
+
     public static final ASN1Choice ASN1 = new ASN1Choice(new ASN1Type[] {
             new ASN1Implicit(0, GeneralNames.ASN1), 
             new ASN1Implicit(1, Name.ASN1_RDN) }) {
@@ -85,6 +109,18 @@
         public int getIndex(java.lang.Object object) {
             DistributionPointName dpn = (DistributionPointName) object;
             return (dpn.fullName == null) ? 1 : 0;
+        }
+
+        protected Object getDecodedObject(BerInputStream in) throws IOException {
+            DistributionPointName result = null;
+            if (in.choiceIndex == 0) {
+                result = new DistributionPointName((GeneralNames) in.content);
+            } else {
+                // note: ASN.1 decoder will report an error if index 
+                // is neither 0 or 1
+                result = new DistributionPointName((Name) in.content);
+            }
+            return result;
         }
 
         public Object getObjectToEncode(Object object) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtendedKeyUsage.java Wed Oct 11 00:27:06 2006
@@ -85,8 +85,8 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("Extended Key Usage: ");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("Extended Key Usage: "); //$NON-NLS-1$
         if (keys == null) {
             try {
                 keys = getExtendedKeyUsage();
@@ -96,14 +96,14 @@
                 return;
             }
         }
-        buffer.append("[");
+        buffer.append('[');
         for (Iterator it=keys.iterator(); it.hasNext();) {
-            buffer.append(" \"").append(it.next()).append("\"");
+            buffer.append(" \"").append(it.next()).append('"'); //$NON-NLS-1$
             if (it.hasNext()) {
-                buffer.append(",");
+                buffer.append(',');
             }
         }
-        buffer.append(" ]\n");
+        buffer.append(" ]\n"); //$NON-NLS-1$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extension.java Wed Oct 11 00:27:06 2006
@@ -328,6 +328,72 @@
         }
     }
 
+    /**
+     * Places the string representation into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append("OID: ").append(getExtnID()) //$NON-NLS-1$
+            .append(", Critical: ").append(critical).append('\n'); //$NON-NLS-1$
+        if (!valueDecoded) {
+            try {
+                decodeExtensionValue();
+            } catch (IOException e) { }
+        }
+        if (extnValueObject != null) {
+            extnValueObject.dumpValue(buffer, prefix);
+            return;
+        }
+        // else: dump unparsed hex representation
+        buffer.append(prefix);
+        if (oidEquals(extnID, SUBJ_DIRECTORY_ATTRS)) {
+            buffer.append("Subject Directory Attributes Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, SUBJ_KEY_ID)) {
+            buffer.append("Subject Key Identifier Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, KEY_USAGE)) {
+            buffer.append("Key Usage Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, PRIVATE_KEY_USAGE_PERIOD)) {
+            buffer.append("Private Key Usage Period Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, SUBJECT_ALT_NAME)) {
+            buffer.append("Subject Alternative Name Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, ISSUER_ALTERNATIVE_NAME)) {
+            buffer.append("Issuer Alternative Name Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, BASIC_CONSTRAINTS)) {
+            buffer.append("Basic Constraints Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, NAME_CONSTRAINTS)) {
+            buffer.append("Name Constraints Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, CRL_DISTR_POINTS)) {
+            buffer.append("CRL Distribution Points Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, CERTIFICATE_POLICIES)) {
+            buffer.append("Certificate Policies Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, POLICY_MAPPINGS)) {
+            buffer.append("Policy Mappings Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, AUTH_KEY_ID)) {
+            buffer.append("Authority Key Identifier Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, POLICY_CONSTRAINTS)) {
+            buffer.append("Policy Constraints Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, EXTENDED_KEY_USAGE)) {
+            buffer.append("Extended Key Usage Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, INHIBIT_ANY_POLICY)) {
+            buffer.append("Inhibit Any-Policy Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, AUTHORITY_INFO_ACCESS)) {
+            buffer.append("Authority Information Access Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, SUBJECT_INFO_ACCESS)) {
+            buffer.append("Subject Information Access Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, INVALIDITY_DATE)) {
+            buffer.append("Invalidity Date Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, CRL_NUMBER)) {
+            buffer.append("CRL Number Extension"); //$NON-NLS-1$
+        } else if (oidEquals(extnID, REASON_CODE)) {
+            buffer.append("Reason Code Extension"); //$NON-NLS-1$
+        } else {
+            buffer.append("Unknown Extension"); //$NON-NLS-1$
+        }
+        buffer.append('\n').append(prefix)
+            .append("Unparsed Extension Value:\n"); //$NON-NLS-1$
+        buffer.append(Array.toString(extnValue, prefix));
+    }
+
+
     // Compares two OIDs
     private static boolean oidEquals(int[] oid1, int[] oid2) {
         int length = oid1.length;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtensionValue.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtensionValue.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtensionValue.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ExtensionValue.java Wed Oct 11 00:27:06 2006
@@ -52,16 +52,24 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("Unparseable extension value:\n");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("Unparseable extension value:\n"); //$NON-NLS-1$
         if (encoding == null) {
             encoding = getEncoded();
         }
         if (encoding == null) {
-            buffer.append("NULL\n");
+            buffer.append("NULL\n"); //$NON-NLS-1$
         } else {
-            buffer.append(Array.toString(encoding, ""));
+            buffer.append(Array.toString(encoding, prefix));
         }
+    }
+
+    /**
+     * Places the string representation of extension value
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer) {
+        dumpValue(buffer, ""); //$NON-NLS-1$
     };
 }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/Extensions.java Wed Oct 11 00:27:06 2006
@@ -385,6 +385,21 @@
                             && (extensions.size() == extns.extensions.size()))
                 );
     }
+    
+    /**
+     * Places the string representation into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        if (extensions == null) {
+            return;
+        }
+        int num = 1;
+        for (Extension extension: extensions) {
+            buffer.append('\n').append(prefix)
+                .append('[').append(num++).append("]: "); //$NON-NLS-1$
+            extension.dumpValue(buffer, prefix);
+        }
+    }
 
     /**
      * Custom X.509 Extensions decoder.

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralSubtree.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralSubtree.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralSubtree.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/GeneralSubtree.java Wed Oct 11 00:27:06 2006
@@ -126,6 +126,22 @@
     }
 
     /**
+     * Places the string representation of extension value
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("General Subtree: [\n"); //$NON-NLS-1$
+        buffer.append(prefix).append("  base: ").append(base).append('\n'); //$NON-NLS-1$
+        buffer.append(prefix).append("  minimum: ") //$NON-NLS-1$
+            .append(minimum).append('\n');
+        if (maximum >= 0) {
+            buffer.append(prefix).append("  maximum: ") //$NON-NLS-1$
+                .append(maximum).append('\n');
+        }
+        buffer.append(prefix).append("]\n"); //$NON-NLS-1$
+    }
+
+    /**
      * ASN.1 DER X.509 GeneralSubtree encoder/decoder class.
      */
     public static final ASN1Sequence ASN1 = new ASN1Sequence(new ASN1Type[] {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InhibitAnyPolicy.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InhibitAnyPolicy.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InhibitAnyPolicy.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InhibitAnyPolicy.java Wed Oct 11 00:27:06 2006
@@ -77,8 +77,9 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("Inhibit Any-Policy: ").append(skipCerts).append("\n");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("Inhibit Any-Policy: ") //$NON-NLS-1$
+            .append(skipCerts).append('\n');
     }
 }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/InvalidityDate.java Wed Oct 11 00:27:06 2006
@@ -74,8 +74,9 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("Invalidity Date [\n  ").append(date).append("\n]\n");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("Invalidity Date: [ ") //$NON-NLS-1$
+            .append(date).append(" ]\n"); //$NON-NLS-1$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/IssuingDistributionPoint.java Wed Oct 11 00:27:06 2006
@@ -159,9 +159,22 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("Invalidity Date\n");
-        super.dumpValue(buffer);
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("Issuing Distribution Point: [\n"); //$NON-NLS-1$
+        if (distributionPoint != null) {
+            distributionPoint.dumpValue(buffer, "  " + prefix); //$NON-NLS-1$
+        }
+        buffer.append(prefix).append("  onlyContainsUserCerts: ") //$NON-NLS-1$
+            .append(onlyContainsUserCerts).append('\n');
+        buffer.append(prefix).append("  onlyContainsCACerts: ") //$NON-NLS-1$
+            .append(onlyContainsCACerts).append('\n');
+        if (onlySomeReasons != null) {
+            onlySomeReasons.dumpValue(buffer, prefix + "  "); //$NON-NLS-1$
+        }
+        buffer.append(prefix).append("  indirectCRL: ") //$NON-NLS-1$
+            .append(indirectCRL).append('\n');
+        buffer.append(prefix).append("  onlyContainsAttributeCerts: ") //$NON-NLS-1$
+            .append(onlyContainsAttributeCerts).append('\n');
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/KeyUsage.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/KeyUsage.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/KeyUsage.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/KeyUsage.java Wed Oct 11 00:27:06 2006
@@ -49,15 +49,15 @@
      * The names of the usages.
      */
     private static final String[] USAGES = {
-        "digitalSignature",
-        "nonRepudiation",
-        "keyEncipherment",
-        "dataEncipherment",
-        "keyAgreement",
-        "keyCertSign",
-        "cRLSign",
-        "encipherOnly",
-        "decipherOnly",
+        "digitalSignature", //$NON-NLS-1$
+        "nonRepudiation", //$NON-NLS-1$
+        "keyEncipherment", //$NON-NLS-1$
+        "dataEncipherment", //$NON-NLS-1$
+        "keyAgreement", //$NON-NLS-1$
+        "keyCertSign", //$NON-NLS-1$
+        "cRLSign", //$NON-NLS-1$
+        "encipherOnly", //$NON-NLS-1$
+        "decipherOnly", //$NON-NLS-1$
     };
 
     // the value of extension
@@ -97,14 +97,15 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("KeyUsage [\n");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("KeyUsage [\n"); //$NON-NLS-1$
         for (int i=0; i<keyUsage.length; i++) {
             if (keyUsage[i]) {
-                buffer.append("  ").append(USAGES[i]).append("\n");
+                buffer.append(prefix).append("  ") //$NON-NLS-1$
+                    .append(USAGES[i]).append('\n');
             }
         }
-        buffer.append("]\n");
+        buffer.append(prefix).append("]\n"); //$NON-NLS-1$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/NameConstraints.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/NameConstraints.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/NameConstraints.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/NameConstraints.java Wed Oct 11 00:27:06 2006
@@ -273,6 +273,31 @@
     }
 
     /**
+     * Places the string representation of extension value
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("Name Constraints: [\n"); //$NON-NLS-1$
+        if (permittedSubtrees != null) {
+            buffer.append(prefix).append("  Permitted: [\n"); //$NON-NLS-1$
+            for (Iterator it=permittedSubtrees.getSubtrees().iterator();
+                    it.hasNext();) {
+                ((GeneralSubtree) it.next()).dumpValue(buffer, prefix + "    "); //$NON-NLS-1$
+            }
+            buffer.append(prefix).append("  ]\n"); //$NON-NLS-1$
+        }
+        if (excludedSubtrees != null) {
+            buffer.append(prefix).append("  Excluded: [\n"); //$NON-NLS-1$
+            for (Iterator it=excludedSubtrees.getSubtrees().iterator();
+                    it.hasNext();) {
+                ((GeneralSubtree) it.next()).dumpValue(buffer, prefix + "    "); //$NON-NLS-1$
+            }
+            buffer.append(prefix).append("  ]\n"); //$NON-NLS-1$
+        }
+        buffer.append('\n').append(prefix).append("]\n"); //$NON-NLS-1$
+    }
+    
+    /**
      * X.509 NameConstraints encoder/decoder.
      */
     public static final ASN1Sequence ASN1 = new ASN1Sequence(new ASN1Type[] {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyConstraints.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyConstraints.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyConstraints.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyConstraints.java Wed Oct 11 00:27:06 2006
@@ -123,6 +123,23 @@
     }
 
     /**
+     * Places the string representation of extension value 
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("PolicyConstraints: [\n"); //$NON-NLS-1$
+        if (requireExplicitPolicy != null) {
+            buffer.append(prefix).append("  requireExplicitPolicy: ") //$NON-NLS-1$
+                .append(requireExplicitPolicy).append('\n');
+        }
+        if (inhibitPolicyMapping != null) {
+            buffer.append(prefix).append("  inhibitPolicyMapping: ") //$NON-NLS-1$
+                .append(inhibitPolicyMapping).append('\n');
+        }
+        buffer.append(prefix).append("]\n"); //$NON-NLS-1$
+    }
+
+    /**
      * X.509 PolicyConstraints encoder/decoder.
      */
     public static final ASN1Sequence ASN1 = new ASN1Sequence(new ASN1Type[] {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyInformation.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyInformation.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyInformation.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/PolicyInformation.java Wed Oct 11 00:27:06 2006
@@ -84,6 +84,15 @@
     }
 
     /**
+     * Places the string representation of extension value 
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer) {
+        buffer.append("Policy Identifier [") //$NON-NLS-1$
+            .append(policyIdentifier).append(']');
+    }
+
+    /**
      * ASN.1 DER X.509 PolicyInformation encoder/decoder class.
      */
     public static final ASN1Sequence ASN1 = new ASN1Sequence(

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonCode.java Wed Oct 11 00:27:06 2006
@@ -88,41 +88,41 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("Reason Code [\n  ");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("Reason Code: [ "); //$NON-NLS-1$
         switch (code) {
             case UNSPECIFIED:
-                buffer.append("unspecified");
+                buffer.append("unspecified"); //$NON-NLS-1$
                 break;
             case KEY_COMPROMISE:
-                buffer.append("keyCompromise");
+                buffer.append("keyCompromise"); //$NON-NLS-1$
                 break;
             case CA_COMPROMISE:
-                buffer.append("cACompromise");
+                buffer.append("cACompromise"); //$NON-NLS-1$
                 break;
             case AFFILIATION_CHANGED:
-                buffer.append("affiliationChanged");
+                buffer.append("affiliationChanged"); //$NON-NLS-1$
                 break;
             case SUPERSEDED:
-                buffer.append("superseded");
+                buffer.append("superseded"); //$NON-NLS-1$
                 break;
             case CESSATION_OF_OPERATION:
-                buffer.append("cessationOfOperation");
+                buffer.append("cessationOfOperation"); //$NON-NLS-1$
                 break;
             case CERTIFICATE_HOLD:
-                buffer.append("certificateHold");
+                buffer.append("certificateHold"); //$NON-NLS-1$
                 break;
             case REMOVE_FROM_CRL:
-                buffer.append("removeFromCRL");
+                buffer.append("removeFromCRL"); //$NON-NLS-1$
                 break;
             case PRIVILEGE_WITHDRAWN:
-                buffer.append("privilegeWithdrawn");
+                buffer.append("privilegeWithdrawn"); //$NON-NLS-1$
                 break;
             case AA_COMPROMISE:
-                buffer.append("aACompromise");
+                buffer.append("aACompromise"); //$NON-NLS-1$
                 break;
         }
-        buffer.append("\n]\n");
+        buffer.append(" ]\n"); //$NON-NLS-1$
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/ReasonFlags.java Wed Oct 11 00:27:06 2006
@@ -78,6 +78,23 @@
     }
 
     /**
+     * Places the string representation of extension value
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix);
+        buffer.append("ReasonFlags [\n"); //$NON-NLS-1$
+        for (int i=0; i<flags.length; i++) {
+            if (flags[i]) {
+                buffer.append(prefix).append("  ") //$NON-NLS-1$
+                    .append(REASONS[i]).append('\n');
+            }
+        }
+        buffer.append(prefix);
+        buffer.append("]\n"); //$NON-NLS-1$
+    }
+    
+    /**
      * ASN.1 Encoder/Decoder.
      */
     public static ASN1BitString ASN1 = 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/SubjectKeyIdentifier.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/SubjectKeyIdentifier.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/SubjectKeyIdentifier.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/SubjectKeyIdentifier.java Wed Oct 11 00:27:06 2006
@@ -74,10 +74,10 @@
      * Places the string representation of extension value
      * into the StringBuffer object.
      */
-    public void dumpValue(StringBuffer buffer) {
-        buffer.append("SubjectKeyIdentifier: [\n");
-        buffer.append(Array.toString(keyIdentifier, ""));
-        buffer.append("]\n");
+    public void dumpValue(StringBuffer buffer, String prefix) {
+        buffer.append(prefix).append("SubjectKeyIdentifier: [\n"); //$NON-NLS-1$
+        buffer.append(Array.toString(keyIdentifier, prefix));
+        buffer.append(prefix).append("]\n"); //$NON-NLS-1$
     }
 }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertList.java Wed Oct 11 00:27:06 2006
@@ -26,6 +26,7 @@
 import java.math.BigInteger;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.security.auth.x500.X500Principal;
@@ -153,6 +154,22 @@
                     : crlEntryExtensions.equals(rcert.crlEntryExtensions));
         }
 
+        /**
+         * Places the string representation of extension value
+         * into the StringBuffer object.
+         */
+        public void dumpValue(StringBuffer buffer, String prefix) {
+            buffer.append(prefix).append("Certificae Serial Number: ") //$NON-NLS-1$
+                .append(userCertificate).append('\n');
+            buffer.append(prefix).append("Revocation Date: ") //$NON-NLS-1$
+                .append(revocationDate);
+            if (crlEntryExtensions != null) {
+                buffer.append('\n').append(prefix)
+                    .append("CRL Entry Extensions: ["); //$NON-NLS-1$
+                crlEntryExtensions.dumpValue(buffer, prefix + "  "); //$NON-NLS-1$
+                buffer.append(prefix).append(']');
+            }
+        }
         
         public static ASN1Sequence ASN1 = new ASN1Sequence(
                 new ASN1Type[] {ASN1Integer.getInstance(), Time.ASN1,
@@ -340,6 +357,37 @@
             && ((crlExtensions == null)
                     ? tbscert.crlExtensions == null
                     : crlExtensions.equals(tbscert.crlExtensions));
+    }
+
+    /**
+     * Places the string representation of extension value
+     * into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer) {
+        buffer.append("X.509 CRL v").append(version); //$NON-NLS-1$
+        buffer.append("\nSignature Algorithm: ["); //$NON-NLS-1$
+        signature.dumpValue(buffer);
+        buffer.append(']');
+        buffer.append("\nIssuer: ").append(issuer.getName(X500Principal.RFC2253)); //$NON-NLS-1$
+        buffer.append("\n\nThis Update: ").append(thisUpdate); //$NON-NLS-1$
+        buffer.append("\nNext Update: ").append(nextUpdate).append('\n'); //$NON-NLS-1$
+        if (revokedCertificates != null) {
+            buffer.append("\nRevoked Certificates: ") //$NON-NLS-1$
+                .append(revokedCertificates.size()).append(" ["); //$NON-NLS-1$
+            int number = 1;
+            for (Iterator it = revokedCertificates.iterator();it.hasNext();) {
+                buffer.append("\n  [").append(number++).append(']'); //$NON-NLS-1$
+                ((RevokedCertificate) it.next()).dumpValue(buffer, "  "); //$NON-NLS-1$
+                buffer.append('\n');
+            }
+            buffer.append("]\n"); //$NON-NLS-1$
+        }
+        if (crlExtensions != null) {
+            buffer.append("\nCRL Extensions: ") //$NON-NLS-1$
+                .append(crlExtensions.size()).append(" ["); //$NON-NLS-1$
+            crlExtensions.dumpValue(buffer, "  "); //$NON-NLS-1$
+            buffer.append("]\n"); //$NON-NLS-1$
+        }
     }
 
     /**

Modified: incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertificate.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertificate.java?view=diff&rev=462723&r1=462722&r2=462723
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertificate.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/TBSCertificate.java Wed Oct 11 00:27:06 2006
@@ -23,6 +23,7 @@
 package org.apache.harmony.security.x509;
 
 import java.math.BigInteger;
+import javax.security.auth.x500.X500Principal;
 
 import org.apache.harmony.security.asn1.ASN1BitString;
 import org.apache.harmony.security.asn1.ASN1Explicit;
@@ -249,6 +250,47 @@
             encoding = ASN1.encode(this);
         }
         return encoding;
+    }
+
+    /**
+     * Places the string representation into the StringBuffer object.
+     */
+    public void dumpValue(StringBuffer buffer) {
+        buffer.append('[');
+        buffer.append("\n  Version: V").append(version+1); //$NON-NLS-1$
+        buffer.append("\n  Subject: ") //$NON-NLS-1$
+            .append(subject.getName(X500Principal.RFC2253));
+        buffer.append("\n  Signature Algorithm: "); //$NON-NLS-1$
+        signature.dumpValue(buffer);
+        buffer.append("\n  Key: "); //$NON-NLS-1$
+        buffer.append(subjectPublicKeyInfo.getPublicKey().toString());
+        buffer.append("\n  Validity: [From: "); //$NON-NLS-1$
+        buffer.append(validity.getNotBefore());
+        buffer.append("\n               To: "); //$NON-NLS-1$
+        buffer.append(validity.getNotAfter()).append(']');
+        buffer.append("\n  Issuer: "); //$NON-NLS-1$
+        buffer.append(issuer.getName(X500Principal.RFC2253));
+        buffer.append("\n  Serial Number: "); //$NON-NLS-1$
+        buffer.append(serialNumber);
+        if (issuerUniqueID != null) {
+            buffer.append("\n  Issuer Id: "); //$NON-NLS-1$
+            for (int i=0; i<issuerUniqueID.length; i++) {
+                buffer.append(issuerUniqueID[i] ? '1' : '0');
+            }
+        }
+        if (subjectUniqueID != null) {
+            buffer.append("\n  Subject Id: "); //$NON-NLS-1$
+            for (int i=0; i<subjectUniqueID.length; i++) {
+                buffer.append(subjectUniqueID[i] ? '1' : '0');
+            }
+        }
+        if (extensions != null) {
+            buffer.append("\n\n  Extensions: "); //$NON-NLS-1$
+            buffer.append("[\n"); //$NON-NLS-1$
+            extensions.dumpValue(buffer, "    "); //$NON-NLS-1$
+            buffer.append("  ]"); //$NON-NLS-1$
+        }
+        buffer.append("\n]"); //$NON-NLS-1$
     }
 
     /**



Mime
View raw message