public interface SymmetricCodec
| 限定符和类型 | 方法和说明 |
|---|---|
String |
alg()
加密算法
|
default byte[] |
decode(byte[] data,
byte[] keyByte,
byte[] iv)
解密
|
default byte[] |
encode(byte[] data,
byte[] keyByte,
byte[] iv)
加密
|
default byte[] |
encrypt(byte[] data,
Key key,
byte[] iv,
int encryptMode)
加密&解密处理
|
String |
keyAlg()
key : 算法
|
String |
provider()
cipher provider
|
byte[] |
randomKey() |
default byte[] |
randomKey(int length)
生成一个随机 key
|
default Key |
toKey(byte[] key)
byte[] 转换为 Key
|
String alg()
String keyAlg()
String provider()
byte[] randomKey()
default byte[] randomKey(int length)
throws NoSuchProviderException,
NoSuchAlgorithmException
length - 长度NoSuchProviderException - 异常NoSuchAlgorithmException - 异常default Key toKey(byte[] key)
default byte[] encrypt(byte[] data,
Key key,
byte[] iv,
int encryptMode)
throws BadPaddingException,
IllegalBlockSizeException
data - 数据key - keyiv - 向量(cbc模式必须添加)encryptMode - 加密 - 解密BadPaddingExceptionIllegalBlockSizeExceptiondefault byte[] encode(byte[] data,
byte[] keyByte,
byte[] iv)
throws BadPaddingException,
IllegalBlockSizeException
default byte[] decode(byte[] data,
byte[] keyByte,
byte[] iv)
throws BadPaddingException,
IllegalBlockSizeException
Copyright © 2023 Pivotal Software, Inc.. All rights reserved.