1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.microemu.cldc;
26
27 import javax.microedition.io.SecurityInfo;
28 import javax.microedition.pki.Certificate;
29 import org.microemu.log.Logger;
30
31 public class SecurityInfoImpl implements SecurityInfo {
32
33 private String cipherSuite;
34 private String protocolName;
35 private Certificate certificate;
36
37 public SecurityInfoImpl(String cipherSuite, String protocolName, Certificate certificate) {
38 this.cipherSuite = cipherSuite;
39 this.protocolName = protocolName;
40 this.certificate = certificate;
41 }
42
43 public String getCipherSuite() {
44 return cipherSuite;
45 }
46
47 public String getProtocolName() {
48 if (protocolName.startsWith("TLS")) {
49 return "TLS";
50 } else if (protocolName.startsWith("SSL")) {
51 return "SSL";
52 } else {
53
54 try {
55 throw new RuntimeException();
56 } catch (RuntimeException ex) {
57 Logger.error(ex);
58 throw ex;
59 }
60 }
61 }
62
63 public String getProtocolVersion() {
64 if (protocolName.startsWith("TLS")) {
65 return "3.1";
66 } else if (getProtocolName().equals("SSL")) {
67 return "3.0";
68 } else {
69
70 try {
71 throw new RuntimeException();
72 } catch (RuntimeException ex) {
73 Logger.error(ex);
74 throw ex;
75 }
76 }
77 }
78
79 public Certificate getServerCertificate() {
80 return certificate;
81 }
82
83 }