Testing SSL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello..

Since a few days i try to run gnu classpath with SSL, but i will not work.
My goal is, to get a SSL Connection between Client and a Server.
Now im testing the SSLContext class with this java code:
    try {
      	 // SSLContext protocols: TLS, SSL, SSLv3
         SSLContext sc = SSLContext.getInstance("SSLv3");
         System.out.println("\nSSLContext class: "+sc.getClass());
         System.out.println("   Protocol: "+sc.getProtocol());
         System.out.println("   Provider: "+sc.getProvider());

      	 // SSLContext algorithms: SunX509
         KeyManagerFactory kmf 
            = KeyManagerFactory.getInstance("JessieX509");
         System.out.println("\nKeyManagerFactory class: "
            +kmf.getClass());
         System.out.println("   Algorithm: "+kmf.getAlgorithm());
         System.out.println("   Provider: "+kmf.getProvider());

      	 // KeyStore types: JKS
         String ksName = "testKeystore.gkr";
         char ksPass[] = "1234567".toCharArray();
         char ctPass[] = "1234567".toCharArray();
         KeyStore ks = KeyStore.getInstance("GKR");
         ks.load(new FileInputStream(ksName), ksPass);
         System.out.println("\nKeyStore class: "+ks.getClass());
         System.out.println("   Type: "+ks.getType());
         System.out.println("   Provider: "+ks.getProvider());
         System.out.println("   Size: "+ks.size());

         // Generating KeyManager list
         kmf.init(ks,ctPass);
         KeyManager[] kmList = kmf.getKeyManagers();
         System.out.println("\nKeyManager class: "
            +kmList[0].getClass());
         System.out.println("   # of key manager: " +kmList.length);

         // Generating SSLServerSocketFactory
         sc.init(kmList, null, null);
         SSLServerSocketFactory ssf = sc.getServerSocketFactory();
         System.out.println("\nSSLServerSocketFactory class: "
            +ssf.getClass());
         
         // Genearting SSLServerSocket
         SSLServerSocket ss
            = (SSLServerSocket) ssf.createServerSocket();
         System.out.println("\nSSLServerSocket class: "
            +ss.getClass());
         System.out.println("   String: "+ss.toString());

         // Generating SSLSocketFactory
         sc.init(kmList, null, null);
         SSLSocketFactory sf = sc.getSocketFactory();
         System.out.println("\nSSLSocketFactory class: "
            +sf.getClass());

         // Genearting SSLSocket
         SSLSocket s
            = (SSLSocket) sf.createSocket();
         System.out.println("\nSSLSocket class: "+s.getClass());
         System.out.println("   String: "+s.toString());
      } catch (Exception e) {
         System.err.println(e.toString());
      }

I have also generated the testKeystore.gkr file with gkeytool.
The Error message that i always get is:
java.security.UnrecoverableKeyException: authentication failed
It would be nice if somebody could give me some hints, to solve this
problem.

-- 
View this message in context: http://old.nabble.com/Testing-SSL-tp29480547p29480547.html
Sent from the Gnu - Classpath - General mailing list archive at Nabble.com.




[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux