• 大小: 0.02M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-14
  • 语言: 其他
  • 标签: 其他  

资源简介

71c7f9eea20bfdeb24319c13f0b52703.rar

资源截图

代码片段和文件信息

import java.net.*;
import java.io.*;
import javax.net.ssl.*;


public class SimpleClient {

public static void main(String args[])throws IOException
    {

       InetAddress  hostIA = InetAddress.getByName(args[0]);
       String  host = hostIA.getHostName();
       int port = Integer.parseInt(args[1]);


       System.out.println(“USAGE: java SimpleClient host port“);

       try {
           System.out.println(“connecting...“);
           SSLSocketFactory sslFact =
               (SSLSocketFactory)SSLSocketFactory.getDefault();
           SSLSocket c = (SSLSocket)sslFact.createSocket(host port);

           System.out.println(“handshaking...“);
           c.startHandshake();
 
      
     BufferedReader in =
    new BufferedReader(
new InputStreamReader(c.getInputStream()));
    
           PrintWriter out = new PrintWriter(
  new BufferedWriter(
  new OutputStreamWriter(
        c.getOutputStream())));

           BufferedReader stdin =
               new BufferedReader(
                  new InputStreamReader(System.in));

         String line;
         String strin;
         for(;;)
      {
               System.out.print(“Enter a line:“);
               strin = stdin.readLine();  
               if (strin.length() == 0) break;
               out.println (strin);
               out.flush();
         line = in.readLine();
   System.out.println(“Msg from Server is: “ + line);
            }

          in.close();
    out.close();
    c.close();

          System.out.println(“done...“);
 
        }   catch (IOException e) {
System.out.println(“SimpleClient died: “ + e.getMessage());
    e.printStackTrace();
                    }
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     目录          0  2005-03-19 12:47  sslJAVA_example

     目录          0  2005-03-19 12:47  sslJAVA_example\openssl生成证书

     文件        323  2002-12-02 14:11  sslJAVA_example\openssl生成证书\genclient

     文件         68  2002-12-02 14:11  sslJAVA_example\openssl生成证书\gendh

     文件        158  2002-12-02 14:11  sslJAVA_example\openssl生成证书\genroot

     文件        325  2002-12-02 14:11  sslJAVA_example\openssl生成证书\genserver

     文件       7151  2002-12-02 14:11  sslJAVA_example\openssl生成证书\myopenssl.cnf

     文件          3  2002-12-02 14:13  sslJAVA_example\openssl生成证书\rootcert.srl

     文件       1127  2002-12-02 14:11  sslJAVA_example\rootcert.pem

     文件       1143  2002-12-02 14:13  sslJAVA_example\servercert.pem

     文件       3192  2002-12-03 15:24  sslJAVA_example\serverkeys

     文件        688  2002-12-03 14:24  sslJAVA_example\serverreq.pem

     文件       2163  2002-12-02 15:23  sslJAVA_example\SimpleClient.class

     文件       1754  2002-11-25 09:13  sslJAVA_example\SimpleClient.java

     文件       2815  2002-12-02 15:23  sslJAVA_example\SimpleServer.class

     文件       2348  2002-12-02 15:23  sslJAVA_example\SimpleServer.java

     文件       2294  2002-11-25 16:39  sslJAVA_example\SimpleServer.java.bak

     文件      35840  2005-03-19 12:39  sslJAVA_example\ssl.doc

     文件        781  2002-11-25 09:16  sslJAVA_example\wahab.cert

     文件       1253  2002-11-25 09:15  sslJAVA_example\wahabPrivateStore

     文件        846  2002-11-25 09:22  sslJAVA_example\wahabPublicStore

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

                64272                    21


评论

共有 条评论