@Test
public void testRsa() throws Exception {
RsaUtils.generateKey(publicKeyPath, privateKeyPath, "234");
}
也是乐优商城生成公钥和私钥报这个错,需要先将下面这个方法或者@Before注释掉,因为这个时候公钥和私钥还没有生成所以读取不到任何内容
@Before
public void testGetRsa() throws Exception {
privateKey = RsaUtils.getPrivateKey(privateKeyPath);
publicKey = RsaUtils.getPublicKey(publicKeyPath);
}
在乐优商城项目中,遇到生成RSA密钥对时的错误。测试方法`testRsa()`尝试生成公钥和私钥,但因`@Before`注解的方法`testGetRsa()`在公钥和私钥未生成前尝试读取,导致异常。解决方案是注释掉`testGetRsa()`或调整执行顺序。

被折叠的 条评论
为什么被折叠?



