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.
Constructor and Description |
---|
ByteArrayFixedIvGenerator(byte[] iv)
Creates a new instance of FixedByteArrayIvGenerator
|
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 ByteArrayFixedIvGenerator(byte[] 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.