public static void encrypt(final InputStream is, OutputStream os, X509Certificate cert) throws Exception {
final InputStream bis = new BufferedInputStream(is, bufferSize);
final OutputStream bos = new BufferedOutputStream(os, bufferSize);
final CMSEnvelopedDataStreamGenerator edGen = new CMSEnvelopedDataStreamGenerator();
edGen.addKeyTransRecipient(cert.getPublicKey(), "hej".getBytes() );
final OutputStream out = edGen.open(bos, CMSEnvelopedGenerator.AES128_CBC, "BC");
fromInToOut(bis, out);
bos.close();
os.close();
}
/**