Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
31   135   9   3.88
14   66   0.52   8
8     2  
1    
 
 
  NoRevocation       Line # 55 31 9 0% 0.0
 
No Tests
 
1    package issrg.ac.extensions;
2   
3    /*
4    * Copyright (c) 2006, University of Kent
5    * All rights reserved.
6    *
7    * Redistribution and use in source and binary forms, with or without
8    * modification, are permitted provided that the following conditions are met:
9    *
10    * Redistributions of source code must retain the above copyright notice, this
11    * list of conditions and the following disclaimer.
12    *
13    * Redistributions in binary form must reproduce the above copyright notice,
14    * this list of conditions and the following disclaimer in the documentation
15    * and/or other materials provided with the distribution.
16    *
17    * 1. Neither the name of the University of Kent nor the names of its
18    * contributors may be used to endorse or promote products derived from this
19    * software without specific prior written permission.
20    *
21    * 2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
22    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24    * PURPOSE ARE DISCLAIMED.
25    *
26    * 3. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33    * POSSIBILITY OF SUCH DAMAGE.
34    *
35    * 4. YOU AGREE THAT THE EXCLUSIONS IN PARAGRAPHS 2 AND 3 ABOVE ARE REASONABLE
36    * IN THE CIRCUMSTANCES. IN PARTICULAR, YOU ACKNOWLEDGE (1) THAT THIS
37    * SOFTWARE HAS BEEN MADE AVAILABLE TO YOU FREE OF CHARGE, (2) THAT THIS
38    * SOFTWARE IS NOT "PRODUCT" QUALITY, BUT HAS BEEN PRODUCED BY A RESEARCH
39    * GROUP WHO DESIRE TO MAKE THIS SOFTWARE FREELY AVAILABLE TO PEOPLE WHO WISH
40    * TO USE IT, AND (3) THAT BECAUSE THIS SOFTWARE IS NOT OF "PRODUCT" QUALITY
41    * IT IS INEVITABLE THAT THERE WILL BE BUGS AND ERRORS, AND POSSIBLY MORE
42    * SERIOUS FAULTS, IN THIS SOFTWARE.
43    *
44    * 5. This license is governed, except to the extent that local laws
45    * necessarily apply, by the laws of England and Wales.
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   
 
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    /** Creates a new instance of WebdavRevocation */
 
61  0 toggle public NoRevocation(ASN1Object ao)throws CodingException{
62  0 super(ao);
63    }
64   
 
65  0 toggle public NoRevocation(String location,String subjectDN, BigInteger serial) {
66  0 super(NO_REVOCATION_METHOD_OID,false);
67   
68    }
69   
 
70  0 toggle public String getExtensionOID() {
71  0 return NO_REVOCATION_METHOD_OID;
72    }
73   
74   
 
75  0 toggle public ASN1Object encodeValue() throws CodingException{
76    //String [] urls=getLocations();
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   
 
88  0 toggle public void decode(ASN1Object ao)throws CodingException{
89  0 super.decode(ao);
90    }
91   
 
92  0 toggle public void decodeValue(ASN1Object ao )throws CodingException{
93    // we may want to check that ao is a SEQUENCE first
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)) { //SEQUENCE is expected
99  0 ASN1Object oid = (ASN1Object) accessDescription.getComponentAt(0);
100  0 if ((oid instanceof ObjectID)) { //The first object of the SEQUENCE should be ObjectID
101   
102  0 String id = (String) ((ObjectID) oid).getValue();
103  0 if (id.equals(NO_REVOCATION_METHOD_OID)) { //only webdav objectIdentifier is supported by now
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; // skip the General Names that are not URLs
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   
 
125  0 toggle public static void registerMe() {
126  0 issrg.ac.Extensions.registerExtension(NO_REVOCATION_METHOD_OID, WebdavRevocation.class);
127    }
 
128  0 toggle public String extensionValueToString(String indent){
129  0 String result="";
130  0 result =result.concat(indent+"Extension ID: "+extnID+"\n"+indent); //On the same line
131  0 return result;
132    }
133   
134   
135    }