public class SymmetriCipherInfo extends Object
| 构造器和说明 |
|---|
SymmetriCipherInfo(String algorithm,
int keySize)
创建一个 CipherInfo 实例
|
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
doCipher(String algorithm,
int mode,
Key key,
AlgorithmParameterSpec params,
byte[] s)
进行加密或解密
|
String |
getCipherAlgorithm() |
int |
getKeySize() |
static String |
getSecretKey(String algorithm,
SecureRandom secure) |
static SecretKey |
getSecretKey(String algorithm,
SecureRandom secure,
Integer keySize)
获取对称加密用的 SecretKey
|
void |
setCipherAlgorithm(String cipherAlgorithm) |
void |
setKeySize(int keySize) |
public SymmetriCipherInfo(String algorithm, int keySize)
algorithm - 加密算法keySize - 密钥长度public static byte[] doCipher(String algorithm, int mode, Key key, AlgorithmParameterSpec params, byte[] s)
algorithm - 选择的算法mode - 是解密模式还是加密模式?key - 密钥params - 参数,可选的s - 输入的内容public static SecretKey getSecretKey(String algorithm, SecureRandom secure, Integer keySize)
algorithm - 加密算法secure - 可选的keySize - 可选的public static String getSecretKey(String algorithm, SecureRandom secure)
public int getKeySize()
public void setKeySize(int keySize)
public String getCipherAlgorithm()
public void setCipherAlgorithm(String cipherAlgorithm)
Copyright © 2022. All rights reserved.