public class DESedeKeySpec
extends Object implements KeySpec
| java.lang.Object | |
| javax.crypto.spec.DESedeKeySpec | |
该类指定了DES-EDE(“triple-DES”)密钥。
常量(Constants) |
|
|---|---|
int |
DES_EDE_KEY_LEN 以字节为单位定义DESede密钥长度的常量。 |
Public constructors |
|
|---|---|
DESedeKeySpec(byte[] key) 创建使用前24个字节在一个DESedeKeySpec对象, |
|
DESedeKeySpec(byte[] key, int offset) 创建使用前24个字节在一个DESedeKeySpec对象, |
|
公共方法(Public methods) |
|
|---|---|
byte[] |
getKey() 返回DES-EDE密钥。 |
static boolean |
isParityAdjusted(byte[] key, int offset) 检查从 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
DESedeKeySpec (byte[] key)
创建使用前24个字节在一个DESedeKeySpec对象, key作为DES-EDE密钥的密钥材料。
构成DES-EDE密钥的字节是 key[0]和 key[23]之间的那些字节
| 参数(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. |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if key is null. |
InvalidKeyException |
if the given key material is shorter than 24 bytes. |
DESedeKeySpec (byte[] key,
int offset)
创建使用前24个字节在一个DESedeKeySpec对象, key ,在开始 offset以下,作为DES-EDE密钥的密钥材料。
构成DES-EDE密钥的字节是 key[offset]和 key[offset+23]之间的 key[offset] 。
| 参数(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. |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if key is null. |
InvalidKeyException |
if the given key material, starting at offset inclusive, is shorter than 24 bytes |
byte[] getKey ()
返回DES-EDE密钥。
| 返回(Returns) | |
|---|---|
byte[] |
the DES-EDE key. Returns a new array each time this method is called. |
boolean isParityAdjusted (byte[] key,
int offset)
检查从 offset开始的给定DES-EDE密钥是否是奇偶校验调整的。
| 参数(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 |
| 抛出异常(Throws) | |
|---|---|
NullPointerException |
if key is null. |
InvalidKeyException |
if the given key material, starting at offset inclusive, is shorter than 24 bytes |