initial checkin
[org.ibex.nanogoat.git] / src / org / bouncycastle / asn1 / cms / SignedAttributes.java
1 // Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
2 // Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
3 // Decompiler options: packimports(3) 
4 // Source File Name:   SignedAttributes.java
5
6 package org.bouncycastle.asn1.cms;
7
8 import java.util.Vector;
9 import org.bouncycastle.asn1.*;
10
11 // Referenced classes of package org.bouncycastle.asn1.cms:
12 //            Attribute
13
14 public class SignedAttributes
15     implements DEREncodable
16 {
17
18     public SignedAttributes(Vector vector)
19     {
20         setAttributes(vector);
21     }
22
23     public SignedAttributes(DERConstructedSet derconstructedset)
24     {
25         attributes = derconstructedset;
26     }
27
28     public SignedAttributes(SignedAttributes signedattributes)
29     {
30         attributes = signedattributes.attributes;
31     }
32
33     public static SignedAttributes getInstance(Object obj)
34     {
35         if(obj == null)
36             return null;
37         if(obj instanceof SignedAttributes)
38             return (SignedAttributes)obj;
39         if(obj instanceof DERConstructedSet)
40             return new SignedAttributes((DERConstructedSet)obj);
41         if(obj instanceof DERTaggedObject)
42             return getInstance(((DERTaggedObject)obj).getObject());
43         else
44             throw new IllegalArgumentException("Invalid SignedAttributes");
45     }
46
47     public static SignedAttributes newInstance(Object obj)
48     {
49         if(obj == null)
50             return null;
51         if(obj instanceof SignedAttributes)
52             return new SignedAttributes((SignedAttributes)obj);
53         if(obj instanceof DERConstructedSet)
54             return new SignedAttributes((DERConstructedSet)obj);
55         if(obj instanceof DERTaggedObject)
56             return getInstance(((DERTaggedObject)obj).getObject());
57         else
58             throw new IllegalArgumentException("Invalid SignedAttributes");
59     }
60
61     public Vector getAttributes()
62     {
63         int i = attributes.getSize();
64         Vector vector = new Vector();
65         for(int j = 0; j < i; j++)
66             vector.addElement(Attribute.getInstance(attributes.getObjectAt(j)));
67
68         return vector;
69     }
70
71     private void setAttributes(Vector vector)
72     {
73         int i = vector.size();
74         attributes = new DERConstructedSet();
75         for(int j = 0; j < i; j++)
76             attributes.addObject(Attribute.getInstance(vector.elementAt(j)));
77
78     }
79
80     public DERObject getDERObject()
81     {
82         return attributes;
83     }
84
85     private DERConstructedSet attributes;
86 }