SymmetricKeyAlgorithm algorithm) throws IOException, CryptoException {
try {
ByteArrayOutputStream encOut = new ByteArrayOutputStream();
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator(PGPCompressedDataGenerator.ZIP);
OutputStream cos = comData.open(bOut); // open it with the final destination
PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator();
// we want to generate compressed data. This might be a user option later,
// in which case we would pass in bOut.
OutputStream pOut = lData.open(
cos, PGPLiteralData.BINARY, PGPLiteralData.CONSOLE, clearText.length, new Date());