Class JcePGPDataEncryptorBuilder

    • Method Detail

      • setWithIntegrityPacket

        public JcePGPDataEncryptorBuilder setWithIntegrityPacket​(boolean withIntegrityPacket)
        Sets whether or not the resulting encrypted data will be protected using an integrity packet.
        Specified by:
        setWithIntegrityPacket in interface PGPDataEncryptorBuilder
        Parameters:
        withIntegrityPacket - true if an integrity packet is to be included, false otherwise.
        Returns:
        the current builder.
      • setProvider

        public JcePGPDataEncryptorBuilder setProvider​(Provider provider)
        Sets the JCE provider to source cryptographic primitives from.
        Parameters:
        provider - the JCE provider to use.
        Returns:
        the current builder.
      • setProvider

        public JcePGPDataEncryptorBuilder setProvider​(String providerName)
        Sets the JCE provider to source cryptographic primitives from.
        Parameters:
        providerName - the name of the JCE provider to use.
        Returns:
        the current builder.
      • setSecureRandom

        public JcePGPDataEncryptorBuilder setSecureRandom​(SecureRandom random)
        Provide a user defined source of randomness.

        If no SecureRandom is configured, a default SecureRandom will be used.

        Parameters:
        random - the secure random to be used.
        Returns:
        the current builder.
      • build

        public PGPDataEncryptor build​(byte[] keyBytes)
                               throws PGPException
        Description copied from interface: PGPDataEncryptorBuilder
        Builds a data encryptor using the algorithm configured for this builder.
        Specified by:
        build in interface PGPDataEncryptorBuilder
        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.