Added in API level 1

DESKeySpec

open class DESKeySpec : KeySpec
kotlin.Any
   ↳ javax.crypto.spec.DESKeySpec

This class specifies a DES key.

Summary

Constants
static Int

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

Public constructors

Creates a DESKeySpec object using the first 8 bytes in key as the key material for the DES key.

DESKeySpec(key: ByteArray!, offset: Int)

Creates a DESKeySpec object using the first 8 bytes in key, beginning at offset inclusive, as the key material for the DES key.

Public methods
open ByteArray!

Returns the DES key material.

open static Boolean
isParityAdjusted(key: ByteArray!, offset: Int)

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

open static Boolean
isWeak(key: ByteArray!, offset: Int)

Checks if the given DES key material is weak or semi-weak.

Constants

DES_KEY_LEN

Added in API level 1
static val DES_KEY_LEN: Int

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

Value: 8

Public constructors

DESKeySpec

Added in API level 1
DESKeySpec(key: ByteArray!)

Creates a DESKeySpec object using the first 8 bytes in key as the key material for the DES key.

The bytes that constitute the DES key are those between key[0] and key[7] inclusive.

Parameters
key ByteArray!: the buffer with the DES key material. The first 8 bytes of the buffer are copied to protect against subsequent modification.
Exceptions
java.lang.NullPointerException if the given key material is null
java.security.InvalidKeyException if the given key material is shorter than 8 bytes.

DESKeySpec

Added in API level 1
DESKeySpec(
    key: ByteArray!,
    offset: Int)

Creates a DESKeySpec object using the first 8 bytes in key, beginning at offset inclusive, as the key material for the DES key.

The bytes that constitute the DES key are those between key[offset] and key[offset+7] inclusive.

Parameters
key ByteArray!: the buffer with the DES key material. The first 8 bytes of the buffer beginning at offset inclusive are copied to protect against subsequent modification.
offset Int: the offset in key, where the DES key material starts.
Exceptions
java.lang.NullPointerException if the given key material is null
java.security.InvalidKeyException if the given key material, starting at offset inclusive, is shorter than 8 bytes.

Public methods

getKey

Added in API level 1
open fun getKey(): ByteArray!

Returns the DES key material.

Return
ByteArray! the DES key material. Returns a new array each time this method is called.

isParityAdjusted

Added in API level 1
open static fun isParityAdjusted(
    key: ByteArray!,
    offset: Int
): Boolean

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

Parameters
key ByteArray!: the buffer with the DES key material.
offset Int: the offset in key, where the DES key material starts.
Return
Boolean true if the given DES key material is parity-adjusted, false otherwise.
Exceptions
java.security.InvalidKeyException if the given key material is null, or starting at offset inclusive, is shorter than 8 bytes.

isWeak

Added in API level 1
open static fun isWeak(
    key: ByteArray!,
    offset: Int
): Boolean

Checks if the given DES key material is weak or semi-weak.

Parameters
key ByteArray!: the buffer with the DES key material.
offset Int: the offset in key, where the DES key material starts.
Return
Boolean true if the given DES key material is weak or semi-weak, false otherwise.
Exceptions
java.security.InvalidKeyException if the given key material is null, or starting at offset inclusive, is shorter than 8 bytes.