Package org.jasypt.iv
Class StringFixedIvGenerator
Object
org.jasypt.iv.StringFixedIvGenerator
- All Implemented Interfaces:
FixedIvGenerator
,IvGenerator
String based implementation of IvGenerator
, that will
always return the same initialization vector (IV). This IV is returned as bytes using the
specified charset for conversion (UTF-8 by default).
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
ConstructorsConstructorDescriptionCreates a new instance of StringFixedIvGenerator using the default charset.StringFixedIvGenerator
(String iv, String charset) Creates a new instance of StringFixedIvGenerator -
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
-
StringFixedIvGenerator
Creates a new instance of StringFixedIvGenerator using the default charset.- Parameters:
iv
- the specified IV.
-
StringFixedIvGenerator
Creates a new instance of StringFixedIvGenerator- Parameters:
iv
- the specified IV.charset
- the specified charset
-
-
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
-