public String toString() {
   StringWriter str = new StringWriter();
   PrintWriter out = new PrintWriter(str);
   out.println(X509CertificateImpl.class.getName() + " {");
   out.println("  TBSCertificate {");
   out.println("    version = " + version + ";");
   out.println("    serialNo = " + serialNo + ";");
   out.println("    signature = {");
   out.println("      algorithm = " + getSigAlgName() + ";");
   out.print("      parameters =");
   if (sigAlgVal != null) {
     out.println();
     out.print(Util.hexDump(sigAlgVal, "        "));
   } else {
     out.println(" null;");
   }
   out.println("    }");
   out.println("    issuer = " + issuer.getName() + ";");
   out.println("    validity = {");
   out.println("      notBefore = " + notBefore + ";");
   out.println("      notAfter  = " + notAfter + ";");
   out.println("    }");
   out.println("    subject = " + subject.getName() + ";");
   out.println("    subjectPublicKeyInfo = {");
   out.println("      algorithm = " + subjectKey.getAlgorithm());
   out.println("      key =");
   out.print(Util.hexDump(subjectKey.getEncoded(), "        "));
   out.println("    };");
   out.println("    issuerUniqueId  = " + issuerUniqueId + ";");
   out.println("    subjectUniqueId = " + subjectUniqueId + ";");
   out.println("    extensions = {");
   for (Iterator it = extensions.values().iterator(); it.hasNext(); ) {
     out.println("      " + it.next());
   }
   out.println("    }");
   out.println("  }");
   out.println("  signatureAlgorithm = " + getSigAlgName() + ";");
   out.println("  signatureValue =");
   out.print(Util.hexDump(signature, "    "));
   out.println("}");
   return str.toString();
 }
 public X500Principal getSubjectX500Principal() {
   return new X500Principal(subject.getDer());
 }
 public X500Principal getIssuerX500Principal() {
   return new X500Principal(issuer.getDer());
 }