Статус: Новичок
Группы: Участники
Зарегистрирован: 30.06.2010(UTC) Сообщений: 1 Откуда: Moscow
|
Здравствуйте!
Есть две проблемы.
1. Пытаюсь установить SSL-соединение с сервером, возникает ошибка.
Создание хранилища с ключом: keytool -import -alias server_cer -provider ru.CryptoPro.JCP.JCP -keypass 111111 -storetype HDImageStore -keystore e:/keystore -storepass 111111 -file server_cer.cer
Создание trust-хранилища: keytool -import -alias server_cer -provider ru.CryptoPro.JCP.JCP -keypass 111111 -storetype HDImageStore -keystore e:/truststore -storepass 111111 -file server_cer.cer
Соединение: System.setProperty("javax.net.ssl.trustStore", "E:/truststore"); System.setProperty("javax.net.ssl.trustStoreType", "HDImageStore"); System.setProperty("javax.net.ssl.trustStorePassword", "111111"); System.setProperty("javax.net.ssl.keyStore", "E:/keystore"); System.setProperty("javax.net.ssl.keyStoreType", "HDImageStore"); System.setProperty("javax.net.ssl.keyStorePassword", "111111");
System.setProperty("javax.net.ssl.supportGVO", "true"); System.setProperty("javax.net.debug", "ssl"); String httpsURL = "https://hostname:9043/WS_AUTH_EXT/AuthorizationServiceExternal.svc?wsdl"; URL myurl = new URL(httpsURL); HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
...
main, handling exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1611) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:181) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1035) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:124) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1139) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234) at SSLTest.main(SSLTest.java:28) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:294) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:200) at sun.security.validator.Validator.validate(Validator.java:218) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1014) ... 12 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:174) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:289) ... 18 more
2. И еще проблема - не могу найти класс ru.CryptoPro.ssl.SSLSocketFactoryImpl при запуске "C:\Program Files\Java\jre6\bin\java" -Dfile.encoding=Cp866 -cp samples.jar ComLine/ComLine Client -port 9043 -server server_host_name -trustStorePath e:/truststore -trustStorePassword 111111 -keyStorePassword 111111 -fileget test.html -fileout e:/test.out
Ошибка: java.lang.ClassNotFoundException: ru.CryptoPro.ssl.SSLSocketFactoryImpl
Подскажите, пожалуйста, как быть.
С уважением, Андрей.
|
|
|
|
Статус: Активный участник
Группы: Участники
Зарегистрирован: 09.10.2008(UTC) Сообщений: 181
|
Здравствуйте. Вызываются только классы из пакета com.sun.net.ssl.internal.ssl, а ru.CryptoPro.ssl вообще нету. Вы установили JTLS? java -jar cpSSL.jar
|
|
|
|
Быстрый переход
Вы не можете создавать новые темы в этом форуме.
Вы не можете отвечать в этом форуме.
Вы не можете удалять Ваши сообщения в этом форуме.
Вы не можете редактировать Ваши сообщения в этом форуме.
Вы не можете создавать опросы в этом форуме.
Вы не можете голосовать в этом форуме.
Important Information:
The Форум КриптоПро uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close