Package org.jasypt.iv

Interface IvGenerator

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      byte[] generateIv​(int lengthBytes)
      This method will be called for requesting the generation of a new IV of the specified length.
      boolean includePlainIvInEncryptionResults()
      Determines if the encrypted messages created with a specific IV generator will include (prepended) the unencrypted IV itself, so that it can be used for decryption operations.
    • Method Detail

      • generateIv

        byte[] generateIv​(int lengthBytes)

        This method will be called for requesting the generation of a new IV of the specified length.

        Parameters:
        lengthBytes - the requested length for the IV.
        Returns:
        the generated IV.
      • includePlainIvInEncryptionResults

        boolean includePlainIvInEncryptionResults()

        Determines if the encrypted messages created with a specific IV generator will include (prepended) the unencrypted IV itself, so that it can be used for decryption operations.

        Generally, including the IV unencrypted in encryption results will be mandatory for randomly generated IV, or for those generated in a non-predictable manner. Otherwise, decryption operations will always fail. For fixed IV, inclusion will be optional (and in fact undesirable if we want to hide the IV value).

        Returns:
        whether the plain (unencrypted) IV has to be included in encryption results or not.