if (!sigId.equals(cert.getSigAlgOID()))
if (!sigId.toString().equals(cert.getSigAlgOID()))
  public boolean match(Certificate certificate)  {    if (!(certificate instanceof X509Certificate))      return false;    X509Certificate cert = (X509Certificate) certificate;    if (this.cert != null)      {        try          {            byte[] e1 = this.cert.getEncoded();            byte[] e2 = cert.getEncoded();            if (!Arrays.equals(e1, e2))              return false;          }        catch (CertificateEncodingException cee)          {            return false;          }      }    if (serialNo != null)      {        if (!serialNo.equals(cert.getSerialNumber()))          return false;      }    if (certValid != null)      {        try          {            cert.checkValidity(certValid);          }        catch (CertificateException ce)          {            return false;          }      }    if (issuer != null)      {        if (!issuer.equals(cert.getIssuerX500Principal()))          return false;      }    if (subject != null)      {        if (!subject.equals(cert.getSubjectX500Principal()))          return false;      }    if (sigId != null)      {        if (!sigId.equals(cert.getSigAlgOID()))          return false;      }    if (subjectKeyId != null)      {        byte[] b = cert.getExtensionValue(SUBJECT_KEY_ID);        if (!Arrays.equals(b, subjectKeyId))          return false;      }    if (authKeyId != null)      {        byte[] b = cert.getExtensionValue(AUTH_KEY_ID);        if (!Arrays.equals(b, authKeyId))          return false;      }    if (keyUsage != null)      {        boolean[] b = cert.getKeyUsage();        if (!Arrays.equals(b, keyUsage))          return false;      }    if (basicConstraints >= 0)      {        if (cert.getBasicConstraints() != basicConstraints)          return false;      }    if (keyPurposeSet != null)      {        List kp = null;        try          {            kp = cert.getExtendedKeyUsage();          }        catch (CertificateParsingException cpe)          {            return false;          }        if (kp == null)          return false;        for (Iterator it = keyPurposeSet.iterator(); it.hasNext(); )          {            if (!kp.contains(it.next()))              return false;          }      }    if (altNames != null)      {        Collection an = null;        try          {            an = cert.getSubjectAlternativeNames();          }        catch (CertificateParsingException cpe)          {            return false;          }        if (an == null)          return false;        int match = 0;        for (Iterator it = altNames.iterator(); it.hasNext(); )          {            List l = (List) it.next();            Integer id = (Integer) l.get(0);            String s = null;            byte[] b = null;            if (l.get(1) instanceof String)              s = (String) l.get(1);            else if (l.get(1) instanceof byte[])              b = (byte[]) l.get(1);            else              return false;            for (Iterator it2 = an.iterator(); it2.hasNext(); )              {                Object o = it2.next();                if (!(o instanceof List))                  continue;                List l2 = (List) o;                if (l2.size() != 2)                  continue;                if (!id.equals(l2.get(0)))                  continue;                if (s != null && (l2.get(1) instanceof String) &&                    s.equals(l2.get(1)))                  match++;                else if (b != null && (l2.get(1) instanceof byte[]) &&                         Arrays.equals(b, (byte[]) l2.get(1)))                  match++;              }            if (match == 0 || (matchAllNames && match != altNames.size()))              return false;          }      }    if (nameConstraints != null)      {        byte[] nc = cert.getExtensionValue(NAME_CONSTRAINTS_ID);        if (!Arrays.equals(nameConstraints, nc))          return false;      }    // FIXME check policies.    // FIXME check path-to-names.    return true;  }