Package org.jasypt.iv
Class ByteArrayFixedIvGenerator
- java.lang.Object
-
- org.jasypt.iv.ByteArrayFixedIvGenerator
-
- All Implemented Interfaces:
FixedIvGenerator,IvGenerator
public class ByteArrayFixedIvGenerator extends java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]iv
-
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.booleanincludePlainIvInEncryptionResults()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:
generateIvin 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:
includePlainIvInEncryptionResultsin interfaceIvGenerator- Returns:
- false
-
-