diff --git a/src/main/java/cn/chjyj/szwh/constant/ChConstant.java b/src/main/java/cn/chjyj/szwh/constant/ChConstant.java index dd21219..37acbe0 100644 --- a/src/main/java/cn/chjyj/szwh/constant/ChConstant.java +++ b/src/main/java/cn/chjyj/szwh/constant/ChConstant.java @@ -14,7 +14,7 @@ public class ChConstant { public static final String DB_CONF = "/conf/db.properties"; // 其他配置 - public static final String SZWH_CONF="/conf/cert"; + public static final String SZWH_CONF="/conf/szwh.properties"; //用户认证token密钥 public static final String USER_PEM="user_real"; diff --git a/src/test/java/cn/chjyj/szwh/JwtRsaTokenTests.java b/src/test/java/cn/chjyj/szwh/JwtRsaTokenTests.java new file mode 100644 index 0000000..171b1a0 --- /dev/null +++ b/src/test/java/cn/chjyj/szwh/JwtRsaTokenTests.java @@ -0,0 +1,38 @@ +package cn.chjyj.szwh; + +import cn.chjyj.szwh.constant.ChConstant; +import cn.chjyj.szwh.utils.SzFileUtils; +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import java.io.File; +import java.io.FileReader; +import java.util.Properties; + +/** + * jwt token 测试 + */ +@SpringBootTest +public class JwtRsaTokenTests { + + /** + * 委托系统token测试 + */ + @Test + public void entrTokenTest(){ + // 资源文件 + String dbconf = ChConstant.WORK_DIR + ChConstant.SZWH_CONF; + Properties prop = new Properties(); + try { + prop.load(new FileReader(dbconf)); + // 委托系统 密钥 + String entr_prikey=prop.getProperty("entrust.pem.prikey.path");//私钥路径 + // 私钥 + String prinote = SzFileUtils.getKeyFromFile(ChConstant.WORK_DIR + "/" + entr_prikey); + System.out.println("文件内容"+prinote); + }catch (Exception ex){ + ex.printStackTrace(); + } + + } +}