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 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
package issrg.ac; |
77 |
|
|
78 |
|
import iaik.asn1.*; |
79 |
|
import iaik.asn1.structures.*; |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
|
|
| 53% |
Uncovered Elements: 55 (117) |
Complexity: 20 |
Complexity Density: 0.53 |
|
85 |
|
public class V2Form implements ASN1Type, Cloneable{ |
86 |
|
final public static int BASECERTIFICATEID_TAG = 0; |
87 |
|
final public static int OBJECTDIGESTINFO_TAG = 1; |
88 |
|
|
89 |
|
|
90 |
|
protected GeneralNames issuerName = null; |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
1068
|
public GeneralNames getIssuerName(){... |
97 |
1068
|
return issuerName; |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
0
|
public void setIssuerName(GeneralNames issuerName){... |
105 |
0
|
this.issuerName=issuerName; |
106 |
|
} |
107 |
|
|
108 |
|
protected IssuerSerial baseCertificateID = null; |
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
0
|
public IssuerSerial getBaseCertificateID(){... |
115 |
0
|
return baseCertificateID; |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
0
|
public void setBaseCertificateID(IssuerSerial baseCertificateID){... |
123 |
0
|
this.baseCertificateID=baseCertificateID; |
124 |
|
} |
125 |
|
|
126 |
|
protected ObjectDigestInfo objectDigestInfo = null; |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
0
|
public ObjectDigestInfo getObjectDigestInfo(){... |
133 |
0
|
return objectDigestInfo; |
134 |
|
} |
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
140 |
20
|
public void setObjectDigestInfo(ObjectDigestInfo objectDigestInfo){... |
141 |
20
|
this.objectDigestInfo=objectDigestInfo; |
142 |
|
} |
143 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
144 |
0
|
protected V2Form() {... |
145 |
|
} |
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
@param |
151 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
152 |
0
|
public V2Form(V2Form v2) throws CodingException{... |
153 |
0
|
issuerName = null; |
154 |
0
|
baseCertificateID = null; |
155 |
0
|
objectDigestInfo = null; |
156 |
|
|
157 |
0
|
if (v2.issuerName!=null){ |
158 |
0
|
issuerName = new GeneralNames(v2.issuerName.toASN1Object()); |
159 |
|
} |
160 |
|
|
161 |
0
|
if (v2.baseCertificateID!=null){ |
162 |
0
|
baseCertificateID = new IssuerSerial(v2.baseCertificateID); |
163 |
|
} |
164 |
|
|
165 |
0
|
if (v2.objectDigestInfo!=null){ |
166 |
0
|
objectDigestInfo = new ObjectDigestInfo(v2.objectDigestInfo); |
167 |
|
} |
168 |
|
} |
169 |
|
|
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
@param |
174 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
175 |
1702
|
public V2Form(ASN1Object ao) throws CodingException{... |
176 |
1702
|
decode(ao); |
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
@param |
187 |
|
@param |
188 |
|
|
189 |
|
@param |
190 |
|
|
191 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
192 |
20
|
public V2Form(GeneralNames issuerName, IssuerSerial baseCertificateID, ObjectDigestInfo objectDigestInfo){... |
193 |
20
|
this.issuerName = issuerName; |
194 |
20
|
this.baseCertificateID = baseCertificateID; |
195 |
20
|
this.objectDigestInfo = objectDigestInfo; |
196 |
|
} |
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
@return |
202 |
|
|
|
|
| 76.5% |
Uncovered Elements: 4 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
203 |
42
|
public ASN1Object toASN1Object() throws CodingException{... |
204 |
42
|
ASN1Object result = new SEQUENCE(); |
205 |
|
|
206 |
42
|
ASN1Object tag; |
207 |
|
|
208 |
42
|
if (issuerName!=null){ |
209 |
42
|
result.addComponent(issuerName.toASN1Object()); |
210 |
|
} |
211 |
|
|
212 |
42
|
if (baseCertificateID!=null){ |
213 |
40
|
tag = new CON_SPEC(BASECERTIFICATEID_TAG, baseCertificateID.toASN1Object(), AttributeCertificate.USE_IMPLICIT_ENCODING); |
214 |
|
|
215 |
40
|
result.addComponent(tag); |
216 |
|
} |
217 |
|
|
218 |
42
|
if (objectDigestInfo!=null){ |
219 |
0
|
tag = new CON_SPEC(OBJECTDIGESTINFO_TAG, objectDigestInfo.toASN1Object(), AttributeCertificate.USE_IMPLICIT_ENCODING); |
220 |
|
|
221 |
0
|
result.addComponent(tag); |
222 |
|
} |
223 |
|
|
224 |
42
|
return result; |
225 |
|
} |
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
|
231 |
|
|
232 |
|
@param |
233 |
|
|
|
|
| 62.5% |
Uncovered Elements: 18 (48) |
Complexity: 13 |
Complexity Density: 0.46 |
|
234 |
1702
|
public void decode(ASN1Object ao) throws CodingException{... |
235 |
1702
|
if (!ao.isA(ASN.SEQUENCE)){ |
236 |
0
|
throw new CodingException("V2Form SEQUENCE tag was expected"); |
237 |
|
} |
238 |
|
|
239 |
1702
|
int i=0; |
240 |
0
|
if (i>=ao.countComponents()) return; |
241 |
|
|
242 |
1702
|
ASN1Object tag=ao.getComponentAt(i++); |
243 |
1702
|
ASN type = tag.getAsnType(); |
244 |
|
|
245 |
1702
|
if (type.getTagClass()!=ASN.CONTEXT_SPECIFIC){ |
246 |
1120
|
issuerName = new GeneralNames(tag); |
247 |
|
|
248 |
1120
|
if (i>=ao.countComponents()) return; |
249 |
538
|
tag = ao.getComponentAt(i++); |
250 |
538
|
type = tag.getAsnType(); |
251 |
|
} |
252 |
|
|
253 |
|
|
254 |
1120
|
if (type.getTagClass()==ASN.CONTEXT_SPECIFIC && type.getTag()==BASECERTIFICATEID_TAG){ |
255 |
538
|
if (AttributeCertificate.USE_IMPLICIT_ENCODING){ |
256 |
538
|
((CON_SPEC)tag).forceImplicitlyTagged(ASN.SEQUENCE); |
257 |
|
} |
258 |
538
|
baseCertificateID = new IssuerSerial(tag.getComponentAt(0)); |
259 |
|
|
260 |
538
|
if (i>=ao.countComponents()) return; |
261 |
0
|
tag = ao.getComponentAt(i++); |
262 |
0
|
type = tag.getAsnType(); |
263 |
|
} |
264 |
|
|
265 |
582
|
if (type.getTagClass()==ASN.CONTEXT_SPECIFIC && type.getTag()==OBJECTDIGESTINFO_TAG){ |
266 |
0
|
if (AttributeCertificate.USE_IMPLICIT_ENCODING){ |
267 |
0
|
((CON_SPEC)tag).forceImplicitlyTagged(ASN.SEQUENCE); |
268 |
|
} |
269 |
0
|
objectDigestInfo = new ObjectDigestInfo(tag.getComponentAt(0)); |
270 |
|
|
271 |
0
|
if (i>=ao.countComponents()) return; |
272 |
|
} |
273 |
|
|
274 |
582
|
throw new CodingException("Unexpected entry in V2Form: "+Integer.toString(ao.countComponents())+" entries found"); |
275 |
|
} |
276 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
277 |
4
|
public String toString(){... |
278 |
4
|
return toString(""); |
279 |
|
} |
280 |
|
|
|
|
| 57.1% |
Uncovered Elements: 3 (7) |
Complexity: 1 |
Complexity Density: 1 |
|
281 |
4
|
public String toString(String indent){... |
282 |
4
|
return "SEQUENCE { -- V2Form --\n "+indent+ |
283 |
4
|
"issuerName = "+((issuerName!=null)?issuerName.toString():"[OPTIONAL; omitted]")+",\n "+indent+ |
284 |
4
|
"baseCertificateID = "+((baseCertificateID!=null)?baseCertificateID.toString():"[OPTIONAL; omitted]")+",\n "+indent+ |
285 |
4
|
"objectDigestInfo = "+((objectDigestInfo!=null)?objectDigestInfo.toString():"[OPTIONAL; omitted]")+",\n"+indent+"}"; |
286 |
|
} |
287 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
288 |
0
|
public Object clone(){... |
289 |
0
|
try{ |
290 |
0
|
return new V2Form(this); |
291 |
|
}catch (CodingException ex){ |
292 |
0
|
ex.printStackTrace(); |
293 |
0
|
return null; |
294 |
|
} |
295 |
|
} |
296 |
|
|
297 |
|
} |