Course Solutions Uncategorized (Solved) : Hello One Question Java Ssl Certificate Chains Code Import Javaiobufferedreader Import Jav Q33140579 . . . .

(Solved) : Hello One Question Java Ssl Certificate Chains Code Import Javaiobufferedreader Import Jav Q33140579 . . . .

 

Hello. I have one more question about java ssl certificatechains. Here is my code:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.URL;
import java.net.UnknownHostException;
import java.security.Certificate;
import java.security.cert.X509Certificate;

import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;

public class SSLHarvester {

   @SuppressWarnings(“deprecation”)
   public static void main(String[] args) throwsUnknownHostException, IOException
   {
      
        URL url = newURL(“http://www.google.com”);
      
       SSLSocketFactory ssf =(SSLSocketFactory) SSLSocketFactory.getDefault();
       SSLSocket socket = (SSLSocket)ssf.createSocket(url.getHost(),443);
      
       SSLSession session = ((SSLSocket)socket).getSession();

       PrintWriter out = newPrintWriter(socket.getOutputStream());
      
       out.print(“GET /robots.txtHTTP/1.1rnHost: www.google.comrnrn”);
       out.flush();
          
       BufferedReader in = newBufferedReader(newInputStreamReader(socket.getInputStream()));
       String line;

      
       line = in.readLine();
      System.out.println(line);  
      
      javax.security.cert.X509Certificate[] cert =session.getPeerCertificateChain();
      
      System.out.println(cert[0].getIssuerDN());
       System.out.println(“nn”);
      System.out.println(cert[0].getSubjectDN());
  

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

(Solved) : 24 Port Ethernet Switch Configured Three Separate Vlans Follows Vlan1 Server Fs1 Workstati Q35073138 . . . .(Solved) : 24 Port Ethernet Switch Configured Three Separate Vlans Follows Vlan1 Server Fs1 Workstati Q35073138 . . . .

<p>A 24 port Ethernet switch has been configured with threeseparate VLANs as follows:</p><p style="margin-left:126px;">VLAN1: Server FS1, Workstations WS1,WS2 and WS3</p><p style="margin-left:126px;">VLAN2: Server FS2, Workstations WS4,WS5, and WS6</p><p style="margin-left:126px;">VLAN3: Server FS3,