CertificateFactory certFactory= CertificateFactory.getInstance( "X.509", "BC" );
while ( enumx.hasMoreElements() ) {
outStream = new ByteArrayOutputStream();
derOutStream = new DEROutputStream(outStream);
derOutStream.writeObject(enumx.nextElement());
derOutStream.close();
certInStream = new ByteArrayInputStream(outStream.toByteArray());
certificates.add(0,certFactory.generateCertificate(certInStream));
}