Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SSL poczatkujacy

0 views
Skip to first unread message

markuswww

unread,
Nov 29, 2006, 2:37:13 PM11/29/06
to
witam

mam taki kod klienta ktorym staram sie polaczyc sie z tomcatm ze strona startowa

w odpoweidzi wyzrzuca mi taki wyjatek

Exception in thread "main" java.net.SocketException: Default SSL context init
failed: Cannot recover key
at javax.net.ssl.DefaultSSLServerSocketFactory.createServerSocket(Unknown Source)
at SSL.SSLSimpleServer.main(SSLSimpleServer.java:17)

jako magazyn zaufania urzywam magazynu kluczy wyczytalem ze to jest to samo
czy myle sie ?
jesli tak jak sie tworzy skaldnice zaufania?

kod:
----------------------------------------

package SSL;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

import javax.net.SocketFactory;
import javax.net.ssl.SSLSocketFactory;

public class SSL_client_test {

public static void main(String [] args)
{
try
{



System.setProperty("javax.net.ssl.trustStore","I:\\eclipse\\workspace\\mysamples\\SSL\\mystore");
System.setProperty("javax.net.ssl.trustStorePassword","mystore0");
SocketFactory sf = SSLSocketFactory.getDefault();
Socket s = sf.createSocket(args[0], Integer.parseInt(args[1]));

BufferedReader br = new BufferedReader(new
InputStreamReader(s.getInputStream()));
System.out.println("START");
if(br.ready())
System.out.println("GOTOWY");

System.out.println(br.readLine());
s.close();
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
}

----------------------------

pozdrawiam

Piotr

--
Wysłano z serwisu OnetNiusy: http://niusy.onet.pl

0 new messages