|
|
@ -3,26 +3,21 @@ package kr.xit.biz.nice.service;
|
|
|
|
import egovframework.com.cmm.EgovMessageSource;
|
|
|
|
import egovframework.com.cmm.EgovMessageSource;
|
|
|
|
import javax.transaction.Transactional;
|
|
|
|
import javax.transaction.Transactional;
|
|
|
|
import kr.xit.biz.cmm.service.CmmEnsCacheService;
|
|
|
|
import kr.xit.biz.cmm.service.CmmEnsCacheService;
|
|
|
|
|
|
|
|
import kr.xit.biz.common.ApiConstants.NiceCiWrkDiv;
|
|
|
|
import kr.xit.biz.common.ApiConstants.SignguCode;
|
|
|
|
import kr.xit.biz.common.ApiConstants.SignguCode;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.IpinCiResDataBody;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.IpinCiResEncData;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.IpinCiResponse;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiInfo;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiInfo;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiRequest;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceCiRequest;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceTokenResponse;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.NiceTokenResponse;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyResDataBody;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyResDataBody;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.PublickeyResponse;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.ResponseDataHeader;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.ResponseDataHeader;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.SymkeyRegInfo;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.SymkeyRegInfo;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.SymkeyStatInfo;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.SymkeyStatInfo;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.SymmetrickeyResDataBody;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.SymmetrickeyResponse;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResDataBody;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenResDataBody;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRevokeResDataBody;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRevokeResDataBody;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRevokeResponse;
|
|
|
|
import kr.xit.biz.ens.model.nice.NiceCiDTO.TokenRevokeResponse;
|
|
|
|
import kr.xit.biz.nice.mapper.IBizNiceCiMapper;
|
|
|
|
import kr.xit.biz.nice.mapper.IBizNiceCiMapper;
|
|
|
|
import kr.xit.core.exception.BizRuntimeException;
|
|
|
|
import kr.xit.core.exception.BizRuntimeException;
|
|
|
|
import kr.xit.core.support.utils.JsonUtils;
|
|
|
|
|
|
|
|
import kr.xit.ens.cmm.CmmEnsUtils;
|
|
|
|
|
|
|
|
import kr.xit.ens.nice.cmm.CmmNiceCiUtils;
|
|
|
|
import kr.xit.ens.nice.cmm.CmmNiceCiUtils;
|
|
|
|
import kr.xit.ens.nice.service.INiceCiService;
|
|
|
|
import kr.xit.ens.nice.service.INiceCiService;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@ -58,7 +53,6 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
// 기관용 Token
|
|
|
|
// 기관용 Token
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* <pre>
|
|
|
|
* <pre>
|
|
|
|
* NICE 토큰 발급 요청
|
|
|
|
* NICE 토큰 발급 요청
|
|
|
@ -76,8 +70,8 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
|
|
|
|
final ResponseDataHeader dataHeader = tokenResponse.getDataHeader();
|
|
|
|
final ResponseDataHeader dataHeader = tokenResponse.getDataHeader();
|
|
|
|
|
|
|
|
|
|
|
|
if(dataHeader.getGwRsltCd().equals("1200")){
|
|
|
|
if(dataHeader.getGwRsltCd().equals("1200")){
|
|
|
|
TokenResDataBody dataBody = tokenResponse.getDataBody();
|
|
|
|
final TokenResDataBody dataBody = tokenResponse.getDataBody();
|
|
|
|
NiceCiInfo niceDTO = NiceCiInfo.builder()
|
|
|
|
final NiceCiInfo niceDTO = NiceCiInfo.builder()
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
.accessToken(dataBody.getAccessToken())
|
|
|
|
.accessToken(dataBody.getAccessToken())
|
|
|
@ -91,7 +85,7 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
|
|
|
|
|
|
|
|
updateNiceCerfInfoSync(niceDTO, reqDTO);
|
|
|
|
updateNiceCerfInfoSync(niceDTO, reqDTO, NiceCiWrkDiv.TOKEN);
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -112,14 +106,14 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public TokenRevokeResponse revokeToken(final NiceCiRequest reqDTO){
|
|
|
|
public TokenRevokeResponse revokeToken(final NiceCiRequest reqDTO){
|
|
|
|
TokenRevokeResponse resDTO = niceCiService.revokeToken(reqDTO);
|
|
|
|
final TokenRevokeResponse resDTO = niceCiService.revokeToken(reqDTO);
|
|
|
|
|
|
|
|
|
|
|
|
final ResponseDataHeader dataHeader = resDTO.getDataHeader();
|
|
|
|
final ResponseDataHeader dataHeader = resDTO.getDataHeader();
|
|
|
|
|
|
|
|
|
|
|
|
if(dataHeader.getGwRsltCd().equals("1200")){
|
|
|
|
if(dataHeader.getGwRsltCd().equals("1200")){
|
|
|
|
TokenRevokeResDataBody dataBody = resDTO.getDataBody();
|
|
|
|
final TokenRevokeResDataBody dataBody = resDTO.getDataBody();
|
|
|
|
|
|
|
|
|
|
|
|
if(dataBody.isResult()){
|
|
|
|
if(dataBody.isResult()){
|
|
|
|
NiceCiInfo niceDTO = NiceCiInfo.builder()
|
|
|
|
final NiceCiInfo niceDTO = NiceCiInfo.builder()
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
.accessToken(null)
|
|
|
|
.accessToken(null)
|
|
|
@ -131,7 +125,7 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
|
|
|
|
|
|
|
|
updateNiceCerfInfoSync(niceDTO, reqDTO);
|
|
|
|
updateNiceCerfInfoSync(niceDTO, reqDTO, NiceCiWrkDiv.TOKEN);
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
throw BizRuntimeException.create("토큰을 폐기하지 못했습니다.");
|
|
|
|
throw BizRuntimeException.create("토큰을 폐기하지 못했습니다.");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -139,13 +133,10 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
|
|
|
|
return resDTO;
|
|
|
|
return resDTO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
// 기관용 Token
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
// 공개키(Publickey)
|
|
|
|
// 공개키(Publickey)
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* <pre>
|
|
|
|
* <pre>
|
|
|
|
* 공개키 요청
|
|
|
|
* 공개키 요청
|
|
|
@ -157,59 +148,30 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public PublickeyResponse requestPublickey(final NiceCiRequest reqDTO) {
|
|
|
|
public PublickeyResDataBody requestPublickey(final NiceCiRequest reqDTO) {
|
|
|
|
final NiceCiInfo niceDTO = CmmNiceCiUtils.getNiceCiInfo(reqDTO);
|
|
|
|
final NiceCiInfo niceDTO = CmmNiceCiUtils.getNiceCiInfo(reqDTO);
|
|
|
|
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageSource.getMessage("fail.api.nice.token.info"));
|
|
|
|
if(ObjectUtils.isEmpty(niceDTO.getAccessToken())) throw BizRuntimeException.create(messageSource.getMessage("fail.api.nice.token.info"));
|
|
|
|
|
|
|
|
|
|
|
|
final PublickeyResponse pubResDTO = niceCiService.requestPublickey(reqDTO);
|
|
|
|
final PublickeyResDataBody dataBody = niceCiService.requestPublickey(reqDTO);
|
|
|
|
|
|
|
|
|
|
|
|
//FIXME::공개키 정보 갱신 - Error code enum 전환
|
|
|
|
|
|
|
|
final ResponseDataHeader dataHeader = pubResDTO.getDataHeader();
|
|
|
|
|
|
|
|
final PublickeyResDataBody dataBody = pubResDTO.getDataBody();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 공개키 정보 update
|
|
|
|
// 3. 공개키 정보 update
|
|
|
|
if(ObjectUtils.isNotEmpty(dataBody)
|
|
|
|
niceDTO.setSiteCode(dataBody.getSiteCode());
|
|
|
|
&& dataHeader.getGwRsltCd().equals("1200")
|
|
|
|
niceDTO.setKeyVersion(dataBody.getKeyVersion());
|
|
|
|
&& dataBody.getRspCd().equals("P000")
|
|
|
|
niceDTO.setPublicKey(dataBody.getPublicKey());
|
|
|
|
&& dataBody.getResultCd().equals("0000")){
|
|
|
|
niceDTO.setValidDtim(dataBody.getValidDtim());
|
|
|
|
niceDTO.setSiteCode(dataBody.getSiteCode());
|
|
|
|
niceCiMapper.updateNiceCrtfPublickey(niceDTO);
|
|
|
|
niceDTO.setKeyVersion(dataBody.getKeyVersion());
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
niceDTO.setPublicKey(dataBody.getPublicKey());
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
niceDTO.setValidDtim(dataBody.getValidDtim());
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfPublickey(niceDTO);
|
|
|
|
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//FIXME:: 교통시설운영처 또는 장사시설인 경우 sync ----------------------------------------
|
|
|
|
|
|
|
|
if(SignguCode.TRAFFIC.getCode().equals(niceDTO.getSignguCode())){
|
|
|
|
|
|
|
|
niceDTO.setSignguCode(SignguCode.FUNERAL.getCode());
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfPublickey(niceDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(SignguCode.FUNERAL.getCode().equals(niceDTO.getSignguCode())){
|
|
|
|
|
|
|
|
niceDTO.setSignguCode(SignguCode.TRAFFIC.getCode());
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfPublickey(niceDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
|
|
|
|
cacheService.logCache();
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return pubResDTO;
|
|
|
|
updateNiceCerfInfoSync(niceDTO, reqDTO, NiceCiWrkDiv.PUBLIC_KEY);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//FIXME::에러처리 방안 설정후 적용 할 것
|
|
|
|
return dataBody;
|
|
|
|
throw BizRuntimeException.create(JsonUtils.toJson(dataHeader));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// 공개키(Publickey)
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
// 대칭키 : symmetrickey
|
|
|
|
// 대칭키 : symmetrickey
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* <pre>
|
|
|
|
* <pre>
|
|
|
|
* 0. cache call
|
|
|
|
* 0. cache call
|
|
|
@ -221,109 +183,78 @@ public class BizNiceCiService extends EgovAbstractServiceImpl implements IBizNic
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public SymmetrickeyResponse requestRegSymmetrickey(final NiceCiRequest reqDTO) {
|
|
|
|
public SymkeyStatInfo requestRegSymmetrickey(final NiceCiRequest reqDTO) {
|
|
|
|
final String signguCode = reqDTO.getSignguCode();
|
|
|
|
|
|
|
|
final String ffnlgCode = reqDTO.getFfnlgCode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//FIXME::NICE 연계이후 메소드 교체
|
|
|
|
|
|
|
|
final SymkeyRegInfo symkeyRegInfo = CmmNiceCiUtils.getSymkeyRegInfo();
|
|
|
|
final SymkeyRegInfo symkeyRegInfo = CmmNiceCiUtils.getSymkeyRegInfo();
|
|
|
|
SymmetrickeyResponse symResDTO = niceCiService.requestRegSymmetrickey(reqDTO, symkeyRegInfo);
|
|
|
|
final SymkeyStatInfo symkeyStatInfo = niceCiService.requestRegSymmetrickey(reqDTO, symkeyRegInfo);
|
|
|
|
|
|
|
|
final NiceCiInfo niceDTO = NiceCiInfo.builder()
|
|
|
|
final ResponseDataHeader dataHeader = symResDTO.getDataHeader();
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
final SymmetrickeyResDataBody dataBody = symResDTO.getDataBody();
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
if(dataHeader.getGwRsltCd().equals("1200")
|
|
|
|
.build();
|
|
|
|
&& dataBody.getRspCd().equals("P000")
|
|
|
|
|
|
|
|
//FIXME:: "0007" 인 경우 확인 필요 - result_cd 0000, 0007일 경우 나감 (0007: key 중복 오류 (현재 및 직전에 사용한 Key 사용 불가)
|
|
|
|
niceDTO.setBefSymkeyVersion(symkeyStatInfo.getBefSymkeyVersion());
|
|
|
|
&& dataBody.getResultCd().equals("0000")){
|
|
|
|
niceDTO.setBefSymkeyValidDtim(symkeyStatInfo.getBefValidDtim());
|
|
|
|
SymkeyStatInfo symkeyStatInfo = JsonUtils.toObject(dataBody.getSymkeyStatInfo(), SymkeyStatInfo.class);
|
|
|
|
niceDTO.setBefSymkeyKey(niceDTO.getCurSymkeyKey());
|
|
|
|
NiceCiInfo niceDTO = NiceCiInfo.builder()
|
|
|
|
niceDTO.setBefSymkeyIv(niceDTO.getCurSymkeyIv());
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
niceDTO.setBefSymkeyHmacKey(niceDTO.getCurSymkeyHmacKey());
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
niceDTO.setCurSymkeyVersion(symkeyStatInfo.getCurSymkeyVersion());
|
|
|
|
niceDTO.setBefSymkeyVersion(symkeyStatInfo.getBefSymkeyVersion());
|
|
|
|
niceDTO.setCurSymkeyValidDtim(symkeyStatInfo.getCurValidDtim());
|
|
|
|
niceDTO.setBefSymkeyValidDtim(symkeyStatInfo.getBefValidDtim());
|
|
|
|
niceDTO.setCurSymkeyKey(symkeyRegInfo.getKey());
|
|
|
|
niceDTO.setBefSymkeyKey(niceDTO.getCurSymkeyKey());
|
|
|
|
niceDTO.setCurSymkeyIv(symkeyRegInfo.getIv());
|
|
|
|
niceDTO.setBefSymkeyIv(niceDTO.getCurSymkeyIv());
|
|
|
|
niceDTO.setCurSymkeyHmacKey(symkeyRegInfo.getHmacKey());
|
|
|
|
niceDTO.setBefSymkeyHmacKey(niceDTO.getCurSymkeyHmacKey());
|
|
|
|
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfSymkey(niceDTO);
|
|
|
|
niceDTO.setCurSymkeyVersion(symkeyStatInfo.getCurSymkeyVersion());
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
niceDTO.setCurSymkeyValidDtim(symkeyStatInfo.getCurValidDtim());
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
niceDTO.setCurSymkeyKey(symkeyRegInfo.getKey());
|
|
|
|
|
|
|
|
niceDTO.setCurSymkeyIv(symkeyRegInfo.getIv());
|
|
|
|
|
|
|
|
niceDTO.setCurSymkeyHmacKey(symkeyRegInfo.getHmacKey());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfSymkey(niceDTO);
|
|
|
|
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//FIXME:: 교통시설운영처 또는 장사시설인 경우 sync ----------------------------------------
|
|
|
|
|
|
|
|
if(SignguCode.TRAFFIC.getCode().equals(niceDTO.getSignguCode())){
|
|
|
|
|
|
|
|
niceDTO.setSignguCode(SignguCode.FUNERAL.getCode());
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfSymkey(niceDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(SignguCode.FUNERAL.getCode().equals(niceDTO.getSignguCode())){
|
|
|
|
|
|
|
|
niceDTO.setSignguCode(SignguCode.TRAFFIC.getCode());
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfSymkey(niceDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
|
|
|
|
cacheService.removeNiceCiInfoCache(niceDTO.getSignguCode(), niceDTO.getFfnlgCode());
|
|
|
|
|
|
|
|
cacheService.logCache();
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return symResDTO;
|
|
|
|
updateNiceCerfInfoSync(niceDTO, reqDTO, NiceCiWrkDiv.SYM_KEY);
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
return symkeyStatInfo;
|
|
|
|
throw BizRuntimeException.create(JsonUtils.toJson(symResDTO));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
// 대칭키 : symmetrickey
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
// 아이핀 CI 요청
|
|
|
|
// 아이핀 CI 요청
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
public IpinCiResponse requestCi(final NiceCiRequest reqDTO) {
|
|
|
|
public IpinCiResEncData requestCi(final NiceCiRequest reqDTO) {
|
|
|
|
IpinCiResponse ipinCiResponse = niceCiService.requestCi(reqDTO);
|
|
|
|
return niceCiService.requestCi(reqDTO);
|
|
|
|
|
|
|
|
|
|
|
|
ResponseDataHeader resHeader = ipinCiResponse.getDataHeader();
|
|
|
|
|
|
|
|
IpinCiResDataBody resBody = ipinCiResponse.getDataBody();
|
|
|
|
|
|
|
|
String resEncData = resBody.getEncData();
|
|
|
|
|
|
|
|
//IpinCiResEncData resEncData = JsonUtils.toObject(resBody.getEncData(), IpinCiResEncData.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//FIXME::응답무결성 체크
|
|
|
|
|
|
|
|
// 응답으로온 intigrety_value와 응답 enc_data를 Hmac한 값을 비교
|
|
|
|
|
|
|
|
// 무결성체크가 완료되면 데이터를 보낸 대칭키로 복호화하여 데이터를 확인
|
|
|
|
|
|
|
|
NiceCiInfo niceDTO = CmmNiceCiUtils.getSymkeyNiceCiInfo(reqDTO);
|
|
|
|
|
|
|
|
String checkHmac = CmmEnsUtils.encodeHmacSha256(niceDTO.getCurSymkeyHmacKey(), resEncData);
|
|
|
|
|
|
|
|
if(resBody.getIntegrityValue().equals(checkHmac)){
|
|
|
|
|
|
|
|
String decData = CmmEnsUtils.decodeAesData(resEncData, niceDTO.getCurSymkeyKey(), niceDTO.getCurSymkeyIv());
|
|
|
|
|
|
|
|
resBody.setEncData(decData);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ipinCiResponse;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// 아이핀 CI 요청
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* <pre>
|
|
|
|
|
|
|
|
* 교통시설운영처와 승화원의 Nice CI 정보 sync
|
|
|
|
private void updateNiceCerfInfoSync(final NiceCiInfo niceDTO, final NiceCiRequest reqDTO) {
|
|
|
|
* @param niceDTO NiceCiInfo
|
|
|
|
//FIXME:: 교통시설운영처 또는 장사시설인 경우 sync ----------------------------------------
|
|
|
|
* @param reqDTO NiceCiRequest
|
|
|
|
|
|
|
|
* @param wrkDiv NiceCiWrkDiv
|
|
|
|
|
|
|
|
* </pre>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void updateNiceCerfInfoSync(final NiceCiInfo niceDTO, final NiceCiRequest reqDTO, final NiceCiWrkDiv wrkDiv) {
|
|
|
|
|
|
|
|
// 교통시설운영처 또는 장사시설인 경우 sync ----------------------------------------
|
|
|
|
if(SignguCode.TRAFFIC.getCode().equals(reqDTO.getSignguCode())){
|
|
|
|
if(SignguCode.TRAFFIC.getCode().equals(reqDTO.getSignguCode())){
|
|
|
|
niceDTO.setSignguCode(SignguCode.FUNERAL.getCode());
|
|
|
|
niceDTO.setSignguCode(SignguCode.FUNERAL.getCode());
|
|
|
|
niceCiMapper.updateNiceCrtfToken(niceDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(SignguCode.FUNERAL.getCode().equals(reqDTO.getSignguCode())){
|
|
|
|
if(SignguCode.FUNERAL.getCode().equals(reqDTO.getSignguCode())){
|
|
|
|
niceDTO.setSignguCode(SignguCode.TRAFFIC.getCode());
|
|
|
|
niceDTO.setSignguCode(SignguCode.TRAFFIC.getCode());
|
|
|
|
niceCiMapper.updateNiceCrtfToken(niceDTO);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(wrkDiv){
|
|
|
|
|
|
|
|
case TOKEN:
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfToken(niceDTO);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PUBLIC_KEY:
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfPublickey(niceDTO);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SYM_KEY:
|
|
|
|
|
|
|
|
niceCiMapper.updateNiceCrtfSymkey(niceDTO);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|
// 공개키 정보 캐쉬 삭제
|
|
|
|