001: /*************************************************************************
002: * *
003: * EJBCA: The OpenSource Certificate Authority *
004: * *
005: * This software is free software; you can redistribute it and/or *
006: * modify it under the terms of the GNU Lesser General Public *
007: * License as published by the Free Software Foundation; either *
008: * version 2.1 of the License, or any later version. *
009: * *
010: * See terms of license at gnu.org. *
011: * *
012: *************************************************************************/package org.ejbca.core.model.ca.caadmin;
013:
014: import java.io.Serializable;
015: import java.util.Collection;
016: import java.util.Date;
017:
018: import org.ejbca.core.model.ca.catoken.CATokenInfo;
019:
020: /**
021: * Holds nonsensitive information about a CA.
022: *
023: * @version $Id: CAInfo.java,v 1.12 2008/02/26 15:37:14 herrvendil Exp $
024: */
025: public class CAInfo implements Serializable {
026:
027: private static final long serialVersionUID = 1L;
028:
029: public static final int CATYPE_X509 = 1;
030:
031: /**
032: * Constants indicating that the CA is selfsigned.
033: */
034: public static final int SELFSIGNED = 1;
035: /**
036: * Constant indicating that the CA is signed by an external CA.
037: */
038: public static final int SIGNEDBYEXTERNALCA = 2;
039:
040: /**
041: * Constant indicating where the special caid border is. All CAs with CA id not below this value
042: * should be created
043: */
044: public static final int SPECIALCAIDBORDER = 10;
045:
046: /**
047: * Constants indicating approvalsettings for this CA
048: */
049: public static final int REQ_APPROVAL_ADDEDITENDENTITY = 1;
050:
051: /**
052: * Constants indicating approvalsettings for key recover this CA
053: */
054: public static final int REQ_APPROVAL_KEYRECOVER = 2;
055:
056: /**
057: * Constants indicating approvalsettings for revocations this CA
058: */
059: public static final int REQ_APPROVAL_REVOCATION = 3;
060:
061: /**
062: * Constants indicating approval settings for activation of CA tokens
063: */
064: public static final int REQ_APPROVAL_ACTIVATECATOKEN = 4;
065:
066: public static final int[] AVAILABLE_APPROVALSETTINGS = {
067: REQ_APPROVAL_ADDEDITENDENTITY, REQ_APPROVAL_KEYRECOVER,
068: REQ_APPROVAL_REVOCATION, REQ_APPROVAL_ACTIVATECATOKEN };
069: public static final String[] AVAILABLE_APPROVALSETTINGS_TEXTS = {
070: "APPROVEADDEDITENDENTITY", "APPROVEKEYRECOVER",
071: "APPROVEREVOCATION", "APACTIVATECATOKEN" };
072:
073: protected String subjectdn;
074: protected int caid;
075: protected String name;
076: protected int status;
077: protected int validity;
078: protected Date expiretime;
079: protected Date updatetime;
080: protected int catype;
081: protected int signedby;
082: protected Collection certificatechain;
083: protected CATokenInfo catokeninfo;
084: protected String description;
085: protected int revokationreason;
086: protected Date revokationdate;
087: protected int certificateprofileid;
088: /** Default value 24 hours */
089: protected int crlperiod = 24;
090: /** Default value 0 */
091: protected int crlIssueInterval = 0;
092: /** Default value 10 minutes */
093: protected int crlOverlapTime = 10;
094: /** Default value 0 = disabled */
095: protected int deltacrlperiod = 0;
096: protected Collection crlpublishers;
097: protected boolean finishuser;
098: protected Collection extendedcaserviceinfos;
099: protected Collection approvalSettings;
100: protected int numOfReqApprovals;
101:
102: public CAInfo() {
103: }
104:
105: public String getSubjectDN() {
106: return subjectdn;
107: }
108:
109: public int getCAId() {
110: return this .caid;
111: }
112:
113: public String getName() {
114: return this .name;
115: }
116:
117: public int getStatus() {
118: return status;
119: }
120:
121: public int getCAType() {
122: return catype;
123: }
124:
125: public int getSignedBy() {
126: return signedby;
127: }
128:
129: public int getValidity() {
130: return validity;
131: }
132:
133: public void setValidity(int validity) {
134: this .validity = validity;
135: }
136:
137: public Date getExpireTime() {
138: return this .expiretime;
139: }
140:
141: public Date getUpdateTime() {
142: return this .updatetime;
143: }
144:
145: /** Retrieves the certificate chain for the CA. The returned certificate chain MUST have the
146: * RootCA certificate in the last position and the CAs certificate in the first.
147: */
148: public Collection getCertificateChain() {
149: return certificatechain;
150: }
151:
152: public CATokenInfo getCATokenInfo() {
153: return this .catokeninfo;
154: }
155:
156: public String getDescription() {
157: return this .description;
158: }
159:
160: public void setDescription(String description) {
161: this .description = description;
162: }
163:
164: public int getRevokationReason() {
165: return this .revokationreason;
166: }
167:
168: public Date getRevokationDate() {
169: return this .revokationdate;
170: }
171:
172: public int getCertificateProfileId() {
173: return this .certificateprofileid;
174: }
175:
176: public int getCRLPeriod() {
177: return crlperiod;
178: }
179:
180: public void setCRLPeriod(int crlperiod) {
181: this .crlperiod = crlperiod;
182: }
183:
184: public int getDeltaCRLPeriod() {
185: return deltacrlperiod;
186: }
187:
188: public void setDeltaCRLPeriod(int deltacrlperiod) {
189: this .deltacrlperiod = deltacrlperiod;
190: }
191:
192: public int getCRLIssueInterval() {
193: return crlIssueInterval;
194: }
195:
196: public void setCRLIssueInterval(int crlissueinterval) {
197: this .crlIssueInterval = crlissueinterval;
198: }
199:
200: public int getCRLOverlapTime() {
201: return crlOverlapTime;
202: }
203:
204: public void setCRLOverlapTime(int crloverlaptime) {
205: this .crlOverlapTime = crloverlaptime;
206: }
207:
208: public Collection getCRLPublishers() {
209: return crlpublishers;
210: }
211:
212: public void setCRLPublishers(Collection crlpublishers) {
213: this .crlpublishers = crlpublishers;
214: }
215:
216: public boolean getFinishUser() {
217: return finishuser;
218: }
219:
220: public void setFinishUser(boolean finishuser) {
221: this .finishuser = finishuser;
222: }
223:
224: /** Lists the extended CA services.
225: *
226: * @return Collection of ExtendedCAServiceInfo
227: */
228: public Collection getExtendedCAServiceInfos() {
229: return this .extendedcaserviceinfos;
230: }
231:
232: public void setExtendedCAServiceInfos(
233: Collection extendedcaserviceinfos) {
234: this .extendedcaserviceinfos = extendedcaserviceinfos;
235: }
236:
237: /**
238: * Returns a collection of Integers (CAInfo.REQ_APPROVAL_ constants) of which
239: * action that requires approvals, default none
240: *
241: * Never null
242: */
243: public Collection getApprovalSettings() {
244: return approvalSettings;
245: }
246:
247: /**
248: * Collection of Integers (CAInfo.REQ_APPROVAL_ constants) of which
249: * action that requires approvals
250: */
251: public void setApprovalSettings(Collection approvalSettings) {
252: this .approvalSettings = approvalSettings;
253: }
254:
255: /**
256: * Returns true if the action requires approvals.
257: * @param action, on of the CAInfo.REQ_APPROVAL_ constants
258: */
259: public boolean isApprovalRequired(int action) {
260: return approvalSettings.contains(new Integer(action));
261: }
262:
263: /**
264: * Returns the number of different administrators that needs to approve
265: * an action, default 1.
266: */
267: public int getNumOfReqApprovals() {
268: return numOfReqApprovals;
269: }
270:
271: /**
272: * The number of different administrators that needs to approve
273: */
274: public void setNumOfReqApprovals(int numOfReqApprovals) {
275: this.numOfReqApprovals = numOfReqApprovals;
276: }
277:
278: }
|