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 |
|
package issrg.ac.extensions; |
53 |
|
|
54 |
|
import iaik.asn1.*; |
55 |
|
import iaik.asn1.structures.*; |
56 |
|
|
57 |
|
import java.util.Enumeration; |
58 |
|
import java.util.Vector; |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
@author |
63 |
|
|
|
|
| 38.6% |
Uncovered Elements: 54 (88) |
Complexity: 15 |
Complexity Density: 0.47 |
|
64 |
|
public class AttributeAuthorityInformationAccess extends issrg.ac.Extension { |
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
public static final String ATTRIBUTE_AUTHORITY_INFORMATION_ACCESS = "1.2.826.0.1.3344810.10.0"; |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
private static final String id_ad_caIssuer = "1.3.6.1.5.5.7.48.2"; |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
private static final String id_ad_oscp = "1.3.6.1.5.5.7.48.1"; |
81 |
|
|
82 |
|
private static final ObjectID ID_AD_CAISSUER_OID = new ObjectID(AttributeAuthorityInformationAccess.id_ad_caIssuer); |
83 |
|
|
84 |
|
private String [] locations; |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
19
|
public static void registerMe() {... |
93 |
19
|
issrg.ac.Extensions.registerExtension(ATTRIBUTE_AUTHORITY_INFORMATION_ACCESS, AttributeAuthorityInformationAccess.class); |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@param |
101 |
|
|
102 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
0
|
public AttributeAuthorityInformationAccess(AttributeAuthorityInformationAccess e) throws CodingException {... |
104 |
0
|
super(ATTRIBUTE_AUTHORITY_INFORMATION_ACCESS, false, e.getExtensionValue()); |
105 |
|
} |
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
@param |
110 |
|
|
111 |
|
|
112 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
113 |
0
|
public AttributeAuthorityInformationAccess(String [] extnValue) {... |
114 |
0
|
super(ATTRIBUTE_AUTHORITY_INFORMATION_ACCESS, false); |
115 |
0
|
setLocations(extnValue); |
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
@param |
121 |
|
|
122 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
506
|
public AttributeAuthorityInformationAccess(ASN1Object ao) throws CodingException {... |
124 |
506
|
super(ao); |
125 |
|
} |
126 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
127 |
0
|
public Object clone() {... |
128 |
0
|
try { |
129 |
0
|
return new AttributeAuthorityInformationAccess(this); |
130 |
0
|
} catch (CodingException ce) {return null;} |
131 |
|
} |
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
@param |
138 |
|
|
139 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
140 |
506
|
public void decode(ASN1Object ao) throws CodingException {... |
141 |
506
|
super.decode(ao); |
142 |
0
|
if (isCritical()) throw new CodingException("AttributeAuthorityInformationAccess extension MUST be non-critical"); |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
@param |
150 |
|
|
151 |
|
|
|
|
| 69.7% |
Uncovered Elements: 10 (33) |
Complexity: 8 |
Complexity Density: 0.38 |
|
152 |
506
|
public void decodeValue(ASN1Object ao) throws CodingException {... |
153 |
506
|
Vector location = new Vector(); |
154 |
|
|
155 |
506
|
int j = ao.countComponents(); |
156 |
1012
|
for (int i=0; i<j; i++) { |
157 |
506
|
ASN1Object accessDescription = ao.getComponentAt(i); |
158 |
506
|
try{ |
159 |
0
|
if (!(accessDescription instanceof SEQUENCE)) throw new CodingException("Wrong extension value format: SEQUENCE expected"); |
160 |
|
|
161 |
506
|
ASN1Object oid = (ASN1Object) accessDescription.getComponentAt(0); |
162 |
0
|
if (!(oid instanceof ObjectID)) throw new CodingException("Wrong extension value format: OBJECT IDENTIFIER expected"); |
163 |
|
|
164 |
506
|
String id = (String) ((ObjectID) oid).getValue(); |
165 |
506
|
if (!id.equals(id_ad_caIssuer)) { |
166 |
0
|
throw new CodingException("Unsupported OID found in AAIA extension: "+id); |
167 |
|
} |
168 |
|
|
169 |
506
|
ASN1Object generalName = (ASN1Object) accessDescription.getComponentAt(1); |
170 |
506
|
if (!(generalName instanceof CON_SPEC)) { |
171 |
0
|
throw new CodingException("GeneralName was expected as the extension value"); |
172 |
|
} |
173 |
506
|
GeneralName gn = new GeneralName(generalName); |
174 |
506
|
if (gn.getType()!=GeneralName.uniformResourceIdentifier){ |
175 |
0
|
continue; |
176 |
|
} |
177 |
506
|
location.add(gn.getName().toString()); |
178 |
|
}catch(CodingException ce){ |
179 |
|
|
180 |
|
} |
181 |
|
} |
182 |
506
|
setLocations((String [])location.toArray(new String[0])); |
183 |
|
} |
184 |
|
|
185 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
186 |
0
|
public String[] getLocations() {... |
187 |
0
|
return locations; |
188 |
|
} |
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
@param |
194 |
|
|
195 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
196 |
506
|
public void setLocations(String [] s){... |
197 |
506
|
locations=s; |
198 |
|
} |
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
@return |
203 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
204 |
0
|
public ASN1Object encodeValue() throws CodingException{... |
205 |
0
|
String [] urls=getLocations(); |
206 |
0
|
SEQUENCE extnV = new SEQUENCE(); |
207 |
|
|
208 |
0
|
if (urls!=null){ |
209 |
0
|
for (int i=0; i<urls.length; i++){ |
210 |
0
|
GeneralName name = new GeneralName(GeneralName.uniformResourceIdentifier, urls[i]); |
211 |
|
|
212 |
0
|
SEQUENCE accessDesc = new SEQUENCE(); |
213 |
0
|
accessDesc.addComponent(ID_AD_CAISSUER_OID, 0); |
214 |
0
|
accessDesc.addComponent(name.toASN1Object(), 1); |
215 |
0
|
extnV.addComponent(accessDesc); |
216 |
|
} |
217 |
|
} |
218 |
|
|
219 |
0
|
return extnV; |
220 |
|
} |
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
@param |
225 |
|
@return |
226 |
|
|
227 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
228 |
0
|
public String extensionValueToString(String ident){... |
229 |
0
|
String[] b = getLocations(); |
230 |
|
|
231 |
0
|
String a= ""; |
232 |
|
|
233 |
0
|
if (b!=null){ |
234 |
0
|
for (int i = 0; i < b.length; i++) { |
235 |
0
|
if (i>0) a = a.concat(" "); |
236 |
0
|
a = a.concat((String)b[i]); |
237 |
|
} |
238 |
|
}else{ |
239 |
0
|
a="(no locations set)"; |
240 |
|
} |
241 |
0
|
return a; |
242 |
|
} |
243 |
|
} |