Most visited

Recently visited

Added in API level 1

DESKeySpec

public class DESKeySpec
extends Object implements KeySpec

java.lang.Object
    javax.crypto.spec.DESKeySpec


这个类指定了一个DES密钥。

摘要(Summary)

常量(Constants)

int DES_KEY_LEN

以字节为单位定义DES密钥长度的常量。

Public constructors

DESKeySpec(byte[] key)

创建使用前8个字节中一个DESKeySpec对象, key作为DES密钥的密钥材料。

DESKeySpec(byte[] key, int offset)

创建使用前8个字节中一个DESKeySpec对象, key ,在开始 offset以下,作为DES密钥的密钥材料。

公共方法(Public methods)

byte[] getKey()

返回DES密钥材料。

static boolean isParityAdjusted(byte[] key, int offset)

检查从 offset开始的给定DES密钥材料是否进行了奇偶校验。

static boolean isWeak(byte[] key, int offset)

检查给定的DES密钥材料是弱还是半弱。

继承方法(Inherited methods)

From class java.lang.Object

常量(Constants)

DES_KEY_LEN

Added in API level 1
int DES_KEY_LEN

以字节为单位定义DES密钥长度的常量。

常量值:8(0x00000008)

Public constructors

DESKeySpec

Added in API level 1
DESKeySpec (byte[] key)

创建使用前8个字节中一个DESKeySpec对象, key作为DES密钥的密钥材料。

构成DES密钥的字节是 key[0]key[7]之间的那些字节。

参数(Parameters)
key byte: the buffer with the DES key material. The first 8 bytes of the buffer are copied to protect against subsequent modification.
抛出异常(Throws)
NullPointerException if the given key material is null
InvalidKeyException if the given key material is shorter than 8 bytes.

DESKeySpec

Added in API level 1
DESKeySpec (byte[] key, 
                int offset)

创建使用前8个字节中一个DESKeySpec对象, key ,在开始 offset以下,作为DES密钥的密钥材料。

构成DES密钥的字节是 key[offset]key[offset+7]之间的字节。

参数(Parameters)
key byte: 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.
抛出异常(Throws)
NullPointerException if the given key material is null
InvalidKeyException if the given key material, starting at offset inclusive, is shorter than 8 bytes.

公共方法(Public methods)

getKey

Added in API level 1
byte[] getKey ()

返回DES密钥材料。

返回(Returns)
byte[] the DES key material. Returns a new array each time this method is called.

isParityAdjusted

Added in API level 1
boolean isParityAdjusted (byte[] key, 
                int offset)

检查从 offset开始的给定DES密钥材料是否进行了奇偶校验。

参数(Parameters)
key byte: the buffer with the DES key material.
offset int: the offset in key, where the DES key material starts.
返回(Returns)
boolean true if the given DES key material is parity-adjusted, false otherwise.
抛出异常(Throws)
InvalidKeyException if the given key material is null, or starting at offset inclusive, is shorter than 8 bytes.

isWeak

Added in API level 1
boolean isWeak (byte[] key, 
                int offset)

检查给定的DES密钥材料是弱还是半弱。

参数(Parameters)
key byte: the buffer with the DES key material.
offset int: the offset in key, where the DES key material starts.
返回(Returns)
boolean true if the given DES key material is weak or semi-weak, false otherwise.
抛出异常(Throws)
InvalidKeyException if the given key material is null, or starting at offset inclusive, is shorter than 8 bytes.

Hooray!