String[] attrs = {params.getCertificateRevocationListAttribute()};
if (!(selector instanceof X509CRLSelector))
{
throw new CertStoreException("selector is not a X509CRLSelector");
}
X509CRLSelector xselector = (X509CRLSelector)selector;
Set crlSet = new HashSet();
String attrName = params.getLdapCertificateRevocationListAttributeName();
Set set = new HashSet();
if (xselector.getIssuerNames() != null)
{
for (Iterator it = xselector.getIssuerNames().iterator(); it
.hasNext();)
{
Object o = it.next();
String attrValue = null;
if (o instanceof String)
{
String issuerAttributeName = params
.getCertificateRevocationListIssuerAttributeName();
attrValue = parseDN((String)o, issuerAttributeName);
}
else
{
String issuerAttributeName = params
.getCertificateRevocationListIssuerAttributeName();
attrValue = parseDN(new X500Principal((byte[])o)
.getName("RFC1779"), issuerAttributeName);
}
set.addAll(search(attrName, "*" + attrValue + "*", attrs));
}
}
else
{
set.addAll(search(attrName, "*", attrs));
}
set.addAll(search(null, "*", attrs));
Iterator it = set.iterator();
try
{
CertificateFactory cf = CertificateFactory.getInstance("X.509",
BouncyCastleProvider.PROVIDER_NAME);
while (it.hasNext())
{
CRL crl = cf.generateCRL(new ByteArrayInputStream((byte[])it
.next()));
if (xselector.match(crl))
{
crlSet.add(crl);
}
}
}