Package org.jasypt.iv
Class ByteArrayFixedIvGenerator
- Object
-
- org.jasypt.iv.ByteArrayFixedIvGenerator
-
- All Implemented Interfaces:
FixedIvGenerator
,IvGenerator
public class ByteArrayFixedIvGenerator extends Object implements FixedIvGenerator
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
Constructors Constructor Description ByteArrayFixedIvGenerator(byte[] iv)
Creates a new instance of FixedByteArrayIvGenerator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
generateIv(int lengthBytes)
Return iv with the specified byte length.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).
-
-
-
Method Detail
-
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
-
-