SscdFilter extends CertificateFilter { @Override public boolean matches(final X509Certificate cert) { if (cert == null) { return false; } final byte [] qcStatementsValue = cert.getExtensionValue(QC_STATEMENTS_OID); if (qcStatementsValue == null) { return false; } final QCStatements qcs; try { final DEROctetString qcsRaw = (DEROctetString) ASN1Primitive.fromByteArray(qcStatementsValue); final ASN1Sequence seq = (ASN1Sequence) ASN1Primitive.fromByteArray( qcsRaw.getOctets() ); qcs = QCStatements.getInstance(seq); } catch (final IOException e) { return false; } final List<QCStatement> qcss = qcs.getQCStatement(); for (final QCStatement qc : qcss) { if (QC_SSCD_OID.equals(qc.getStatementId())) { return true; } } return false; }  @Override boolean matches(final X509Certificate cert);  }
@SuppressWarnings("static-method") @Test public void testFilter() throws Exception { final X509Certificate cert = (X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate( ClassLoader.getSystemResourceAsStream("Tomas_DNI_FIRMA.cer") ); Assert.assertTrue( new SscdFilter().matches(cert) ); }