sdf 接口
This commit is contained in:
parent
96e5f430fd
commit
666cc96799
@ -71,12 +71,12 @@ public class BCSdfApiService implements SdfApiService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] encryptByMK(byte[] data) {
|
||||
public byte[] encryptByTMK(byte[] data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] decryptByMK(byte[] data) {
|
||||
public byte[] decryptByTMK(byte[] data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public interface SdfApiService {
|
||||
*/
|
||||
byte[] hash(byte[] pucData);
|
||||
|
||||
byte[] encryptByMK(byte[] data);
|
||||
byte[] encryptByTMK(byte[] data);
|
||||
|
||||
byte[] decryptByMK(byte[] data);
|
||||
byte[] decryptByTMK(byte[] data);
|
||||
}
|
||||
|
@ -278,14 +278,14 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
||||
|
||||
if (KeyCategory.SYM_KEY.getCode().equals(info.getKeyType())) {
|
||||
byte[] symKey = sdfApiService.generateRandom(16);
|
||||
byte[] encSymKey = sdfApiService.encryptByMK(symKey);
|
||||
byte[] encSymKey = sdfApiService.encryptByTMK(symKey);
|
||||
record.setKeyData(Hex.toHexString(encSymKey));
|
||||
String checkHash = Hex.toHexString(sdfApiService.hash(symKey));
|
||||
record.setCheckValue(checkHash);
|
||||
} else {
|
||||
EccKey eccKey = sdfApiService.genKeyPairEcc();
|
||||
byte[] d = eccKey.getPriKey().getD();
|
||||
byte[] encD = sdfApiService.encryptByMK(d);
|
||||
byte[] encD = sdfApiService.encryptByTMK(d);
|
||||
record.setKeyData(Hex.toHexString(encD));
|
||||
String checkHash = Hex.toHexString(sdfApiService.hash(d));
|
||||
record.setCheckValue(checkHash);
|
||||
@ -392,7 +392,7 @@ public class KeyInfoServiceImpl implements KeyInfoService {
|
||||
byte[] y = Arrays.copyOfRange(xy, 32, 64);
|
||||
ECPublicKeyParameters pubKeyParam = BCECUtils.createECPublicKeyParameters(x, y);
|
||||
|
||||
byte[] priKeyBytes = sdfApiService.decryptByMK(Hex.decode(record.getKeyData()));
|
||||
byte[] priKeyBytes = sdfApiService.decryptByTMK(Hex.decode(record.getKeyData()));
|
||||
// byte[][] pri18 = LangUtils.splitAverage(priKeyBytes);
|
||||
ECPrivateKeyParameters priKeyParam = BCECUtils.createECPrivateKeyParameters(priKeyBytes);
|
||||
ECDomainParameters domainParams = priKeyParam.getParameters();
|
||||
|
Loading…
Reference in New Issue
Block a user