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 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
package issrg.SAWS.util; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
@author |
52 |
|
@version |
53 |
|
|
54 |
|
|
55 |
|
import java.io.Serializable; |
56 |
|
|
|
|
| 70.9% |
Uncovered Elements: 23 (79) |
Complexity: 13 |
Complexity Density: 0.86 |
|
57 |
|
public class CertificateData implements Serializable { |
58 |
|
|
59 |
|
private int validity = 365; |
60 |
|
private String commonName; |
61 |
|
private String organizationUnitName; |
62 |
|
private String organizationName; |
63 |
|
private String localityName; |
64 |
|
private String stateName; |
65 |
|
private String countryName; |
66 |
|
private String algorithm = "RSA"; |
67 |
|
private int keySize = 1024; |
68 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
69 |
2
|
public CertificateData() {... |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
72 |
2
|
public int getValidity() {... |
73 |
2
|
return validity; |
74 |
|
} |
75 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
2
|
public void setValidity(int validity) {... |
77 |
2
|
this.validity = validity; |
78 |
|
} |
79 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
80 |
0
|
public String getCommonName() {... |
81 |
0
|
return commonName; |
82 |
|
} |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
84 |
2
|
public void setCommonName(String commonName) {... |
85 |
2
|
this.commonName = commonName; |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0
|
public String getOrganizationUnitName() {... |
89 |
0
|
return organizationUnitName; |
90 |
|
} |
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
2
|
public void setOrganizationUnitName(String organizationUnitName) {... |
93 |
2
|
this.organizationUnitName = organizationUnitName; |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0
|
public String getOrganizationName() {... |
97 |
0
|
return organizationName; |
98 |
|
} |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
2
|
public void setOrganizationName(String organizationName) {... |
101 |
2
|
this.organizationName = organizationName; |
102 |
|
} |
103 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
0
|
public String getLocalityName() {... |
105 |
0
|
return localityName; |
106 |
|
} |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
2
|
public void setLocalityName(String localityName) {... |
109 |
2
|
this.localityName = localityName; |
110 |
|
} |
111 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
112 |
0
|
public String getStateName() {... |
113 |
0
|
return stateName; |
114 |
|
} |
115 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
2
|
public void setStateName(String stateName) {... |
117 |
2
|
this.stateName = stateName; |
118 |
|
} |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
0
|
public String getCountryName() {... |
121 |
0
|
return countryName; |
122 |
|
} |
123 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
124 |
2
|
public void setCountryName(String countryName) {... |
125 |
2
|
this.countryName = countryName; |
126 |
|
} |
127 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
128 |
6
|
public String getAlgorithm() {... |
129 |
6
|
return algorithm; |
130 |
|
} |
131 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
2
|
public void setAlgorithm(String algorithm) {... |
133 |
2
|
this.algorithm = algorithm; |
134 |
|
} |
135 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
136 |
2
|
public int getKeySize() {... |
137 |
2
|
return keySize; |
138 |
|
} |
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
140 |
2
|
public void setKeySize(int keySize) {... |
141 |
2
|
this.keySize = keySize; |
142 |
|
} |
143 |
|
|
|
|
| 73.2% |
Uncovered Elements: 11 (41) |
Complexity: 13 |
Complexity Density: 0.68 |
|
144 |
6
|
public String toSubjectName() {... |
145 |
6
|
StringBuffer sn = new StringBuffer(); |
146 |
|
|
147 |
6
|
if (this.commonName != null && !this.commonName.equals("")) { |
148 |
6
|
sn.append("CN=" + this.commonName); |
149 |
|
} |
150 |
|
|
151 |
6
|
if (this.organizationUnitName != null && !this.organizationUnitName.equals("")) { |
152 |
6
|
sn.append((!sn.toString().equals("")) ? ", " : " "); |
153 |
6
|
sn.append("OU=" + this.organizationUnitName); |
154 |
|
} |
155 |
|
|
156 |
6
|
if (this.organizationName != null && !this.organizationName.equals("")) { |
157 |
6
|
sn.append((!sn.toString().equals("")) ? ", " : " "); |
158 |
6
|
sn.append("O=" + this.organizationName); |
159 |
|
} |
160 |
|
|
161 |
6
|
if (this.localityName != null && !this.localityName.equals("")) { |
162 |
6
|
sn.append((!sn.toString().equals("")) ? ", " : " "); |
163 |
6
|
sn.append("L=" + this.localityName); |
164 |
|
} |
165 |
|
|
166 |
6
|
if (this.stateName != null && !this.stateName.equals("")) { |
167 |
6
|
sn.append((!sn.toString().equals("")) ? ", " : " "); |
168 |
6
|
sn.append("S=" + this.stateName); |
169 |
|
} |
170 |
|
|
171 |
6
|
if (this.countryName != null && !this.countryName.equals("")) { |
172 |
6
|
sn.append((!sn.toString().equals("")) ? ", " : " "); |
173 |
6
|
sn.append("C=" + this.countryName); |
174 |
|
} |
175 |
|
|
176 |
6
|
return (new String(sn)); |
177 |
|
} |
178 |
|
} |