KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > util > asn1 > x509 > IssuingDistributionPoint


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.geronimo.util.asn1.x509;
19
20 import org.apache.geronimo.util.asn1.ASN1Encodable;
21 import org.apache.geronimo.util.asn1.ASN1Sequence;
22 import org.apache.geronimo.util.asn1.ASN1TaggedObject;
23 import org.apache.geronimo.util.asn1.DERBoolean;
24 import org.apache.geronimo.util.asn1.DERObject;
25
26 /**
27  * IssuingDistributionPoint ::= SEQUENCE {
28  * distributionPoint [0] DistributionPointName OPTIONAL,
29  * onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE,
30  * onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE,
31  * onlySomeReasons [3] ReasonFlags OPTIONAL,
32  * indirectCRL [4] BOOLEAN DEFAULT FALSE,
33  * onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
34  */

35 public class IssuingDistributionPoint
36     extends ASN1Encodable
37 {
38     private boolean onlyContainsUserCerts;
39     private boolean onlyContainsCACerts;
40     private boolean indirectCRL;
41     private boolean onlyContainsAttributeCerts;
42
43     private ASN1Sequence seq;
44
45     public static IssuingDistributionPoint getInstance(
46         ASN1TaggedObject obj,
47         boolean explicit)
48     {
49         return getInstance(ASN1Sequence.getInstance(obj, explicit));
50     }
51
52     public static IssuingDistributionPoint getInstance(
53         Object JavaDoc obj)
54     {
55         if (obj == null || obj instanceof IssuingDistributionPoint)
56         {
57             return (IssuingDistributionPoint)obj;
58         }
59         else if (obj instanceof ASN1Sequence)
60         {
61             return new IssuingDistributionPoint((ASN1Sequence)obj);
62         }
63
64         throw new IllegalArgumentException JavaDoc("unknown object in factory");
65     }
66
67     /**
68      * Constructor from ASN1Sequence
69      */

70     public IssuingDistributionPoint(
71         ASN1Sequence seq)
72     {
73         this.seq = seq;
74
75         for (int i = 0; i != seq.size(); i++)
76         {
77             ASN1TaggedObject o = (ASN1TaggedObject)seq.getObjectAt(i);
78
79             switch (o.getTagNo())
80             {
81             case 0:
82                 break;
83             case 1:
84                 onlyContainsUserCerts = DERBoolean.getInstance(o, false).isTrue();
85                 break;
86             case 2:
87                 onlyContainsCACerts = DERBoolean.getInstance(o, false).isTrue();
88                 break;
89             case 3:
90                 break;
91             case 4:
92                 indirectCRL = DERBoolean.getInstance(o, false).isTrue();
93                 break;
94             case 5:
95                 onlyContainsAttributeCerts = DERBoolean.getInstance(o, false).isTrue();
96                 break;
97             default:
98                 throw new IllegalArgumentException JavaDoc("unknown tag in IssuingDistributionPoint");
99             }
100         }
101     }
102
103     public boolean onlyContainsUserCerts()
104     {
105         return onlyContainsUserCerts;
106     }
107
108     public boolean onlyContainsCACerts()
109     {
110         return onlyContainsCACerts;
111     }
112
113     public boolean isIndirectCRL()
114     {
115         return indirectCRL;
116     }
117
118     public boolean onlyContainsAttributeCerts()
119     {
120         return onlyContainsAttributeCerts;
121     }
122
123     public DERObject toASN1Object()
124     {
125         return seq;
126     }
127 }
128
Popular Tags