while (e.hasMoreElements())
{
outStream = new ByteArrayOutputStream();
derOutStream = new DEROutputStream(outStream);
derOutStream.writeObject(e.nextElement());
derOutStream.close();
certInStream = new ByteArrayInputStream(outStream.toByteArray());
certificates.add(0,certFactory.generateCertificate(certInStream));
}