public class StringFixedIvGenerator extends Object implements FixedIvGenerator
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.
Constructor and Description |
---|
StringFixedIvGenerator(String iv)
Creates a new instance of StringFixedIvGenerator using
the default charset.
|
StringFixedIvGenerator(String iv,
String charset)
Creates a new instance of StringFixedIvGenerator
|
Modifier and Type | Method and 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).
|
public StringFixedIvGenerator(String iv)
iv
- the specified IV.public byte[] generateIv(int lengthBytes)
generateIv
in interface IvGenerator
lengthBytes
- length in bytes.public boolean includePlainIvInEncryptionResults()
includePlainIvInEncryptionResults
in interface IvGenerator
Copyright © 2021 JBoss by Red Hat. All rights reserved.