Class IvParameterSpec
java.lang.Object
javax.crypto.spec.IvParameterSpec
- All Implemented Interfaces:
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.
- Since:
- 1.4
-
Constructor Summary
ConstructorsConstructorDescriptionIvParameterSpec
(byte[] iv) Creates an IvParameterSpec object using the bytes iniv
as the IV.IvParameterSpec
(byte[] iv, int offset, int len) Creates an IvParameterSpec object using the firstlen
bytes iniv
, beginning atoffset
inclusive, as the IV. -
Method Summary
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.toString()
Returns a string representation of the object.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Constructor Details
-
IvParameterSpec
public IvParameterSpec(byte[] iv) Creates an IvParameterSpec object using the bytes iniv
as the IV.- Parameters:
iv
- the buffer with the IV. The contents of the buffer are copied to protect against subsequent modification.- Throws:
NullPointerException
- ifiv
isnull
-
IvParameterSpec
public IvParameterSpec(byte[] iv, int offset, int len) Creates an IvParameterSpec object using the firstlen
bytes iniv
, beginning atoffset
inclusive, as the IV.The bytes that constitute the IV are those between
iv[offset]
andiv[offset+len-1]
inclusive.- Parameters:
iv
- the buffer with the IV. The firstlen
bytes of the buffer beginning atoffset
inclusive are copied to protect against subsequent modification.offset
- the offset iniv
where the IV starts.len
- the number of IV bytes.- Throws:
IllegalArgumentException
- ifiv
isnull
or(iv.length - offset < len)
ArrayIndexOutOfBoundsException
- ifoffset
orlen
are negative.
-
-
Method Details
-
getIV
public byte[] getIV()Returns the initialization vector (IV).- Returns:
- the initialization vector (IV). Returns a new array each time this method is called.
-