@Test public void testX509CertificateDoesNotMatch_Ok() throws Exception { X509CertificateSubjectRdnSelector certSelector = new X509CertificateSubjectRdnSelector("E=publications2@guardtime.com"); Assert.assertFalse(certSelector.match(X509CertUtil.toCert(TestUtil.loadBytes("server.crt")))); }
public boolean match(Certificate cert) { if (!(cert instanceof X509Certificate)) { return false; } if (rdnArray == null) { return true; } try { X500Name x500name = getX500SubjectName((X509Certificate) cert); boolean ok = true; for (RDN rdn : rdnArray) { AttributeTypeAndValue expectedTypeAndValue = rdn.getFirst(); ok = ok && contains(x500name, expectedTypeAndValue); } return ok; } catch (CertificateEncodingException e) { return false; } }
X509CertificateSubjectRdnSelector implements CertSelector { public boolean match(Certificate cert) { if (!(cert instanceof X509Certificate)) { return false; } if (rdnArray == null) { return true; } try { X500Name x500name = getX500SubjectName((X509Certificate) cert); boolean ok = true; for (RDN rdn : rdnArray) { AttributeTypeAndValue expectedTypeAndValue = rdn.getFirst(); ok = ok && contains(x500name, expectedTypeAndValue); } return ok; } catch (CertificateEncodingException e) { return false; } } }
X509CertificateSubjectRdnSelector implements CertSelector { public boolean match(Certificate cert) { if (!(cert instanceof X509Certificate)) { return false; } if (rdnArray == null) { return true; } try { X500Name x500name = getX500SubjectName((X509Certificate) cert); boolean ok = true; for (RDN rdn : rdnArray) { AttributeTypeAndValue expectedTypeAndValue = rdn.getFirst(); ok = ok && contains(x500name, expectedTypeAndValue); } return ok; } catch (CertificateEncodingException e) { return false; } } X509CertificateSubjectRdnSelector(String rdnString);  X509CertificateSubjectRdnSelector(RDN[] rdnArray); }
X509CertificateSubjectRdnSelector implements CertSelector { public boolean match(Certificate cert) { if (!(cert instanceof X509Certificate)) { return false; } if (rdnArray == null) { return true; } try { X500Name x500name = getX500SubjectName((X509Certificate) cert); boolean ok = true; for (RDN rdn : rdnArray) { AttributeTypeAndValue expectedTypeAndValue = rdn.getFirst(); ok = ok && contains(x500name, expectedTypeAndValue); } return ok; } catch (CertificateEncodingException e) { return false; } } X509CertificateSubjectRdnSelector(String rdnString);  X509CertificateSubjectRdnSelector(RDN[] rdnArray); boolean match(Certificate cert); Object clone(); }
X509CertificateSubjectRdnSelector implements CertSelector { public boolean match(Certificate cert) { if (!(cert instanceof X509Certificate)) { return false; } if (rdnArray == null) { return true; } try { X500Name x500name = getX500SubjectName((X509Certificate) cert); boolean ok = true; for (RDN rdn : rdnArray) { AttributeTypeAndValue expectedTypeAndValue = rdn.getFirst(); ok = ok && contains(x500name, expectedTypeAndValue); } return ok; } catch (CertificateEncodingException e) { return false; } } X509CertificateSubjectRdnSelector(String rdnString);  X509CertificateSubjectRdnSelector(RDN[] rdnArray); boolean match(Certificate cert); Object clone();  }