public list getextendedkeyusage() throws certificateparsingexception {
    byte[] bytes = this.getextensionbytes("2.5.29.37");

    if (bytes != null) {
      try {
        asn1inputstream din = new asn1inputstream(bytes);
        asn1sequence seq = (asn1sequence) din.readobject();
        list list = new arraylist();

        for (int i = 0; i != seq.size(); i++) {
          list.add(((asn1objectidentifier) seq.getobjectat(i)).getid());
        }

        return collections.unmodifiablelist(list);
      } catch (exception e) {
        throw new certificateparsingexception("error processing extended key usage extension");
      }
    }

    return null;
  }
  public string tostring() {
    stringbuffer buf = new stringbuffer();
    string nl = system.getproperty("line.separator");

    buf.append("  [0]         version: ").append(this.getversion()).append(nl);
    buf.append("         serialnumber: ").append(this.getserialnumber()).append(nl);
    buf.append("             issuerdn: ").append(this.getissuerdn()).append(nl);
    buf.append("           start date: ").append(this.getnotbefore()).append(nl);
    buf.append("           final date: ").append(this.getnotafter()).append(nl);
    buf.append("            subjectdn: ").append(this.getsubjectdn()).append(nl);
    buf.append("           public key: ").append(this.getpublickey()).append(nl);
    buf.append("  signature algorithm: ").append(this.getsigalgname()).append(nl);

    byte[] sig = this.getsignature();

    buf.append("            signature: ").append(new string(hex.encode(sig, 0, 20))).append(nl);
    for (int i = 20; i < sig.length; i += 20) {
      if (i < sig.length - 20) {
        buf.append("                       ").append(new string(hex.encode(sig, i, 20))).append(nl);
      } else {
        buf.append("                       ")
            .append(new string(hex.encode(sig, i, sig.length - i)))
            .append(nl);
      }
    }

    extensions extensions = c.gettbscertificate().getextensions();

    if (extensions != null) {
      enumeration e = extensions.oids();

      if (e.hasmoreelements()) {
        buf.append("       extensions: \n");
      }

      while (e.hasmoreelements()) {
        asn1objectidentifier oid = (asn1objectidentifier) e.nextelement();
        extension ext = extensions.getextension(oid);

        if (ext.getextnvalue() != null) {
          byte[] octs = ext.getextnvalue().getoctets();
          asn1inputstream din = new asn1inputstream(octs);
          buf.append("                       critical(").append(ext.iscritical()).append(") ");
          try {
            if (oid.equals(extension.basicconstraints)) {
              buf.append(basicconstraints.getinstance(din.readobject())).append(nl);
            } else if (oid.equals(extension.keyusage)) {
              buf.append(keyusage.getinstance(din.readobject())).append(nl);
            } else if (oid.equals(miscobjectidentifiers.netscapecerttype)) {
              buf.append(new netscapecerttype((derbitstring) din.readobject())).append(nl);
            } else if (oid.equals(miscobjectidentifiers.netscaperevocationurl)) {
              buf.append(new netscaperevocationurl((deria5string) din.readobject())).append(nl);
            } else if (oid.equals(miscobjectidentifiers.verisignczagextension)) {
              buf.append(new verisignczagextension((deria5string) din.readobject())).append(nl);
            } else {
              buf.append(oid.getid());
              buf.append(" value = ").append(asn1dump.dumpasstring(din.readobject())).append(nl);
              // buf.append(" value = ").append("*****").append(nl);
            }
          } catch (exception ex) {
            buf.append(oid.getid());
            //     buf.append(" value = ").append(new
            // string(hex.encode(ext.getextnvalue().getoctets()))).append(nl);
            buf.append(" value = ").append("*****").append(nl);
          }
        } else {
          buf.append(nl);
        }
      }
    }

    return buf.tostring();
  }