|
|
|
@ -72,7 +72,11 @@ public class CentralWalletActivationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public CentralWalletActivationPageResult verifySignature(InstitutionKeySubject subject, String publicKeyInput) {
|
|
|
|
public CentralWalletActivationPageResult verifySignature(InstitutionKeySubject subject, String publicKeyInput, String algorithm) {
|
|
|
|
|
|
|
|
if (!"SM2".equalsIgnoreCase(algorithm != null ? algorithm.trim() : "")) {
|
|
|
|
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
|
|
|
|
throw new BusinessException(ErrorCode.VALIDATION_ERROR, "算法选择有误,错误数+1");
|
|
|
|
|
|
|
|
}
|
|
|
|
CentralWalletActivation a = getOrCreate(subject);
|
|
|
|
CentralWalletActivation a = getOrCreate(subject);
|
|
|
|
if (!a.isReceived()) {
|
|
|
|
if (!a.isReceived()) {
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
@ -102,7 +106,11 @@ public class CentralWalletActivationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public CentralWalletActivationPageResult recalculateDigest(InstitutionKeySubject subject) {
|
|
|
|
public CentralWalletActivationPageResult recalculateDigest(InstitutionKeySubject subject, String algorithm) {
|
|
|
|
|
|
|
|
if (!"SM3".equalsIgnoreCase(algorithm != null ? algorithm.trim() : "")) {
|
|
|
|
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
|
|
|
|
throw new BusinessException(ErrorCode.VALIDATION_ERROR, "算法选择有误,错误数+1");
|
|
|
|
|
|
|
|
}
|
|
|
|
CentralWalletActivation a = getOrCreate(subject);
|
|
|
|
CentralWalletActivation a = getOrCreate(subject);
|
|
|
|
if (a.getSignVerifyResult() == null || !a.getSignVerifyResult().startsWith("通过")) {
|
|
|
|
if (a.getSignVerifyResult() == null || !a.getSignVerifyResult().startsWith("通过")) {
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
@ -148,7 +156,11 @@ public class CentralWalletActivationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public CentralWalletActivationPageResult verifyFinalSignature(InstitutionKeySubject subject, String publicKeyInput) {
|
|
|
|
public CentralWalletActivationPageResult verifyFinalSignature(InstitutionKeySubject subject, String publicKeyInput, String algorithm) {
|
|
|
|
|
|
|
|
if (!"SM2".equalsIgnoreCase(algorithm != null ? algorithm.trim() : "")) {
|
|
|
|
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
|
|
|
|
throw new BusinessException(ErrorCode.VALIDATION_ERROR, "算法选择有误,错误数+1");
|
|
|
|
|
|
|
|
}
|
|
|
|
CentralWalletActivation a = getOrCreate(subject);
|
|
|
|
CentralWalletActivation a = getOrCreate(subject);
|
|
|
|
if (!a.isWalletActivated()) {
|
|
|
|
if (!a.isWalletActivated()) {
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
@ -181,7 +193,11 @@ public class CentralWalletActivationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public CentralWalletActivationPageResult finalSign(InstitutionKeySubject subject, String privateKeyInput) {
|
|
|
|
public CentralWalletActivationPageResult finalSign(InstitutionKeySubject subject, String privateKeyInput, String algorithm) {
|
|
|
|
|
|
|
|
if (!"SM2".equalsIgnoreCase(algorithm != null ? algorithm.trim() : "")) {
|
|
|
|
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
|
|
|
|
throw new BusinessException(ErrorCode.VALIDATION_ERROR, "算法选择有误,错误数+1");
|
|
|
|
|
|
|
|
}
|
|
|
|
CentralWalletActivation a = getOrCreate(subject);
|
|
|
|
CentralWalletActivation a = getOrCreate(subject);
|
|
|
|
if (a.getStep5SignVerifyResult() == null || !a.getStep5SignVerifyResult().startsWith("通过")) {
|
|
|
|
if (a.getStep5SignVerifyResult() == null || !a.getStep5SignVerifyResult().startsWith("通过")) {
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
scoreService.recordError(subject.getUserId());
|
|
|
|
|