APIdia Launch Partner
Top Description Fields Constructors Methods
javax.crypto.spec

public Class DESedeKeySpec

extends Object
implements KeySpec
Class Inheritance
All Implemented Interfaces
java.security.spec.KeySpec
Imports
java.security.InvalidKeyException

This class specifies a DES-EDE ("triple-DES") key.
Author
Jan Luehe
Since
1.4

Field Summary

Modifier and TypeField and Description
public static final int
DES_EDE_KEY_LEN

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

private final byte[]

Constructor Summary

AccessConstructor and Description
public
DESedeKeySpec(byte[]
the buffer with the DES-EDE key material. The first 24 bytes of the buffer are copied to protect against subsequent modification.
key
)

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

public
DESedeKeySpec(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.
key
,
int
the offset in key, where the DES-EDE key material starts.
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.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

the DES-EDE key. Returns a new array each time this method is called.
getKey
()

Returns the DES-EDE key.

public static boolean

Returns:

true if the given DES-EDE key is parity-adjusted, false otherwise
isParityAdjusted
(byte[]
a byte array which holds the key value
key
,
int
the offset into the byte array
offset
)

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DES_EDE_KEY_LENback to summary
public static final int DES_EDE_KEY_LEN

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

keyback to summary
private final byte[] key

Constructor Detail

DESedeKeySpecback to summary
public DESedeKeySpec(byte[] key) throws InvalidKeyException

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

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.

Exceptions
InvalidKeyException:
if the given key material is shorter than 24 bytes.
NullPointerException:
if key is null.
DESedeKeySpecback to summary
public DESedeKeySpec(byte[] key, int offset) throws InvalidKeyException

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.

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.

offset:int

the offset in key, where the DES-EDE key material starts.

Exceptions
InvalidKeyException:
if the given key material, starting at offset inclusive, is shorter than 24 bytes.
NullPointerException:
if key is null.
ArrayIndexOutOfBoundsException:
if offset is negative.

Method Detail

getKeyback to summary
public byte[] getKey()

Returns the DES-EDE key.

Returns:byte[]

the DES-EDE key. Returns a new array each time this method is called.

isParityAdjustedback to summary
public static boolean isParityAdjusted(byte[] key, int offset) throws InvalidKeyException

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

Parameters
key:byte[]

a byte array which holds the key value

offset:int

the offset into the byte array

Returns:boolean

true if the given DES-EDE key is parity-adjusted, false otherwise

Exceptions
InvalidKeyException:
if the given key material is null, or starting at offset inclusive, is shorter than 24 bytes.
ArrayIndexOutOfBoundsException:
if offset is negative.