导出公钥和证书
This commit is contained in:
@@ -26,6 +26,18 @@ public class AsymKeyController {
|
||||
@Autowired
|
||||
private AsymKeyService asymKeyService;
|
||||
|
||||
/**
|
||||
* 导出非对称公钥
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/exportPubKey")
|
||||
public R<ExportPubKeyResp> exportPubKey(@Valid @RequestBody ExportPubKeyReq req) {
|
||||
ExportPubKeyResp resp = asymKeyService.exportPubKey(req);
|
||||
return R.data(resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 非对称加密
|
||||
*
|
||||
|
||||
@@ -3,10 +3,10 @@ package com.sunyard.chsm.controller;
|
||||
|
||||
import com.sunyard.chsm.model.R;
|
||||
import com.sunyard.chsm.model.dto.CertDTO;
|
||||
import com.sunyard.chsm.param.CertExinfoResp;
|
||||
import com.sunyard.chsm.param.CertInfoResp;
|
||||
import com.sunyard.chsm.param.*;
|
||||
import com.sunyard.chsm.service.AppCertService;
|
||||
import com.sunyard.chsm.service.CertService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -15,7 +15,6 @@ import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 证书管理类接口
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cert")
|
||||
@@ -28,13 +27,24 @@ public class CertController {
|
||||
@Resource
|
||||
private CertService certService;
|
||||
|
||||
/**
|
||||
* 导出证书
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/exportCert")
|
||||
public R<ExportCertResp> exportCert(@Valid @RequestBody ExportCertReq req) {
|
||||
ExportCertResp resp = certService.exportCert(req);
|
||||
return R.data(resp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取证书信息
|
||||
*
|
||||
* @param certString 证书内容
|
||||
*/
|
||||
@GetMapping ("/info")
|
||||
@GetMapping("/info")
|
||||
public R<CertInfoResp> getCertInfo(@RequestParam String certString) {
|
||||
CertInfoResp certInfo = certService.getCertInfo(certString);
|
||||
return R.data(certInfo);
|
||||
@@ -45,7 +55,7 @@ public class CertController {
|
||||
*
|
||||
* @param certString 证书内容
|
||||
*/
|
||||
@GetMapping ("/exinfo")
|
||||
@GetMapping("/exinfo")
|
||||
public R<CertExinfoResp> getCertExinfo(@RequestParam String certString) {
|
||||
CertExinfoResp certExinfo = certService.getCertExinfo(certString);
|
||||
return R.data(certExinfo);
|
||||
@@ -57,22 +67,22 @@ public class CertController {
|
||||
*
|
||||
* @param certString 证书内容
|
||||
*/
|
||||
@GetMapping ("/check")
|
||||
@GetMapping("/check")
|
||||
public R<Boolean> certCheck(@RequestParam String certString) {
|
||||
Boolean res = certService.checkCert(certString);
|
||||
return R.data(res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导入证书
|
||||
*
|
||||
* @param importCert 证书
|
||||
* @param req 证书
|
||||
*/
|
||||
@GetMapping ("/import")
|
||||
public R<Void> importCert(@Valid @RequestBody CertDTO.ImportCert importCert) {
|
||||
@PostMapping("/import")
|
||||
public R<Void> importCert(@Valid @RequestBody ImportCertReq req) {
|
||||
CertDTO.ImportCert importCert = new CertDTO.ImportCert();
|
||||
BeanUtils.copyProperties(req, importCert);
|
||||
appCertService.importCert(importCert);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user