{
byte[] data = "WallaWallaWashington".getBytes();
SecretKey kek1 = CMSTestUtil.makeAES192Key();
SecretKey kek2 = CMSTestUtil.makeAES192Key();
CMSEnvelopedDataStreamGenerator edGen = new CMSEnvelopedDataStreamGenerator();
byte[] kekId1 = new byte[] { 1, 2, 3, 4, 5 };
byte[] kekId2 = new byte[] { 5, 4, 3, 2, 1 };
edGen.addKEKRecipient(kek1, kekId1);
edGen.addKEKRecipient(kek2, kekId2);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
OutputStream out = edGen.open(
bOut,
CMSEnvelopedDataGenerator.DES_EDE3_CBC, "BC");
out.write(data);
out.close();