if (name.getTagClass() != DER.APPLICATION) throw new IOException("malformed GeneralName");
int tagClass = name.getTagClass(); if (tagClass != DER.CONTEXT) throw new IOException("malformed GeneralName: Tag class is " + tagClass);
  public GeneralNames(final byte[] encoded) throws IOException  {    names = new LinkedList();    DERReader der = new DERReader(encoded);    DERValue nameList = der.read();    if (!nameList.isConstructed())      throw new IOException("malformed GeneralNames");    int len = 0;    while (len < nameList.getLength())      {        DERValue name = der.read();        List namePair = new ArrayList(2);        if (name.getTagClass() != DER.APPLICATION)          throw new IOException("malformed GeneralName");        namePair.add(new Integer(name.getTag()));        DERValue val = null;        switch (name.getTag())          {          case RFC822_NAME:          case DNS_NAME:          case X400_ADDRESS:          case URI:            namePair.add(new String((byte[]) name.getValue()));            break;          case OTHER_NAME:          case EDI_PARTY_NAME:            namePair.add(name.getValue());            break;          case DIRECTORY_NAME:            byte[] b = name.getEncoded();            b[0] = (byte) (DER.CONSTRUCTED|DER.SEQUENCE);            namePair.add(new X500DistinguishedName(b).toString());            break;          case IP_ADDRESS:            namePair.add(InetAddress.getByAddress((byte[]) name.getValue())                         .getHostAddress());            break;          case REGISTERED_ID:            byte[] bb = name.getEncoded();            bb[0] = (byte) DER.OBJECT_IDENTIFIER;            namePair.add(new OID(bb).toString());            break;          default:            throw new IOException("unknown tag " + name.getTag());          }        names.add(namePair);        len += name.getEncodedLength();      }  }