this.encryptedOsWrapper = literalDataGenerator.open( compressedDataGenerator.open(pgpBosWrapper), PGPLiteralData.BINARY, fileName,
try (OutputStream compressedOut = compressedDataGenerator.open(encryptedOut, new byte[BUFFER_SIZE])) { PGPLiteralDataGenerator literalDataGenerator = new PGPLiteralDataGenerator(); try (OutputStream literalOut = literalDataGenerator.open(compressedOut, PGPLiteralData.BINARY, filename, new Date(), new byte[BUFFER_SIZE])) {
try (OutputStream compressedOut = compressedDataGenerator.open(encryptedOut, new byte[BUFFER_SIZE])) { PGPLiteralDataGenerator literalDataGenerator = new PGPLiteralDataGenerator(); try (OutputStream literalOut = literalDataGenerator.open(compressedOut, PGPLiteralData.BINARY, filename, new Date(), new byte[BUFFER_SIZE])) {
static byte[] compressFile(String fileName, int algorithm) throws IOException { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator(algorithm); PGPUtil.writeFileToLiteralData(comData.open(bOut), PGPLiteralData.BINARY, new File(fileName)); comData.close(); return bOut.toByteArray(); }
/** * Wraps with stream that outputs compressed data packet. */ protected OutputStream compress(OutputStream out, FileMetadata meta) throws IOException, PGPException { log.trace("using compression algorithm {} - {}", compressionAlgorithm, compressionLevel); if (compressionAlgorithm == CompressionAlgorithm.Uncompressed || compressionLevel < 1 || compressionLevel > 9) return null; int algo = compressionAlgorithm.ordinal(); int level = compressionLevel; byte[] buf = getCompressionBuffer(meta); return new PGPCompressedDataGenerator(algo, level).open(out, buf); }
PGPUtil.writeFileToLiteralData(comData.open(bOut), PGPLiteralData.BINARY, new File(fileName));
PGPUtil.writeFileToLiteralData(comData.open(bOut), PGPLiteralData.BINARY, new File(fileName));
ByteArrayOutputStream bOut = new ByteArrayOutputStream(); PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator(PGPCompressedDataGenerator.ZIP); writeStringToLiteralData(comData.open(bOut), inString); comData.close();
OutputStream compressedData = comData.open(encryptedOut);
bOut = new BCPGOutputStream(cGen.open(out));
try (OutputStream compressedOut = compressedDataGenerator.open(encryptedOut, new byte[BUFFER_SIZE])) { PGPLiteralDataGenerator literalDataGenerator = new PGPLiteralDataGenerator(); try (OutputStream literalOut = literalDataGenerator.open(compressedOut, PGPLiteralData.BINARY, filename, new Date(), new byte[BUFFER_SIZE])) {
writeBytesToLiteralData(comData.open(bOut), PGPLiteralData.BINARY, name, bytes); } finally {
OutputStream cos = comData.open(bOut); // compressed output stream PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator(); OutputStream pOut = lData.open(cos,
@Override public InputStream process(InputStream data) throws Exception { if (pgpOutputMode == ARMOR) { result = new ArmoredOutputStream(outputStream); } else { result = outputStream; } BcPGPDataEncryptorBuilder encryptorBuilder = new BcPGPDataEncryptorBuilder(algorithm); PGPEncryptedDataGenerator encrDataGen = new PGPEncryptedDataGenerator(encryptorBuilder, false); BcPublicKeyKeyEncryptionMethodGenerator methodGenerator = new BcPublicKeyKeyEncryptionMethodGenerator(this.publicKey); encrDataGen.addMethod(methodGenerator); encryptedOutputStream = encrDataGen.open(result, new byte[1 << 16]); PGPCompressedDataGenerator comprDataGen = new PGPCompressedDataGenerator(PGPCompressedData.ZIP); compressedEncryptedOutputStream = comprDataGen.open(encryptedOutputStream, new byte[1 << 16]); PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator(); pgpOutputStream = lData.open(compressedEncryptedOutputStream, PGPLiteralData.BINARY, "stream", new Date(), new byte[1 << 16]); write(data); return new ByteArrayInputStream(outputStream.toByteArray()); }
if (withCompressedDataPacket) { PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator(findCompressionAlgorithm(exchange)); comOut = new BufferedOutputStream(comData.open(encOut)); } else { comOut = encOut;
compressedOut = compressor.open(encryptedOut); literalOut = literalGen.open(compressedOut, PGPLiteralDataGenerator.UTF8, payloadFilename, new Date(), new byte[BUFFER_SIZE]);
try (OutputStream compressedOut = compressedDataGenerator.open(encryptedOut, new byte[BUFFER_SIZE])) { PGPLiteralDataGenerator literalDataGenerator = new PGPLiteralDataGenerator(); try (OutputStream literalOut = literalDataGenerator.open(compressedOut, PGPLiteralData.BINARY, filename, new Date(), new byte[BUFFER_SIZE])) {
ByteArrayOutputStream bOut = new ByteArrayOutputStream(); PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator(PGPCompressedDataGenerator.ZIP); OutputStream cos = comData.open(bOut); PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator(); OutputStream pOut = lData.open(cos, PGPLiteralData.BINARY, PGPLiteralData.CONSOLE, clearData.length, new Date());
PGPCompressedData.ZLIB); BCPGOutputStream bOut = new BCPGOutputStream(cGen.open(out));
algorithmSuite.getCompressionEncryptionAlgorithmCode().getAlgorithmId()); compressionStream = new BCPGOutputStream( compressionStreamGenerator.open(outerEncryptionStream));