}
//
// unbuffered
//
CMSEnvelopedDataStreamGenerator edGen = new CMSEnvelopedDataStreamGenerator();
edGen.addKeyTransRecipient(_reciCert);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
OutputStream out = edGen.open(
bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
for (int i = 0; i != 2000; i++)
{
out.write(data[i]);
}
out.close();
verifyData(bOut, CMSEnvelopedDataGenerator.AES128_CBC, data);
int unbufferedLength = bOut.toByteArray().length;
//
// Using buffered output - should be == to unbuffered
//
edGen = new CMSEnvelopedDataStreamGenerator();
edGen.addKeyTransRecipient(_reciCert);
bOut = new ByteArrayOutputStream();
out = edGen.open(bOut, CMSEnvelopedDataGenerator.AES128_CBC, "BC");
BufferedOutputStream bfOut = new BufferedOutputStream(out, 300);
for (int i = 0; i != 2000; i++)
{