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 |
|
|
|
|
| 45.1% |
Uncovered Elements: 62 (113) |
Complexity: 19 |
Complexity Density: 0.52 |
|
85 |
|
public class Holder implements iaik.asn1.ASN1Type, java.lang.Cloneable { |
86 |
|
public final static int BASECERTIFICATEID_TAG = 0; |
87 |
|
public final static int ENTITYNAME_TAG = 1; |
88 |
|
public final static int OBJECTDIGESTINFO_TAG = 2; |
89 |
|
|
90 |
|
protected IssuerSerial baseCertificateID = null; |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
3558
|
public IssuerSerial getBaseCertificateID(){... |
97 |
3558
|
return baseCertificateID; |
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
0
|
public void setBaseCertificateID(IssuerSerial baseCertificateID){... |
105 |
0
|
this.baseCertificateID=baseCertificateID; |
106 |
|
} |
107 |
|
|
108 |
|
protected GeneralNames entityName = null; |
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
3647
|
public GeneralNames getEntityName(){... |
115 |
3647
|
return entityName; |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
0
|
public void setEntityName(GeneralNames entityName){... |
123 |
0
|
this.entityName=entityName; |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
140 |
0
|
public void setObjectDigestInfo(ObjectDigestInfo objectDigestInfo){... |
141 |
0
|
this.objectDigestInfo=objectDigestInfo; |
142 |
|
} |
143 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
144 |
5998
|
protected Holder() { }... |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
@param |
150 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
151 |
2979
|
public Holder(ASN1Object ao) throws CodingException{... |
152 |
2979
|
decode(ao); |
153 |
|
} |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
162 |
20
|
public Holder(IssuerSerial baseCertificateID, GeneralNames entityName, ObjectDigestInfo objectDigestInfo){... |
163 |
20
|
this.baseCertificateID = baseCertificateID; |
164 |
20
|
this.entityName = entityName; |
165 |
20
|
this.objectDigestInfo = objectDigestInfo; |
166 |
|
} |
167 |
|
|
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
@param |
172 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
173 |
0
|
public Holder(Holder h) throws CodingException{... |
174 |
0
|
baseCertificateID = new IssuerSerial(h.baseCertificateID); |
175 |
0
|
entityName = new GeneralNames(h.entityName.toASN1Object()); |
176 |
0
|
objectDigestInfo = new ObjectDigestInfo(h.objectDigestInfo); |
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
@return |
183 |
|
|
|
|
| 61.1% |
Uncovered Elements: 7 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
184 |
42
|
public ASN1Object toASN1Object() throws CodingException{... |
185 |
42
|
ASN1Object result = new SEQUENCE(); |
186 |
|
|
187 |
42
|
ASN1Object tag; |
188 |
|
|
189 |
42
|
if (baseCertificateID!=null){ |
190 |
0
|
tag = new CON_SPEC(BASECERTIFICATEID_TAG, |
191 |
|
baseCertificateID.toASN1Object(), |
192 |
|
AttributeCertificate.USE_IMPLICIT_ENCODING); |
193 |
|
|
194 |
0
|
result.addComponent(tag); |
195 |
|
} |
196 |
|
|
197 |
42
|
if (entityName!=null){ |
198 |
42
|
tag = new CON_SPEC(ENTITYNAME_TAG, |
199 |
|
entityName.toASN1Object(), |
200 |
|
AttributeCertificate.USE_IMPLICIT_ENCODING); |
201 |
|
|
202 |
42
|
result.addComponent(tag); |
203 |
|
} |
204 |
|
|
205 |
42
|
if (objectDigestInfo!=null){ |
206 |
0
|
tag = new CON_SPEC(OBJECTDIGESTINFO_TAG, |
207 |
|
objectDigestInfo.toASN1Object(), |
208 |
|
AttributeCertificate.USE_IMPLICIT_ENCODING); |
209 |
|
|
210 |
0
|
result.addComponent(tag); |
211 |
|
} |
212 |
|
|
213 |
42
|
return result; |
214 |
|
} |
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
@param |
221 |
|
|
222 |
|
|
|
|
| 40% |
Uncovered Elements: 33 (55) |
Complexity: 15 |
Complexity Density: 0.45 |
|
223 |
2979
|
public void decode(ASN1Object ao) throws CodingException {... |
224 |
2979
|
int i=0; |
225 |
|
|
226 |
2979
|
baseCertificateID=null; |
227 |
2979
|
entityName=null; |
228 |
2979
|
objectDigestInfo=null; |
229 |
|
|
230 |
2979
|
if (!ao.isA(ASN.SEQUENCE)){ |
231 |
0
|
throw new CodingException("Holder SEQUENCE tag was expected"); |
232 |
|
} |
233 |
|
|
234 |
2979
|
if (i>=ao.countComponents()){ |
235 |
0
|
return; |
236 |
|
} |
237 |
|
|
238 |
2979
|
ASN1Object tag = ao.getComponentAt(i++); |
239 |
2979
|
ASN type = tag.getAsnType(); |
240 |
|
|
241 |
2979
|
if (type.getTag()==BASECERTIFICATEID_TAG && type.getTagClass()==ASN.CONTEXT_SPECIFIC){ |
242 |
0
|
if (AttributeCertificate.USE_IMPLICIT_ENCODING){ |
243 |
0
|
((CON_SPEC)tag).forceImplicitlyTagged(ASN.SEQUENCE); |
244 |
|
} |
245 |
|
|
246 |
0
|
baseCertificateID = new IssuerSerial(tag.getComponentAt(0)); |
247 |
|
|
248 |
0
|
if (i>=ao.countComponents()){ |
249 |
0
|
return; |
250 |
|
} |
251 |
0
|
tag = ao.getComponentAt(i++); |
252 |
0
|
type = tag.getAsnType(); |
253 |
|
} |
254 |
|
|
255 |
2979
|
if (type.getTag()==ENTITYNAME_TAG && type.getTagClass()==ASN.CONTEXT_SPECIFIC){ |
256 |
2979
|
if (AttributeCertificate.USE_IMPLICIT_ENCODING){ |
257 |
1120
|
((CON_SPEC)tag).forceImplicitlyTagged(ASN.SEQUENCE); |
258 |
|
} |
259 |
2979
|
entityName = new GeneralNames(tag.getComponentAt(0)); |
260 |
|
|
261 |
2979
|
if (i>=ao.countComponents()){ |
262 |
2979
|
return; |
263 |
|
} |
264 |
0
|
tag = ao.getComponentAt(i++); |
265 |
0
|
type = tag.getAsnType(); |
266 |
|
} |
267 |
|
|
268 |
0
|
if (type.getTag()==OBJECTDIGESTINFO_TAG && type.getTagClass()==ASN.CONTEXT_SPECIFIC){ |
269 |
0
|
if (AttributeCertificate.USE_IMPLICIT_ENCODING){ |
270 |
0
|
((CON_SPEC)tag).forceImplicitlyTagged(ASN.SEQUENCE); |
271 |
|
} |
272 |
0
|
objectDigestInfo = new ObjectDigestInfo(tag.getComponentAt(0)); |
273 |
|
|
274 |
0
|
if (i>=ao.countComponents()){ |
275 |
0
|
return; |
276 |
|
} |
277 |
|
} |
278 |
|
|
279 |
|
|
280 |
0
|
throw new CodingException ("Illegal number of components in Holder tag: "+Integer.toString(ao.countComponents())); |
281 |
|
|
282 |
|
} |
283 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
284 |
0
|
public String toString(){... |
285 |
0
|
return toString(""); |
286 |
|
} |
287 |
|
|
|
|
| 57.1% |
Uncovered Elements: 3 (7) |
Complexity: 1 |
Complexity Density: 1 |
|
288 |
4
|
public String toString(String ident){... |
289 |
4
|
return "SEQUENCE { -- Holder --\n "+ident+ |
290 |
4
|
"baseCertificateID = "+((baseCertificateID!=null)?baseCertificateID.toString(ident+" "):"[OPTIONAL; omitted]")+",\n "+ident+ |
291 |
4
|
"entityname = "+((entityName!=null)?entityName.toString():"[OPTIONAL; omitted]")+",\n "+ident+ |
292 |
4
|
"objectDigestInfo = "+((objectDigestInfo!=null)?objectDigestInfo.toString(ident+" "):"[OPTIONAL; omitted]")+"\n"+ident+"}"; |
293 |
|
} |
294 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
295 |
0
|
public Object clone(){... |
296 |
0
|
try{ |
297 |
0
|
return new Holder(this); |
298 |
|
}catch (CodingException ex){ |
299 |
0
|
ex.printStackTrace(); |
300 |
0
|
return null; |
301 |
|
} |
302 |
|
} |
303 |
|
} |
304 |
|
|
305 |
|
|