public class DES extends Object
| 构造器和说明 |
|---|
DES()
利用默认的密钥构造一个DES工具实例
|
DES(byte[] key)
利用指定的字节数组密钥构造一个DES工具实例
|
DES(String key)
利用指定的字符串密钥构造一个DES工具实例
|
| 限定符和类型 | 方法和说明 |
|---|---|
byte[] |
decode(byte[] srcBytes)
解密以byte[]密文输入,以byte[]明文输出
|
String |
decode(String ciphertext)
解密指定的密文字符串,并以明文方式返回
内部使用UTF-8编码进行处理 |
String |
decode(String ciphertext,
String encoding)
解密指定的密文字符串,并以明文方式返回
|
byte[] |
encode(byte[] srcBytes)
加密指定的字节数组,并返回加密后的字节数组
|
String |
encode(String plaintext)
输入指定的明文,使用指定的密钥进行加密,并返回加密后的字符串
内部使用UTF-8编码进行处理 |
String |
encode(String plaintext,
String encoding)
输入指定的明文,使用指定的密钥进行加密,并返回加密后的字符串
|
byte[] |
process(byte[] srcBytes,
boolean encrypt)
加密或解密处理指定的字节数组
|
void |
setKey(byte[] byteKey)
根据直接数组参数生成KEY
|
void |
setKey(String strKey)
根据字符串参数生成KEY
|
public DES(String key)
key - public DES(byte[] key)
key - public DES()
public void setKey(String strKey)
public void setKey(byte[] byteKey)
byteKey - public String encode(String plaintext, String encoding)
plaintext - 指定的明文encoding - 指定的字符编码,例如"UTF-8"、"GBK"public String encode(String plaintext)
plaintext - 指定的明文public String decode(String ciphertext, String encoding)
ciphertext - 指定的密文字符串encoding - 指定的字符编码,例如"UTF-8"、"GBK"public String decode(String ciphertext)
ciphertext - 指定的密文字符串public byte[] encode(byte[] srcBytes)
srcBytes - public byte[] decode(byte[] srcBytes)
srcBytes - public byte[] process(byte[] srcBytes,
boolean encrypt)
srcBytes - 直接数组encrypt - 如果为true表示加密,否则表示解密。Copyright © 2020. All rights reserved.