@Test @SuppressWarnings("static-method") public void testPolicyIdFilterMatch() throws Exception { final X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate( ClassLoader.getSystemResourceAsStream("Tomas_DNI_FIRMA.cer") ); Assert.assertTrue(new PolicyIdFilter(Collections.singletonList("2.16.724.1.2.2.2.3")).matches(cert)); Assert.assertFalse(new PolicyIdFilter(Collections.singletonList("2.16.724.1.2.2.2.5")).matches(cert)); }
@Override public boolean matches(final X509Certificate cert) { if (cert == null) { LOGGER.warning("El certificado proporcionado es nulo, se considera que no cumple el filtro"); return false; } final List<String> actualPolicies = getCertificatePolicyIds(cert); if (actualPolicies == null || actualPolicies.isEmpty()) { return false; } for (final String oid : actualPolicies) { if (!this.allowedOids.contains(oid)) { return false; } } return true; }
PolicyIdFilter extends CertificateFilter { @Override public boolean matches(final X509Certificate cert) { if (cert == null) { LOGGER.warning("El certificado proporcionado es nulo, se considera que no cumple el filtro"); return false; } final List<String> actualPolicies = getCertificatePolicyIds(cert); if (actualPolicies == null || actualPolicies.isEmpty()) { return false; } for (final String oid : actualPolicies) { if (!this.allowedOids.contains(oid)) { return false; } } return true; } }
PolicyIdFilter extends CertificateFilter { @Override public boolean matches(final X509Certificate cert) { if (cert == null) { LOGGER.warning("El certificado proporcionado es nulo, se considera que no cumple el filtro"); return false; } final List<String> actualPolicies = getCertificatePolicyIds(cert); if (actualPolicies == null || actualPolicies.isEmpty()) { return false; } for (final String oid : actualPolicies) { if (!this.allowedOids.contains(oid)) { return false; } } return true; } PolicyIdFilter(final String oids);  PolicyIdFilter(final List<String> oids); }
PolicyIdFilter extends CertificateFilter { @Override public boolean matches(final X509Certificate cert) { if (cert == null) { LOGGER.warning("El certificado proporcionado es nulo, se considera que no cumple el filtro"); return false; } final List<String> actualPolicies = getCertificatePolicyIds(cert); if (actualPolicies == null || actualPolicies.isEmpty()) { return false; } for (final String oid : actualPolicies) { if (!this.allowedOids.contains(oid)) { return false; } } return true; } PolicyIdFilter(final String oids);  PolicyIdFilter(final List<String> oids); @Override boolean matches(final X509Certificate cert); }
PolicyIdFilter extends CertificateFilter { @Override public boolean matches(final X509Certificate cert) { if (cert == null) { LOGGER.warning("El certificado proporcionado es nulo, se considera que no cumple el filtro"); return false; } final List<String> actualPolicies = getCertificatePolicyIds(cert); if (actualPolicies == null || actualPolicies.isEmpty()) { return false; } for (final String oid : actualPolicies) { if (!this.allowedOids.contains(oid)) { return false; } } return true; } PolicyIdFilter(final String oids);  PolicyIdFilter(final List<String> oids); @Override boolean matches(final X509Certificate cert); static final String OID_SEPARATOR; }