PowerMock与ssl& amp; StandardPBEStringEncryptor

时间:2017-09-01 04:55:22

标签: ssl junit powermock javax.crypto

试图运行Junit测试

  1. 以下是使用 org.jasypt.encryption.pbe.StandardPBEStringEncryptor
  2. 进行密码解密的方法
    Caused by: java.security.NoSuchAlgorithmException: class configured for TrustManagerFactory: sun.security.ssl.TrustManagerFactoryImpl$PKIXFactory not a TrustManagerFactory
        at sun.security.jca.GetInstance.checkSuperClass(GetInstance.java:258)
        at sun.security.jca.GetInstance.getInstance(GetInstance.java:237)
        at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
        at javax.net.ssl.TrustManagerFactory.getInstance(TrustManagerFactory.java:138)
        at com.optum.pdm.util.SSLConnectionHelper.getSslSocketFactory(SSLConnectionHelper.java:41)
        at com.optum.pdm.util.SSLConnectionHelper.getSSLContext(SSLConnectionHelper.java:31)
        ... 33 more
    
         
        
    1. TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm())
    2.   
    std::set
    1. 当我在Junit上尝试使用@PowerMockIgnore(“javax.crypto。,javax.net.ssl。”)时,它仍然因上述密码解密问题而失败
    2. 当我在Junit上使用一个@PowerMockIgnore(“javax.crypto。*”)时,它因加载jks问题而失败
    3. 有没有办法解决这类问题

1 个答案:

答案 0 :(得分:1)

需要进行注释校正

它不是@PowerMockIgnore(" javax.crypto。,javax.net.ssl。") 在这种情况下只占用一个但是当我们宣布下面的一个时它需要多个项目

@PowerMockIgnore({" org.apache.http.conn.ssl。"," javax.net.ssl。",&# 34。javax.crypto中*"})