# DESedeKeySpec

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

# DESedeKeySpec

`
public


class
DESedeKeySpec
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[KeySpec](https://developer.android.com/reference/java/security/spec/KeySpec)`


`

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

<br />

*** ** * ** ***

This class specifies a DES-EDE ("triple-DES") key.

## Summary

|                                                                                   ### Constants                                                                                   ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [DES_EDE_KEY_LEN](https://developer.android.com/reference/javax/crypto/spec/DESedeKeySpec#DES_EDE_KEY_LEN) The constant which defines the length of a DESede key in bytes. |

|                                                                                                                                     ### Public constructors                                                                                                                                     ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[DESedeKeySpec](https://developer.android.com/reference/javax/crypto/spec/DESedeKeySpec#DESedeKeySpec(byte[]))`(byte[] key) ` Creates a DESedeKeySpec object using the first 24 bytes in`key`as the key material for the DES-EDE key.                                                     |
| ` `[DESedeKeySpec](https://developer.android.com/reference/javax/crypto/spec/DESedeKeySpec#DESedeKeySpec(byte[],%20int))`(byte[] key, int offset) ` Creates a DESedeKeySpec object using the first 24 bytes in`key`, beginning at`offset`inclusive, as the key material for the DES-EDE key. |

|                                                                                                                       ### Public methods                                                                                                                        ||
|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` byte[]`         | ` `[getKey](https://developer.android.com/reference/javax/crypto/spec/DESedeKeySpec#getKey())`() ` Returns the DES-EDE key.                                                                                                                  |
| ` static boolean` | ` `[isParityAdjusted](https://developer.android.com/reference/javax/crypto/spec/DESedeKeySpec#isParityAdjusted(byte[],%20int))`(byte[] key, int offset) ` Checks if the given DES-EDE key, starting at`offset`inclusive, is parity-adjusted. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||

## Constants

### DES_EDE_KEY_LEN

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

```
public static final int DES_EDE_KEY_LEN
```

The constant which defines the length of a DESede key in bytes.

<br />

Constant Value: 24 (0x00000018)

## Public constructors

### DESedeKeySpec

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

```
public DESedeKeySpec (byte[] key)
```

Creates a DESedeKeySpec object using the first 24 bytes in`key`as the key material for the DES-EDE key.

The bytes that constitute the DES-EDE key are those between`key[0]`and`key[23]`inclusive

<br />

|                                                                       Parameters                                                                        ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| `key` | `byte`: the buffer with the DES-EDE key material. The first 24 bytes of the buffer are copied to protect against subsequent modification. <br /> |

|                                                                        Throws                                                                         ||
|--------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)   | if`key`is null.                                     |
| [InvalidKeyException](https://developer.android.com/reference/java/security/InvalidKeyException) | if the given key material is shorter than 24 bytes. |

### DESedeKeySpec

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

```
public DESedeKeySpec (byte[] key, 
                int offset)
```

Creates a DESedeKeySpec object using the first 24 bytes in`key`, beginning at`offset`inclusive, as the key material for the DES-EDE key.

The bytes that constitute the DES-EDE key are those between`key[offset]`and`key[offset+23]`inclusive.

<br />

|                                                                                        Parameters                                                                                        ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `key`    | `byte`: the buffer with the DES-EDE key material. The first 24 bytes of the buffer beginning at`offset`inclusive are copied to protect against subsequent modification. <br /> |
| `offset` | `int`: the offset in`key`, where the DES-EDE key material starts. <br />                                                                                                       |

|                                                                                       Throws                                                                                        ||
|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)   | if`key`is null.                                                                   |
| [InvalidKeyException](https://developer.android.com/reference/java/security/InvalidKeyException) | if the given key material, starting at`offset`inclusive, is shorter than 24 bytes |

## Public methods

### getKey

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

```
public byte[] getKey ()
```

Returns the DES-EDE key.

<br />

|                                        Returns                                         ||
|----------|------------------------------------------------------------------------------|
| `byte[]` | the DES-EDE key. Returns a new array each time this method is called. <br /> |

### isParityAdjusted

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

```
public static boolean isParityAdjusted (byte[] key, 
                int offset)
```

Checks if the given DES-EDE key, starting at`offset`inclusive, is parity-adjusted.

<br />

|                           Parameters                            ||
|----------|-------------------------------------------------------|
| `key`    | `byte`: a byte array which holds the key value <br /> |
| `offset` | `int`: the offset into the byte array <br />          |

|                                       Returns                                       ||
|-----------|--------------------------------------------------------------------------|
| `boolean` | true if the given DES-EDE key is parity-adjusted, false otherwise <br /> |

|                                                                                       Throws                                                                                        ||
|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)   | if`key`is null.                                                                   |
| [InvalidKeyException](https://developer.android.com/reference/java/security/InvalidKeyException) | if the given key material, starting at`offset`inclusive, is shorter than 24 bytes |