1 |
|
package issrg.ac.extensions; |
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 |
|
import iaik.asn1.*; |
49 |
|
import iaik.asn1.structures.*; |
50 |
|
import issrg.pba.PbaException; |
51 |
|
import issrg.utils.WebDAV_DIT; |
52 |
|
|
53 |
|
import java.math.BigInteger; |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 53 (53) |
Complexity: 9 |
Complexity Density: 0.52 |
|
55 |
|
public class NoRevocation extends issrg.ac.Extension{ |
56 |
|
|
57 |
|
public static final String NO_REVOCATION_METHOD_OID = "1.2.826.0.1.3344810.10.3"; |
58 |
|
|
59 |
|
private String rev_loc; |
60 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
0
|
public NoRevocation(ASN1Object ao)throws CodingException{... |
62 |
0
|
super(ao); |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
0
|
public NoRevocation(String location,String subjectDN, BigInteger serial) {... |
66 |
0
|
super(NO_REVOCATION_METHOD_OID,false); |
67 |
|
|
68 |
|
} |
69 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
70 |
0
|
public String getExtensionOID() {... |
71 |
0
|
return NO_REVOCATION_METHOD_OID; |
72 |
|
} |
73 |
|
|
74 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
75 |
0
|
public ASN1Object encodeValue() throws CodingException{... |
76 |
|
|
77 |
0
|
SEQUENCE extnV = new SEQUENCE(); |
78 |
0
|
GeneralName name = new GeneralName(GeneralName.uniformResourceIdentifier, null); |
79 |
|
|
80 |
0
|
SEQUENCE noRevocation = new SEQUENCE(); |
81 |
0
|
noRevocation.addComponent(new ObjectID(NO_REVOCATION_METHOD_OID), 0); |
82 |
0
|
noRevocation.addComponent(name.toASN1Object(), 1); |
83 |
0
|
extnV.addComponent(noRevocation); |
84 |
|
|
85 |
0
|
return extnV; |
86 |
|
} |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0
|
public void decode(ASN1Object ao)throws CodingException{... |
89 |
0
|
super.decode(ao); |
90 |
|
} |
91 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 9 |
Complexity Density: 0.56 |
|
92 |
0
|
public void decodeValue(ASN1Object ao )throws CodingException{... |
93 |
|
|
94 |
0
|
int j = ao.countComponents(); |
95 |
0
|
for (int i=0; i<j; i++) { |
96 |
0
|
ASN1Object accessDescription = ao.getComponentAt(i); |
97 |
0
|
try{ |
98 |
0
|
if ((accessDescription instanceof SEQUENCE)) { |
99 |
0
|
ASN1Object oid = (ASN1Object) accessDescription.getComponentAt(0); |
100 |
0
|
if ((oid instanceof ObjectID)) { |
101 |
|
|
102 |
0
|
String id = (String) ((ObjectID) oid).getValue(); |
103 |
0
|
if (id.equals(NO_REVOCATION_METHOD_OID)) { |
104 |
0
|
ASN1Object generalName = (ASN1Object) accessDescription.getComponentAt(1); |
105 |
0
|
if ((generalName instanceof CON_SPEC)) { |
106 |
0
|
GeneralName gn = new GeneralName(generalName); |
107 |
0
|
if (gn.getType()!=GeneralName.uniformResourceIdentifier){ |
108 |
0
|
continue; |
109 |
|
} |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
} |
114 |
|
} |
115 |
|
} |
116 |
|
}catch(CodingException ce){ |
117 |
0
|
if(isCritical()!=false){ |
118 |
0
|
throw new CodingException("Not possible to decode the ASN1Object values"); |
119 |
|
} |
120 |
|
} |
121 |
|
} |
122 |
|
|
123 |
|
} |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
125 |
0
|
public static void registerMe() {... |
126 |
0
|
issrg.ac.Extensions.registerExtension(NO_REVOCATION_METHOD_OID, WebdavRevocation.class); |
127 |
|
} |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
128 |
0
|
public String extensionValueToString(String indent){... |
129 |
0
|
String result=""; |
130 |
0
|
result =result.concat(indent+"Extension ID: "+extnID+"\n"+indent); |
131 |
0
|
return result; |
132 |
|
} |
133 |
|
|
134 |
|
|
135 |
|
} |