to top
Android APIs
public class

DESedeKeySpec

extends Object
implements KeySpec
java.lang.Object
   ↳ javax.crypto.spec.DESedeKeySpec

Class Overview

The key specification for a triple-DES (DES-EDE) key.

Summary

Constants
int DES_EDE_KEY_LEN The length of a DES-EDE key in bytes.
Public Constructors
DESedeKeySpec(byte[] key)
Creates a new DESedeKeySpec instance from the first 24 ( DES_EDE_KEY_LEN) bytes of the specified key data.
DESedeKeySpec(byte[] key, int offset)
Creates a new DESedeKeySpec instance from the first 24 ( DES_EDE_KEY_LEN ) bytes of the specified key data starting at offset.
Public Methods
byte[] getKey()
Returns a copy of the key.
static boolean isParityAdjusted(byte[] key, int offset)
Returns whether the specified key data starting at offset is parity-adjusted.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DES_EDE_KEY_LEN

Since: API Level 1

The length of a DES-EDE key in bytes.

Constant Value: 24 (0x00000018)

Public Constructors

public DESedeKeySpec (byte[] key)

Since: API Level 1

Creates a new DESedeKeySpec instance from the first 24 ( DES_EDE_KEY_LEN) bytes of the specified key data.

Parameters
key the key data.
Throws
InvalidKeyException if the length of the key data is less than 24.
NullPointerException if the key data is null.

public DESedeKeySpec (byte[] key, int offset)

Since: API Level 1

Creates a new DESedeKeySpec instance from the first 24 ( DES_EDE_KEY_LEN ) bytes of the specified key data starting at offset.

Parameters
key the key data
offset the offset to start at.
Throws
InvalidKeyException if the length of the key data starting at offset is less than 24.
NullPointerException if the key data is null.

Public Methods

public byte[] getKey ()

Since: API Level 1

Returns a copy of the key.

Returns
  • a copy of the key.

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

Since: API Level 1

Returns whether the specified key data starting at offset is parity-adjusted.

Parameters
key the key data.
offset the offset to start checking at.
Returns
  • true if the specified key data is parity-adjusted, false otherwise.
Throws
InvalidKeyException if the length of the key data starting at offset is less than 24.