| | |
| | | import com.auth0.jwt.interfaces.DecodedJWT; |
| | | import com.java110.core.context.ApiDataFlow; |
| | | import com.java110.core.context.DataFlow; |
| | | import com.java110.dto.reportData.ReportDataDto; |
| | | import com.java110.dto.reportData.ReportDataHeaderDto; |
| | | import com.java110.utils.cache.JWTCache; |
| | | import com.java110.utils.cache.MappingCache; |
| | | import com.java110.utils.constant.CommonConstant; |
| | |
| | | } |
| | | |
| | | /** |
| | | * md5签名 |
| | | * |
| | | * @param reportDataDto |
| | | * @return |
| | | */ |
| | | public static void authReportDataSign(ReportDataDto reportDataDto, String code) throws NoAuthorityException { |
| | | ReportDataHeaderDto reportDataHeaderDto = reportDataDto.getReportDataHeaderDto(); |
| | | if (reportDataHeaderDto == null) { |
| | | throw new IllegalArgumentException("参数错误"); |
| | | } |
| | | String newSign = md5(reportDataHeaderDto.getTranId() + reportDataHeaderDto.getReqTime() + reportDataDto.getReportDataBodyDto().toJSONString() + code).toLowerCase(); |
| | | if (!newSign.equals(reportDataHeaderDto.getSign())) { |
| | | throw new IllegalArgumentException("签名失败"); |
| | | } |
| | | } |
| | | |
| | | public static void generatorReportDataSign(ReportDataDto reportDataDto, String code) { |
| | | ReportDataHeaderDto reportDataHeaderDto = reportDataDto.getReportDataHeaderDto(); |
| | | if (reportDataHeaderDto == null) { |
| | | throw new IllegalArgumentException("参数错误"); |
| | | } |
| | | String newSign = md5(reportDataHeaderDto.getTranId() + reportDataHeaderDto.getReqTime() + reportDataDto.getReportDataBodyDto().toJSONString() + code).toLowerCase(); |
| | | reportDataHeaderDto.setSign(newSign); |
| | | } |
| | | /** |
| | | * 加载公钥 |
| | | * |
| | | * @param publicPemData |
| | |
| | | // PrivateKey privateKey = keyPair.getPrivate(); |
| | | // System.out.println("私钥:" + new String(Base64.getEncoder().encode(privateKey.getEncoded()))); |
| | | |
| | | System.out.printf("passwdMd5 " + passwdMd5("wuxw2015")); |
| | | System.out.printf("passwdMd5 " + passwdMd5("397301")); |
| | | |
| | | } |
| | | |