Class PGPEncryptedDataGenerator

  • All Implemented Interfaces:
    SymmetricKeyAlgorithmTags

    public class PGPEncryptedDataGenerator
    extends java.lang.Object
    implements SymmetricKeyAlgorithmTags
    Generator for encrypted objects.

    A PGPEncryptedDataGenerator is used by configuring one or more encryption methods, and then invoking one of the open functions to create an OutputStream that raw data can be supplied to for encryption:

    If the length of the data to be written is known in advance, use open(OutputStream, long) to create a packet containing a single encrypted object.
  • If the length of the data is unknown, use open(OutputStream, byte[]) to create an packet consisting of a series of encrypted objects (partials).

Raw data is not typically written directly to the OutputStream obtained from a PGPEncryptedDataGenerator. The OutputStream is usually wrapped by a PGPLiteralDataGenerator, and often with a PGPCompressedDataGenerator between.

Once plaintext data for encryption has been written to the constructed OutputStream, writing of the encrypted object stream is completed by closing the OutputStream obtained from the open() method, or equivalently invoking close() on this generator.