문제

I create with Keytool a serverkeystore.jks with 2 different pwd for store and key, but i get java.security.UnrecoverableKeyException: Cannot recover key unless I edit one of them and put the same value in both

How can i modify my code to allow 2 different pass? :

SSLServerSocket sslserversocket=null;

        try {

            System.setProperty("javax.net.ssl.keyStore", serverKeyStore);
            System.setProperty("javax.net.ssl.keyStorePassword", pwdStore);

            SSLServerSocketFactory sslserversocketfactory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
            sslserversocket = (SSLServerSocket) sslserversocketfactory.createServerSocket(port);

[...]

thanks in advance ^^

도움이 되었습니까?

해결책

You can't do it with the system properties. You would have to write and load your own X509KeyManager and create your own SSLContext with it.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top