out.close();
CMSEnvelopedDataParser ep = new CMSEnvelopedDataParser(bOut.toByteArray());
RecipientInformationStore recipients = ep.getRecipientInfos();
assertEquals(ep.getEncryptionAlgOID(), CMSEnvelopedDataGenerator.AES128_CBC);
RecipientId recSel = new RecipientId();
recSel.setIssuer(PrincipalUtil.getIssuerX509Principal(_reciEcCert).getEncoded());
recSel.setSerialNumber(_reciEcCert.getSerialNumber());
RecipientInformation recipient = recipients.get(recSel);
CMSTypedStream recData = recipient.getContentStream(_reciEcKP.getPrivate(), "BC");
assertEquals(true, Arrays.equals(data, CMSTestUtil.streamToByteArray(recData.getContentStream())));