de.flexiprovider.core.desede
Class DESedeKeySpec
java.lang.Object
|
+--de.flexiprovider.core.desede.DESedeKeySpec
- All Implemented Interfaces:
- KeySpec, java.security.spec.KeySpec
- public class DESedeKeySpec
- extends java.lang.Object
- implements KeySpec
This class specifies a DES-EDE ("triple-DES") key.
|
Field Summary |
static int |
DES_EDE_KEY_LEN
The length of a DESede key in bytes. |
javax.crypto.spec.DESedeKeySpec |
javaKeySpec
A reference to a DESedeKeySpec. |
|
Constructor Summary |
DESedeKeySpec(byte[] key)
Uses the first 24 bytes in key as the key material for the DESede key. |
DESedeKeySpec(byte[] key,
int offset)
Uses the first 24 bytes in key, beginning at offset inclusive, as the key
material for the DESede key. |
DESedeKeySpec(javax.crypto.spec.DESedeKeySpec keySpec)
Create a new DESedeKeySpec out of the given
DESedeKeySpec. |
|
Method Summary |
byte[] |
getKey()
|
static boolean |
isParityAdjusted(byte[] key,
int offset)
Checks if the given DESede key material, starting at offset inclusive, is
parity-adjusted. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DES_EDE_KEY_LEN
public static final int DES_EDE_KEY_LEN
- The length of a DESede key in bytes.
javaKeySpec
public javax.crypto.spec.DESedeKeySpec javaKeySpec
- A reference to a
DESedeKeySpec.
DESedeKeySpec
public DESedeKeySpec(javax.crypto.spec.DESedeKeySpec keySpec)
- Create a new DESedeKeySpec out of the given
DESedeKeySpec.
- Parameters:
keySpec - the DSAPrivateKeySpec
DESedeKeySpec
public DESedeKeySpec(byte[] key)
throws InvalidKeyException
- Uses the first 24 bytes in key as the key material for the DESede key.
The key bytes are those between key[0] and key[23] inclusive.
- Parameters:
key - the buffer with the DESede key material- Throws:
InvalidKeyException - if the given key material is shorter than 24 bytes.
DESedeKeySpec
public DESedeKeySpec(byte[] key,
int offset)
throws InvalidKeyException
- Uses the first 24 bytes in key, beginning at offset inclusive, as the key
material for the DESede key. The key bytes are those between key[offset]
and key[offset+23] inclusive.
- Parameters:
key - the buffer with the DESede key materialoffset - the offset where the DESede key material starts- Throws:
InvalidKeyException - if the given key material, starting at offset inclusive, is
shorter than 24 bytes.
getKey
public byte[] getKey()
- Returns:
- the DESede key material
isParityAdjusted
public static boolean isParityAdjusted(byte[] key,
int offset)
throws InvalidKeyException
- Checks if the given DESede key material, starting at offset inclusive, is
parity-adjusted.
- Parameters:
key - the buffer with the DESede key materialoffset - the offset in key, where the DESede key material starts- Returns:
- true if the given DESede key material is parity-adjusted, false
otherwise
- Throws:
InvalidKeyException - if the given key material, starting at offset inclusive, is
shorter than 24 bytes.