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 |
|
@author |
52 |
|
|
53 |
|
|
54 |
|
package issrg.ac.extensions; |
55 |
|
|
56 |
|
import iaik.asn1.*; |
57 |
|
import iaik.asn1.structures.*; |
58 |
|
import issrg.ac.Extension; |
59 |
|
import issrg.ac.Holder; |
60 |
|
|
61 |
|
import issrg.log.ISSRGLevel; |
62 |
|
import issrg.utils.EnvironmentalVariables; |
63 |
|
|
64 |
|
import java.math.BigInteger; |
65 |
|
import java.util.*; |
66 |
|
|
67 |
|
|
68 |
|
|
|
|
| 2% |
Uncovered Elements: 99 (101) |
Complexity: 17 |
Complexity Density: 0.39 |
|
69 |
|
public class AuthorityInformationAccess extends issrg.ac.Extension{ |
70 |
|
|
71 |
|
ArrayList extensions; |
72 |
|
private static String id_pe_authorityInfoAccess = "1.3.6.1.5.5.7"; |
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
73 |
0
|
public AuthorityInformationAccess(){... |
74 |
|
|
75 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
0
|
public AuthorityInformationAccess(ASN1Object ao)throws CodingException{... |
77 |
0
|
super(ao); |
78 |
|
|
79 |
|
} |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0
|
public ArrayList getValues(){... |
82 |
0
|
return extensions; |
83 |
|
} |
84 |
|
|
85 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 4 |
Complexity Density: 0.27 |
|
86 |
0
|
public AuthorityInformationAccess(Map env, String subjectDN, String holderDN, BigInteger serial){... |
87 |
0
|
extnID= id_pe_authorityInfoAccess; |
88 |
0
|
extensions = new ArrayList(); |
89 |
|
|
90 |
|
|
91 |
0
|
String useAAIA = (String) env.get(EnvironmentalVariables.AAIA_LOCATION); |
92 |
0
|
if ((useAAIA != null) && (!useAAIA.equals(""))) { |
93 |
0
|
String location = (String) env.get(EnvironmentalVariables.HOLDER_EDITOR_UTILITY_SERVER); |
94 |
0
|
String aaiaLocation = issrg.utils.CreateAAIALocation.createLocation(location, subjectDN); |
95 |
|
|
96 |
0
|
if (aaiaLocation != null) { |
97 |
0
|
AttributeAuthorityInformationAccess |
98 |
|
ext = new AttributeAuthorityInformationAccess(new String[] {aaiaLocation}); |
99 |
0
|
extensions.add(ext); |
100 |
|
} |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
0
|
String cert_loc = (String)env.get(EnvironmentalVariables.WEBDAV_CERTIFICATE_LOCATION); |
106 |
0
|
WebdavCertificate cert = new WebdavCertificate(cert_loc,holderDN,serial); |
107 |
0
|
extensions.add(cert); |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
0
|
String rev_location = (String)env.get(EnvironmentalVariables.WEBDAV_REVOCATION_LOCATION); |
113 |
0
|
WebdavRevocation rev =new WebdavRevocation(rev_location,holderDN,serial); |
114 |
0
|
extensions.add(rev); |
115 |
|
|
116 |
|
} |
117 |
|
|
118 |
|
|
119 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
120 |
0
|
public ASN1Object encodeValue() throws CodingException{... |
121 |
0
|
SEQUENCE seq = new SEQUENCE(); |
122 |
0
|
SEQUENCE content =new SEQUENCE(); |
123 |
0
|
content.addComponent(new ObjectID(id_pe_authorityInfoAccess)); |
124 |
|
|
125 |
0
|
for(int i=0 ; i<extensions.size();i++){ |
126 |
0
|
System.out.println("Encoding extension number:"+(i+1)); |
127 |
0
|
Extension ext = (Extension)extensions.get(i); |
128 |
0
|
content.addComponent(ext.toASN1Object()); |
129 |
|
} |
130 |
0
|
seq.addComponent(content); |
131 |
0
|
return seq; |
132 |
|
} |
133 |
|
|
134 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
135 |
0
|
public void decode(ASN1Object ao) throws CodingException {... |
136 |
0
|
super.decode(ao); |
137 |
0
|
if (isCritical()) throw new CodingException("AuthorityInformationAccess extension MUST be non-critical"); |
138 |
|
} |
139 |
|
|
|
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 10 |
Complexity Density: 0.38 |
|
140 |
0
|
public void decodeValue(ASN1Object ao) throws CodingException {... |
141 |
|
|
142 |
0
|
ASN1Object accessDescription = ao.getComponentAt(0); |
143 |
0
|
extensions = new ArrayList(); |
144 |
0
|
if ((accessDescription instanceof SEQUENCE)){ |
145 |
0
|
try{ |
146 |
0
|
ASN1Object oid = (ASN1Object) accessDescription.getComponentAt(0); |
147 |
0
|
if ((oid instanceof ObjectID)){ |
148 |
0
|
String id = (String) ((ObjectID) oid).getValue(); |
149 |
0
|
if (id.equals(id_pe_authorityInfoAccess)) { |
150 |
0
|
int numberOfExtensions = accessDescription.countComponents(); |
151 |
0
|
int i=1; |
152 |
0
|
while(i<numberOfExtensions){ |
153 |
0
|
ASN1Object ext = (ASN1Object) accessDescription.getComponentAt(i); |
154 |
0
|
if ((ext instanceof SEQUENCE)) { |
155 |
0
|
ASN1Object sequence = ext.getComponentAt(0); |
156 |
0
|
String objectID= (String)sequence.getValue(); |
157 |
|
|
158 |
0
|
if(objectID.equals(WebdavRevocation.WEBDAV_REVOCATION_METHOD_OID)){ |
159 |
0
|
WebdavRevocation webdavRev =new WebdavRevocation(ext); |
160 |
0
|
extensions.add(webdavRev); |
161 |
0
|
}if(objectID.equals(WebdavCertificate.WEBDAV_CERTIFICATE_METHOD_OID)){ |
162 |
0
|
WebdavCertificate webdavCert =new WebdavCertificate(ext); |
163 |
0
|
extensions.add(webdavCert); |
164 |
0
|
}if(objectID.equals(AttributeAuthorityInformationAccess.ATTRIBUTE_AUTHORITY_INFORMATION_ACCESS)){ |
165 |
0
|
AttributeAuthorityInformationAccess aaia =new AttributeAuthorityInformationAccess(ext); |
166 |
0
|
extensions.add(aaia); |
167 |
|
} |
168 |
|
|
169 |
|
} |
170 |
0
|
i++; |
171 |
|
} |
172 |
|
} |
173 |
|
} |
174 |
|
}catch(Exception ce){ |
175 |
0
|
ce.printStackTrace(); |
176 |
|
|
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
} |
181 |
|
} |
182 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
183 |
0
|
public String extensionValueToString(String indent){... |
184 |
|
|
185 |
0
|
String extension ="\n"; |
186 |
0
|
if(extensions!=null){ |
187 |
0
|
for(int i=0;i<extensions.size();i++){ |
188 |
0
|
String res =((Extension)extensions.get(i)).extensionValueToString(indent); |
189 |
0
|
extension =extension.concat(res+indent); |
190 |
0
|
extension =extension.concat("\n"); |
191 |
|
} |
192 |
|
|
193 |
|
}else{ |
194 |
0
|
System.out.println("Extension was null"); |
195 |
|
} |
196 |
0
|
return extension; |
197 |
|
} |
198 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
199 |
19
|
public static void registerMe() {... |
200 |
19
|
issrg.ac.Extensions.registerExtension(id_pe_authorityInfoAccess, AuthorityInformationAccess.class); |
201 |
|
} |
202 |
|
|
203 |
|
} |