checkDistributionPoints(profile);
X500Name name = new X500Name(issuer.getName());
IssuerAndSerialNumber iasn = new IssuerAndSerialNumber(name, serial);
Transport transport = createTransport(profile);
final Transaction t = new NonEnrollmentTransaction(transport,
getEncoder(identity, key, profile), getDecoder(identity, key,
profile), iasn, MessageType.GET_CRL);
State state;
try {
state = t.send();
} catch (TransactionException e) {
throw new ClientException(e);
}
if (state == State.CERT_ISSUED) {
try {
Collection<X509CRL> crls = (Collection<X509CRL>) t
.getCertStore().getCRLs(null);
if (crls.size() == 0) {
return null;
}
return crls.iterator().next();
} catch (CertStoreException e) {
throw new RuntimeException(e);
}
} else if (state == State.CERT_REQ_PENDING) {
throw new IllegalStateException();
} else {
throw new OperationFailureException(t.getFailInfo());
}
}