PGPDataEncryptorBuilder
Date: 2016-06-23

org.bouncycastle.openpgp.operator

## Interface PGPDataEncryptorBuilder

- All Known Implementing Classes:
    BcPGPDataEncryptorBuilder, JcePGPDataEncryptorBuilder

      public interface PGPDataEncryptorBuilder

  A builder for `PGPDataEncryptor` instances, which can be used to encrypt data objects.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PGPDataEncryptor` | `build(byte[] keyBytes)` Builds a data encryptor using the algorithm configured for this builder.
    `int` | `getAlgorithm()` The encryption algorithm used by data encryptors created by this builder.
    `java.security.SecureRandom` | `getSecureRandom()` Gets the SecureRandom instance used by this builder.

- - ### Method Detail

    - #### getAlgorithm

          int getAlgorithm()

      The encryption algorithm used by data encryptors created by this builder.
      Returns:
        one of the `symmetric encryption algorithms`.

    - #### build

          PGPDataEncryptor build(byte[] keyBytes)
                                 throws PGPException

      Builds a data encryptor using the algorithm configured for this builder.
      Parameters:
        `keyBytes` - the bytes of the key to use for the cipher.
      Returns:
        a data encryptor with an initialised cipher.
      Throws:
        `PGPException` - if an error occurs initialising the configured encryption.

    - #### getSecureRandom

          java.security.SecureRandom getSecureRandom()

      Gets the SecureRandom instance used by this builder.
      If a SecureRandom has not been explicitly configured, a default `SecureRandom` is constructed and retained by the this builder.