2003/02/12 06:21:04
[org.ibex.core.git] / src / org / bouncycastle / asn1 / x509 / GeneralNames.java
1 package org.bouncycastle.asn1.x509;
2
3 import java.util.Enumeration;
4
5 import org.bouncycastle.asn1.*;
6
7 public class GeneralNames
8     implements DEREncodable
9 {
10     ASN1Sequence            seq;
11     boolean                 isInsideImplicit = false;
12
13     public static GeneralNames getInstance(
14         Object  obj)
15     {
16         if (obj == null || obj instanceof GeneralNames)
17         {
18             return (GeneralNames)obj;
19         }
20
21         if (obj instanceof ASN1Sequence)
22         {
23             return new GeneralNames((ASN1Sequence)obj);
24         }
25
26         throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
27     }
28
29     public static GeneralNames getInstance(
30         ASN1TaggedObject obj,
31         boolean          explicit)
32     {
33         return getInstance(ASN1Sequence.getInstance(obj, explicit));
34     }
35
36     public GeneralNames(
37         ASN1Sequence  seq)
38     {
39         this.seq = seq;
40     }
41
42     /*
43      * this is a hack! But it will have to do until the ambiguity rules
44      * get sorted out for implicit/explicit tagging...
45      * @deprecated
46      */
47     public void markInsideImplicit(
48         boolean    isInsideImplicit)
49     {
50         this.isInsideImplicit = isInsideImplicit;
51     }
52
53     /**
54      * <pre>
55      * GeneralNames ::= SEQUENCE SIZE {1..MAX} OF GeneralName
56      * </pre>
57      */
58     public DERObject getDERObject()
59     {
60         return seq;
61     }
62 }