Question: (c) Given a coding at the server side that implementing SSL task using SSL SocketFactory. Answer all questions based on the coding. 15: 2. SKET4623

 (c) Given a coding at the server side that implementing SSL

task using SSL SocketFactory. Answer all questions based on the coding. 15:

(c) Given a coding at the server side that implementing SSL task using SSL SocketFactory. Answer all questions based on the coding. 15: 2. SKET4623 Network Programming, Final Exam Question 3 3. * @author kamalmy 4 SSL SocketClient.java 5. 6. import java.io.*; 7. import java.net.*: 8. import javax.net.ssl. 10: public class SslSocketClient 11: 12: public static void main(Stringli args) { 13: Buffered Reader in new BufferedReader new InputStreamReader(System.in); 14: PrintStream out = System.out; SSL SocketFactory f- (SSL SocketFactory) SSL SocketFactory.getDefaulto: 16: try 17: SSL Socket c = (SSL Socket) f.createSocket("localhost", 8888); 18 print SocketInfo(c); 19: c.startHandshake(); 20: Buffered Writer w = new Buffered Writer new OutputStreamWriter(c.getOutputStream()); 21: Buffered Reader - new Buffered Reader new InputStreamReader(c.getInputStream()); 22: String m null; 23: while ((mr.readLine())!= null) { 24 out.println(m); 25: m = in.readLine(); 26 w.write(m,0,m.length); 27: w.newLine(); w.flusho: 29 3 30: w.close(): 31: r.close(); 32 c.close(); 33 } catch (IOException e) { 34 System.err.println(e.toString); 35 3 36" 1 37: private static void print SocketInfo(SSL Sockets) { 38 System.out.println("Socket class: "+s.getClass(); 28 41: 42: 43: 44 45:) System.out.println(" Remote address = " ts.getInetAddress().toString(): 39 System.out.println(" Remote port="+s.getPorto); System.out.println(" Local socket address ts.getLocalSocketAddress().toString(); 40: System.out.println(" Local address =s.getLocalAddress().toString(); System.out.println(" Local port = "+s.getLocalPort): System.out.println(" Need client authentication = +s.getNeedClient Autho): SSL Session ss =s.getSession(); System.out.println(" Cipher suite = "Ass.getCipherSuite); System.out.println(" Protocol = "+5s.getProtocol); 46 (i) Explain the code in line 15 SSL Socket Factory - (SSL Socket Factory) SSL SocketFactory.getDefault(); (4 marks) (ii) What is the code line 19 does: e.startHandshake()? (4 marks) (iii) What are the purposes of code block start from line 16: try and code block start from line 32: catch (IOException e)? (4 marks) (iv) What is the code in line 42 means: SSL Session ss = s.getSession(); (4 marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!