String provider)
throws OCSPException, NoSuchProviderException
{
List certs = new ArrayList();
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream aOut = new ASN1OutputStream(bOut);
CertificateFactory cf;
try
{
cf = CertificateFactory.getInstance("X.509", provider);
}
catch (CertificateException ex)
{
throw new OCSPException("can't get certificate factory.", ex);
}
//
// load the certificates if we have any
//
ASN1Sequence s = req.getOptionalSignature().getCerts();
if (s != null)
{
Enumeration e = s.getObjects();
while (e.hasMoreElements())
{
try
{
aOut.writeObject(e.nextElement());
certs.add(cf.generateCertificate(
new ByteArrayInputStream(bOut.toByteArray())));
}
catch (IOException ex)