package com.whyc.service;
|
|
import com.whyc.pojo.ComInfo;
|
import com.whyc.pojo.HardWareUtils;
|
import com.whyc.pojo.RSAUtil;
|
import com.whyc.pojo.Response;
|
import org.springframework.stereotype.Service;
|
|
@Service
|
public class ComInfoService {
|
|
public Response getComInfoRSA(){
|
ComInfo cInfo=new ComInfo();
|
cInfo.setCpuId(HardWareUtils.getCPUSerial());
|
cInfo.setCpuIdRsa(RSAUtil.encrypt(cInfo.getCpuId(),RSAUtil.getPublicKey()));
|
|
cInfo.setBoardId(HardWareUtils.getMotherboardSN());
|
cInfo.setBoardIdRsa(RSAUtil.encrypt(cInfo.getBoardId(),RSAUtil.getPublicKey()));
|
|
return new Response().setII(1,cInfo,cInfo!=null?true:false,"");
|
}
|
|
public Response getComInfo(ComInfo cInfo) {
|
cInfo.setCpuId(RSAUtil.decrypt(cInfo.getCpuIdRsa(),RSAUtil.getPrivateKey()));
|
cInfo.setBoardId(RSAUtil.decrypt(cInfo.getBoardIdRsa(),RSAUtil.getPrivateKey()));
|
return new Response().setII(1,cInfo,cInfo!=null?true:false,"");
|
}
|
}
|