证书管理
This commit is contained in:
@@ -12,4 +12,6 @@ public interface AppCertService {
|
||||
Page<CertDTO.ACView> selectPageList(CertDTO.Query query);
|
||||
|
||||
void importCert(CertDTO.ImportCert importCert);
|
||||
|
||||
void delete(Long id);
|
||||
}
|
||||
|
||||
@@ -173,6 +173,8 @@ public class AppCertServiceImpl implements AppCertService {
|
||||
} catch (Exception ex) {
|
||||
throw new IllegalArgumentException("证书内容格式错误,无法解析");
|
||||
}
|
||||
Assert.isTrue(Objects.equals(signCert.getSubjectX500Principal().getName(), encCert.getSubjectX500Principal().getName()),
|
||||
"证书主题不一致");
|
||||
PublicKey signPk = signCert.getPublicKey();
|
||||
String signPkHex = BCECUtils.getHexPubKey((BCECPublicKey) signPk);
|
||||
String encPkHex = BCECUtils.getHexPubKey((BCECPublicKey) encCert.getPublicKey());
|
||||
@@ -274,4 +276,25 @@ public class AppCertServiceImpl implements AppCertService {
|
||||
return Pair.of(Hex.toHexString(xy), pd);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
|
||||
AppCert appCert = appCertMapper.selectById(id);
|
||||
Assert.notNull(appCert, "证书不存在");
|
||||
|
||||
if (appCert.getSingle()) {
|
||||
appCertMapper.deleteById(id);
|
||||
return;
|
||||
}
|
||||
|
||||
List<AppCert> appCerts = appCertMapper.selectList(
|
||||
new LambdaQueryWrapper<AppCert>()
|
||||
.eq(AppCert::getKeyId, appCert.getKeyId())
|
||||
.eq(AppCert::getSubject, appCert.getSubject())
|
||||
|
||||
);
|
||||
appCertMapper.deleteBatchIds(appCerts.stream().map(AppCert::getId).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user