1    package org.bouncycastle.asn1.x509;
2    
3    import org.bouncycastle.asn1.*;
4    
5    public class DistributionPoint
6        implements DEREncodable
7    {
8        ASN1Sequence  seq = null;
9    
10       public static DistributionPoint getInstance(
11           ASN1TaggedObject obj,
12           boolean          explicit)
13       {
14           return getInstance(ASN1Sequence.getInstance(obj, explicit));
15       }
16   
17       public static DistributionPoint getInstance(
18           Object obj)
19       {
20           if(obj == null || obj instanceof DistributionPoint) 
21           {
22               return (DistributionPoint)obj;
23           }
24           
25           if(obj instanceof ASN1Sequence) 
26           {
27               return new DistributionPoint((ASN1Sequence)obj);
28           }
29           
30           throw new IllegalArgumentException("Invalid DistributionPoint: " + obj.getClass().getName());
31       }
32   
33       public DistributionPoint(
34           ASN1Sequence seq)
35       {
36           this.seq = seq;
37       }
38       
39       public DistributionPoint(
40           DistributionPointName   distributionPoint,
41           nFlalass="classRef" href=ReasonFlags_java.html#ReasonFlags>ReasonFlags             reasons,
42           GeneralNames            cRLIssuer)
43       {
44           DEREncodableVector  v = new DEREncodableVector();
45   
46           if (distributionPoint != null)
47           {
48               v.add(new DERTaggedObject(0, distributionPoint));
49           }
50   
51           if (reasons != null)
52           {
53               v.add(new DERTaggedObject(1, reasons));
54           }
55   
56           if (cRLIssuer != null)
57           {
58               v.add(new DERTaggedObject(2, cRLIssuer));
59           }
60   
61           seq = new DERSequence(v);
62       }
63   
64       /**
65        * <pre>
66        * DistributionPoint ::= SEQUENCE {
67        *      distributionPoint [0] DistributionPointName OPTIONAL,
68        *      reasons           [1] ReasonFlags OPTIONAL,
69        *      cRLIssuer         [2] GeneralNames OPTIONAL
70        * }
71        * </pre>
72        */
73       public DERObject getDERObject()
74       {
75           return seq;
76       }
77   }
78