KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > ca > caadmin > X509CAInfo


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13  
14 package org.ejbca.core.model.ca.caadmin;
15
16 import java.security.NoSuchProviderException JavaDoc;
17 import java.security.cert.CertificateException JavaDoc;
18 import java.security.cert.X509Certificate JavaDoc;
19 import java.util.ArrayList JavaDoc;
20 import java.util.Collection JavaDoc;
21 import java.util.Date JavaDoc;
22
23 import org.ejbca.core.model.ca.catoken.CATokenInfo;
24 import org.ejbca.util.CertTools;
25 import org.ejbca.util.StringTools;
26
27
28 /**
29  * Holds nonsensitive information about a X509CA.
30  *
31  * @version $Id: X509CAInfo.java,v 1.9.2.1 2007/02/23 10:35:14 anatom Exp $
32  */

33 public class X509CAInfo extends CAInfo{
34    
35   String JavaDoc policyid;
36   boolean useauthoritykeyidentifier;
37   boolean authoritykeyidentifiercritical;
38   boolean usecrlnumber;
39   boolean crlnumbercritical;
40   String JavaDoc defaultcrldistpoint;
41   String JavaDoc defaultcrlissuer;
42   String JavaDoc defaultocsplocator;
43   String JavaDoc subjectaltname;
44   boolean useUTF8PolicyText;
45   boolean usePrintableStringSubjectDN;
46     
47     /**
48      * Constructor that should be used when creating CA and retreiving CA info.
49      */

50     public X509CAInfo(String JavaDoc subjectdn, String JavaDoc name, int status, Date JavaDoc updateTime, String JavaDoc subjectaltname, int certificateprofileid,
51                     int validity, Date JavaDoc expiretime, int catype, int signedby, Collection JavaDoc certificatechain,
52                     CATokenInfo catokeninfo, String JavaDoc description, int revokationreason, Date JavaDoc revokationdate, String JavaDoc policyid, int crlperiod, int crlIssueInterval, int crlOverlapTime, Collection JavaDoc crlpublishers,
53                     boolean useauthoritykeyidentifier, boolean authoritykeyidentifiercritical,
54                     boolean usecrlnumber, boolean crlnumbercritical, String JavaDoc defaultcrldistpoint, String JavaDoc defaultcrlissuer, String JavaDoc defaultocspservicelocator, boolean finishuser,
55                     Collection JavaDoc extendedcaserviceinfos, boolean useUTF8PolicyText, Collection JavaDoc approvalSettings, int numOfReqApprovals, boolean usePrintableStringSubjectDN) {
56         this.subjectdn = StringTools.strip(CertTools.stringToBCDNString(subjectdn));
57         this.caid = this.subjectdn.hashCode();
58         this.name = name;
59         this.status = status;
60         this.updatetime = updateTime;
61         this.validity = validity;
62         this.expiretime = expiretime;
63         this.catype = catype;
64         this.signedby = signedby;
65         // Due to a bug in Glassfish, we need to make sure all certificates in this
66
// Array i of SUNs own provider
67
try {
68             if (certificatechain != null) {
69                 X509Certificate JavaDoc[] certs = (X509Certificate JavaDoc[])certificatechain.toArray(new X509Certificate JavaDoc[0]);
70                 ArrayList JavaDoc list = CertTools.getCertCollectionFromArray(certs, "SUN");
71                 this.certificatechain = list;
72             } else {
73                 this.certificatechain = null;
74             }
75         } catch (CertificateException JavaDoc e) {
76             throw new IllegalArgumentException JavaDoc(e);
77         } catch (NoSuchProviderException JavaDoc e) {
78             throw new IllegalArgumentException JavaDoc(e);
79         }
80         this.catokeninfo = catokeninfo;
81         this.description = description;
82         this.revokationreason = revokationreason;
83         this.revokationdate = revokationdate;
84         this.policyid = policyid;
85         this.crlperiod = crlperiod;
86         this.crlIssueInterval = crlIssueInterval;
87         this.crlOverlapTime = crlOverlapTime;
88         this.crlpublishers = crlpublishers;
89         this.useauthoritykeyidentifier = useauthoritykeyidentifier;
90         this.authoritykeyidentifiercritical = authoritykeyidentifiercritical;
91         this.usecrlnumber = usecrlnumber;
92         this.crlnumbercritical = crlnumbercritical;
93         this.defaultcrldistpoint = defaultcrldistpoint;
94         this.defaultcrlissuer = defaultcrlissuer;
95         this.defaultocsplocator = defaultocspservicelocator;
96         this.finishuser = finishuser;
97         this.subjectaltname = subjectaltname;
98         this.certificateprofileid = certificateprofileid;
99         this.extendedcaserviceinfos = extendedcaserviceinfos;
100         this.useUTF8PolicyText = useUTF8PolicyText;
101         this.approvalSettings = approvalSettings;
102         this.numOfReqApprovals = numOfReqApprovals;
103         this.usePrintableStringSubjectDN = usePrintableStringSubjectDN;
104     }
105
106     /**
107      * Constructor that should be used when updating CA data.
108      */

109     public X509CAInfo(int caid, int validity, CATokenInfo catokeninfo, String JavaDoc description,
110                       int crlperiod, int crlIssueInterval, int crlOverlapTime, Collection JavaDoc crlpublishers,
111                       boolean useauthoritykeyidentifier, boolean authoritykeyidentifiercritical,
112                       boolean usecrlnumber, boolean crlnumbercritical, String JavaDoc defaultcrldistpoint, String JavaDoc defaultcrlissuer, String JavaDoc defaultocspservicelocator,
113                       boolean finishuser, Collection JavaDoc extendedcaserviceinfos,
114                       boolean useUTF8PolicyText, Collection JavaDoc approvalSettings, int numOfReqApprovals, boolean usePrintableStringSubjectDN) {
115         this.caid = caid;
116         this.validity=validity;
117         this.catokeninfo = catokeninfo;
118         this.description = description;
119         this.crlperiod = crlperiod;
120         this.crlIssueInterval = crlIssueInterval;
121         this.crlOverlapTime = crlOverlapTime;
122         this.crlpublishers = crlpublishers;
123         this.useauthoritykeyidentifier = useauthoritykeyidentifier;
124         this.authoritykeyidentifiercritical = authoritykeyidentifiercritical;
125         this.usecrlnumber = usecrlnumber;
126         this.crlnumbercritical = crlnumbercritical;
127         this.defaultcrldistpoint = defaultcrldistpoint;
128         this.defaultcrlissuer = defaultcrlissuer;
129         this.defaultocsplocator = defaultocspservicelocator;
130         this.finishuser = finishuser;
131         this.extendedcaserviceinfos = extendedcaserviceinfos;
132         this.useUTF8PolicyText = useUTF8PolicyText;
133         this.approvalSettings = approvalSettings;
134         this.numOfReqApprovals = numOfReqApprovals;
135         this.usePrintableStringSubjectDN = usePrintableStringSubjectDN;
136     }
137   
138   
139   public X509CAInfo(){}
140     
141   public String JavaDoc getPolicyId(){ return policyid;}
142  
143   public boolean getUseCRLNumber(){ return usecrlnumber;}
144   public void setUseCRLNumber(boolean usecrlnumber){ this.usecrlnumber=usecrlnumber;}
145   
146   public boolean getCRLNumberCritical(){ return crlnumbercritical;}
147   public void setCRLNumberCritical(boolean crlnumbercritical){ this.crlnumbercritical=crlnumbercritical;}
148   
149   public boolean getUseAuthorityKeyIdentifier(){ return useauthoritykeyidentifier;}
150   public void setUseAuthorityKeyIdentifier(boolean useauthoritykeyidentifier)
151                 {this.useauthoritykeyidentifier=useauthoritykeyidentifier;}
152   
153   public boolean getAuthorityKeyIdentifierCritical(){ return authoritykeyidentifiercritical;}
154   public void setAuthorityKeyIdentifierCritical(boolean authoritykeyidentifiercritical)
155                 {this.authoritykeyidentifiercritical=authoritykeyidentifiercritical;}
156   
157   
158   public String JavaDoc getDefaultCRLDistPoint(){ return defaultcrldistpoint; }
159   
160   public String JavaDoc getDefaultCRLIssuer(){ return defaultcrlissuer; }
161   
162   public String JavaDoc getDefaultOCSPServiceLocator(){ return defaultocsplocator; }
163   
164   public String JavaDoc getSubjectAltName(){ return subjectaltname; }
165   
166   public boolean getUseUTF8PolicyText() { return useUTF8PolicyText; }
167   
168   public boolean getUsePrintableStringSubjectDN() { return usePrintableStringSubjectDN; }
169
170   
171 }
Popular Tags