Skip to content

Most visited

Recently visited

navigation
Added in API level 1

DESKeySpec

public class DESKeySpec
extends Object implements KeySpec

java.lang.Object
   ↳ javax.crypto.spec.DESKeySpec


The key specification for a DES key.

Summary

Constants

int DES_KEY_LEN

The length of a DES key in bytes.

Public constructors

DESKeySpec(byte[] key)

Creates a new DESKeySpec from the first 8 bytes of the specified key data.

DESKeySpec(byte[] key, int offset)

Creates a new DESKeySpec from the first 8 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.

static boolean isWeak(byte[] key, int offset)

Returns whether the specified key data starting at offset is weak or semi-weak.

Inherited methods

From class java.lang.Object

Constants

DES_KEY_LEN

Added in API level 1
int DES_KEY_LEN

The length of a DES key in bytes.

Constant Value: 8 (0x00000008)

Public constructors

DESKeySpec

Added in API level 1
DESKeySpec (byte[] key)

Creates a new DESKeySpec from the first 8 bytes of the specified key data.

Parameters
key byte: the key data.
Throws
InvalidKeyException if the length of the specified key data is less than 8.

DESKeySpec

Added in API level 1
DESKeySpec (byte[] key, 
                int offset)

Creates a new DESKeySpec from the first 8 bytes of the specified key data starting at offset.

Parameters
key byte: the key data
offset int: the offset to start at.
Throws
InvalidKeyException if the length of the specified key data starting at offset is less than 8.

Public methods

getKey

Added in API level 1
byte[] getKey ()

Returns a copy of the key.

Returns
byte[] a copy of the key.

isParityAdjusted

Added in API level 1
boolean isParityAdjusted (byte[] key, 
                int offset)

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

Parameters
key byte: the key data.
offset int: the offset to start checking at.
Returns
boolean 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 8, or the key is null.

isWeak

Added in API level 1
boolean isWeak (byte[] key, 
                int offset)

Returns whether the specified key data starting at offset is weak or semi-weak.

Parameters
key byte: the key data.
offset int: the offset to start checking at.
Returns
boolean true if the specified key data is weak or semi-weak.
Throws
InvalidKeyException if the length of the key data starting at offset is less than 8, or it is null.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.