public interface IvGenerator
Common interface for all initialization vector (IV) generators which can be applied in encryption operations.
Every implementation of this interface must be thread-safe.
Modifier and Type | Method and 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.
|
byte[] generateIv(int lengthBytes)
This method will be called for requesting the generation of a new IV of the specified length.
lengthBytes
- the requested length for the IV.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).
Copyright © 2019 The JASYPT team. All rights reserved.