Interface IvGenerator
- All Known Subinterfaces:
FixedIvGenerator
- All Known Implementing Classes:
ByteArrayFixedIvGenerator
,NoIvGenerator
,RandomIvGenerator
,StringFixedIvGenerator
Common interface for all initialization vector (IV) generators which can be applied in encryption operations.
Every implementation of this interface must be thread-safe.
- Since:
- 1.9.3
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
generateIv
(int lengthBytes) This method will be called for requesting the generation of a new IV of the specified length.boolean
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 Details
-
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.
-