javax.crypto.spec
Class DESedeKeySpec

java.lang.Object
  |
  +--javax.crypto.spec.DESedeKeySpec

public class DESedeKeySpec
extends java.lang.Object
implements KeySpec

DES-EDE key specification.


Attention:  This is not a SUN implementation!

This class has been developed by IAIK according to the documentation publically available.
For SUNīs documentation of this class see http://java.sun.com/security/JCE1.2/spec/apidoc/index.html


This class represents a DES-EDE (TRIPLE DES) key specification. A key specification is a transparent representation of the key material constituting the key.

See Also:
KeySpec

Field Summary
static int DES_EDE_KEY_LEN
           
 
Constructor Summary
DESedeKeySpec(byte[] key)
          Creates a DES-EDE key specification by using the first 24 bytes of the supplied byte array as the DES-EDE key.
DESedeKeySpec(byte[] key, int offset)
          Creates a DES-EDE key specification by using 24 bytes of the supplied byte array as DES-EDE key, beginning at the given offset.
 
Method Summary
 byte[] getKey()
          Returns the inherent DES-EDE key as byte representation.
static boolean isParityAdjusted(byte[] key, int offset)
          Checks if the DES-EDE key, supplied in a byte array beginning at the given offset, is parity-adjusted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DES_EDE_KEY_LEN

public static final int DES_EDE_KEY_LEN
Constructor Detail

DESedeKeySpec

public DESedeKeySpec(byte[] key)
              throws InvalidKeyException
Creates a DES-EDE key specification by using the first 24 bytes of the supplied byte array as the DES-EDE key.
Parameters:
key - the byte array holding the DES-EDE key
Throws:
InvalidKeyException - if the given key is shorter than 24 bytes

DESedeKeySpec

public DESedeKeySpec(byte[] key,
                     int offset)
              throws InvalidKeyException
Creates a DES-EDE key specification by using 24 bytes of the supplied byte array as DES-EDE key, beginning at the given offset.
Parameters:
key - the byte array holding the DES-EDE key
offset - the offset indicating the start position within the input key byte array
Throws:
InvalidKeyException - if the given key, beginning at offset, is shorter than 24 bytes
Method Detail

getKey

public byte[] getKey()
Returns the inherent DES-EDE key as byte representation.
Returns:
the DES-EDE key

isParityAdjusted

public static boolean isParityAdjusted(byte[] key,
                                       int offset)
                                throws InvalidKeyException
Checks if the DES-EDE key, supplied in a byte array beginning at the given offset, is parity-adjusted.
Parameters:
key - the byte array holding the DES-EDE key
offset - the offset indicating the start position within the input key byte array
Returns:
true if the given DES-EDE key is parity-adjusted, false otherwise
Throws:
InvalidKeyException - if the given key material, beginning at offset, is shorter than 24 bytes