Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/javax/crypto/spec/IvParameterSpec#pubctors) \| [Methods](https://developer.android.com/reference/javax/crypto/spec/IvParameterSpec#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/javax/crypto/spec/IvParameterSpec#inhmethods)

# IvParameterSpec

` public class IvParameterSpec `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/security/spec/AlgorithmParameterSpec `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | javax.crypto.spec.IvParameterSpec |

<br />

*** ** * ** ***

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.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/javax/crypto/spec/IvParameterSpec#IvParameterSpec(byte[])(byte[] iv) ` Creates an IvParameterSpec object using the bytes in `iv` as the IV. |
| ` https://developer.android.com/reference/javax/crypto/spec/IvParameterSpec#IvParameterSpec(byte[],%20int,%20int)(byte[] iv, int offset, int len) ` Creates an IvParameterSpec object using the first `len` bytes in `iv`, beginning at `offset` inclusive, as the IV. |

| ### Public methods ||
|---|---|
| ` byte[]` | ` https://developer.android.com/reference/javax/crypto/spec/IvParameterSpec#getIV()() ` Returns the initialization vector (IV). |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(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.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(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` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### IvParameterSpec

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public IvParameterSpec (byte[] iv)
```

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

<br />

| Parameters ||
|---|---|
| `iv` | `byte`: the buffer with the IV. The contents of the buffer are copied to protect against subsequent modification. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `iv` is `null` |

### IvParameterSpec

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| 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. <br /> |
| `offset` | `int`: the offset in `iv` where the IV starts. <br /> |
| `len` | `int`: the number of IV bytes. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | is thrown if `offset` or `len` index bytes outside the `iv`. |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `iv` is `null` or `(iv.length - offset < len)` |

## Public methods

### getIV

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public byte[] getIV ()
```

Returns the initialization vector (IV).

<br />

| Returns ||
|---|---|
| `byte[]` | the initialization vector (IV). Returns a new array each time this method is called. <br /> |