非对称加解密
This commit is contained in:
@@ -8,6 +8,8 @@ import com.sunyard.chsm.utils.CodecUtils;
|
||||
*/
|
||||
public interface CryptoConst {
|
||||
|
||||
byte[] USER_ID = CodecUtils.decodeHex("31323334353637383132333435363738");
|
||||
|
||||
static byte[] iv() {
|
||||
return CodecUtils.decodeHex("30303030303030303030303030303030");
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public interface SdfApiService {
|
||||
/**
|
||||
* 计算MAC
|
||||
*
|
||||
* @param algId algId
|
||||
* @param algId algId
|
||||
* @param padding padding
|
||||
* @param symKey 用户指定的密钥
|
||||
* @param pucIv 缓冲区指针,用于存放输入和返回的IV数据
|
||||
@@ -136,8 +136,12 @@ public interface SdfApiService {
|
||||
* 杂凑运算
|
||||
*
|
||||
* @param pucData 缓冲区指针,用于存放输入的数据明文
|
||||
* @param pubKey 执行预处理的公钥
|
||||
* @param userId 执行预处理的userId
|
||||
* @return hash值
|
||||
*/
|
||||
byte[] hash(byte[] pucData, byte[] pubKey, byte[] userId);
|
||||
|
||||
byte[] hash(byte[] pucData);
|
||||
|
||||
byte[] encryptByTMK(byte[] data);
|
||||
|
||||
@@ -15,6 +15,9 @@ public abstract class CodecUtils {
|
||||
}
|
||||
|
||||
public static byte[] decodeBase64(String str) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Base64.getDecoder().decode(str);
|
||||
} catch (Exception var3) {
|
||||
@@ -35,6 +38,9 @@ public abstract class CodecUtils {
|
||||
}
|
||||
|
||||
public static byte[] decodeHex(String str) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return Hex.decode(str);
|
||||
} catch (Exception var3) {
|
||||
|
||||
Reference in New Issue
Block a user