Package org.jasypt.iv
Class ByteArrayFixedIvGenerator
Object
org.jasypt.iv.ByteArrayFixedIvGenerator
- All Implemented Interfaces:
FixedIvGenerator
,IvGenerator
Byte-array based implementation of FixedIvGenerator
, that will
always return the same initialization vector (IV).
If the requested IV has a size in bytes smaller than the specified IV, the first n bytes are returned. If it is larger, an exception is thrown.
This class is thread-safe.
- Since:
- 1.9.3
- Author:
- Hoki Torres
-
Constructor Summary
ConstructorsConstructorDescriptionByteArrayFixedIvGenerator
(byte[] iv) Creates a new instance of FixedByteArrayIvGenerator -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
generateIv
(int lengthBytes) Return iv with the specified byte length.boolean
As this iv generator provides a fixed iv, its inclusion unencrypted in encryption results is not necessary, and in fact not desirable (so that it remains hidden).
-
Constructor Details
-
ByteArrayFixedIvGenerator
public ByteArrayFixedIvGenerator(byte[] iv) Creates a new instance of FixedByteArrayIvGenerator- Parameters:
iv
- the specified iv.
-
-
Method Details
-
generateIv
public byte[] generateIv(int lengthBytes) Return iv with the specified byte length.- Specified by:
generateIv
in interfaceIvGenerator
- Parameters:
lengthBytes
- length in bytes.- Returns:
- the generated iv.
-
includePlainIvInEncryptionResults
public boolean includePlainIvInEncryptionResults()As this iv generator provides a fixed iv, its inclusion unencrypted in encryption results is not necessary, and in fact not desirable (so that it remains hidden).- Specified by:
includePlainIvInEncryptionResults
in interfaceIvGenerator
- Returns:
- false
-