APIdia Launch Partner
Top Description Fields Constructors Methods
javax.crypto.spec

public Class IvParameterSpec

extends Object
implements AlgorithmParameterSpec
Class Inheritance
All Implemented Interfaces
java.security.spec.AlgorithmParameterSpec
Imports
java.security.spec.AlgorithmParameterSpec

This class specifies an initialization vector (IV). Examples which use IVs are ciphers in feedback mode, e.g., DES in CBC mode and RSA ciphers with OAEP encoding operation.
Author
Jan Luehe
Since
1.4

Field Summary

Modifier and TypeField and Description
private final byte[]

Constructor Summary

AccessConstructor and Description
public
IvParameterSpec(byte[]
the buffer with the IV. The contents of the buffer are copied to protect against subsequent modification.
iv
)

Creates an IvParameterSpec object using the bytes in iv as the IV.

public
IvParameterSpec(byte[]
the buffer with the IV. The first len bytes of the buffer beginning at offset inclusive are copied to protect against subsequent modification.
iv
,
int
the offset in iv where the IV starts.
offset
,
int
the number of IV bytes.
len
)

Creates an IvParameterSpec object using the first len bytes in iv, beginning at offset inclusive, as the IV.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

the initialization vector (IV). Returns a new array each time this method is called.
getIV
()

Returns the initialization vector (IV).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ivback to summary
private final byte[] iv

Constructor Detail

IvParameterSpecback to summary
public IvParameterSpec(byte[] iv)

Creates an IvParameterSpec object using the bytes in iv as the IV.

Parameters
iv:byte[]

the buffer with the IV. The contents of the buffer are copied to protect against subsequent modification.

Exceptions
NullPointerException:
if iv is null
IvParameterSpecback to summary
public IvParameterSpec(byte[] iv, int offset, int len)

Creates an IvParameterSpec object using the first len bytes in iv, beginning at offset inclusive, as the IV.

The bytes that constitute the IV are those between iv[offset] and iv[offset+len-1] inclusive.

Parameters
iv:byte[]

the buffer with the IV. The first len bytes of the buffer beginning at offset inclusive are copied to protect against subsequent modification.

offset:int

the offset in iv where the IV starts.

len:int

the number of IV bytes.

Exceptions
IllegalArgumentException:
if iv is null or (iv.length - offset < len)
ArrayIndexOutOfBoundsException:
if offset or len are negative.

Method Detail

getIVback to summary
public byte[] getIV()

Returns the initialization vector (IV).

Returns:byte[]

the initialization vector (IV). Returns a new array each time this method is called.