By default DidiSoft OpenPGP Library for Java uses ZIP compression when encrypting and signing data.
This can be changed through the method PGPLib.setCompression(compression). The supported options are listed in the CompressionAlgorithm interface:
CompressionAlgorithm.ZIP CompressionAlgorithm.ZLIB CompressionAlgorithm.BZIP2 CompressionAlgorithm.UNCOMPRESSED |
The change has effect on subsequent calls to the encryption methods only on the current instance of the PGPLib object. For each new instance the preferred compression should be set explicitly.
The example below shows how to set the compression to ZLib:
import com.didisoft.pgp.CompressionAlgorithm; import com.didisoft.pgp.PGPLib; public class SetCompressionDemo { public static void main(String[] args) throws Exception { PGPLib pgp = new PGPLib(); pgp.setCompression(CompressionAlgorithm.ZLIB); // each subsequent encryption will use ZLib } } |