1 13 14 package org.ejbca.core.model.ca.caadmin; 15 16 import java.security.NoSuchProviderException ; 17 import java.security.cert.CertificateException ; 18 import java.security.cert.X509Certificate ; 19 import java.util.ArrayList ; 20 import java.util.Collection ; 21 import java.util.Date ; 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 33 public class X509CAInfo extends CAInfo{ 34 35 String policyid; 36 boolean useauthoritykeyidentifier; 37 boolean authoritykeyidentifiercritical; 38 boolean usecrlnumber; 39 boolean crlnumbercritical; 40 String defaultcrldistpoint; 41 String defaultcrlissuer; 42 String defaultocsplocator; 43 String subjectaltname; 44 boolean useUTF8PolicyText; 45 boolean usePrintableStringSubjectDN; 46 47 50 public X509CAInfo(String subjectdn, String name, int status, Date updateTime, String subjectaltname, int certificateprofileid, 51 int validity, Date expiretime, int catype, int signedby, Collection certificatechain, 52 CATokenInfo catokeninfo, String description, int revokationreason, Date revokationdate, String policyid, int crlperiod, int crlIssueInterval, int crlOverlapTime, Collection crlpublishers, 53 boolean useauthoritykeyidentifier, boolean authoritykeyidentifiercritical, 54 boolean usecrlnumber, boolean crlnumbercritical, String defaultcrldistpoint, String defaultcrlissuer, String defaultocspservicelocator, boolean finishuser, 55 Collection extendedcaserviceinfos, boolean useUTF8PolicyText, Collection 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 try { 68 if (certificatechain != null) { 69 X509Certificate [] certs = (X509Certificate [])certificatechain.toArray(new X509Certificate [0]); 70 ArrayList list = CertTools.getCertCollectionFromArray(certs, "SUN"); 71 this.certificatechain = list; 72 } else { 73 this.certificatechain = null; 74 } 75 } catch (CertificateException e) { 76 throw new IllegalArgumentException (e); 77 } catch (NoSuchProviderException e) { 78 throw new IllegalArgumentException (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 109 public X509CAInfo(int caid, int validity, CATokenInfo catokeninfo, String description, 110 int crlperiod, int crlIssueInterval, int crlOverlapTime, Collection crlpublishers, 111 boolean useauthoritykeyidentifier, boolean authoritykeyidentifiercritical, 112 boolean usecrlnumber, boolean crlnumbercritical, String defaultcrldistpoint, String defaultcrlissuer, String defaultocspservicelocator, 113 boolean finishuser, Collection extendedcaserviceinfos, 114 boolean useUTF8PolicyText, Collection 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 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 getDefaultCRLDistPoint(){ return defaultcrldistpoint; } 159 160 public String getDefaultCRLIssuer(){ return defaultcrlissuer; } 161 162 public String getDefaultOCSPServiceLocator(){ return defaultocsplocator; } 163 164 public String getSubjectAltName(){ return subjectaltname; } 165 166 public boolean getUseUTF8PolicyText() { return useUTF8PolicyText; } 167 168 public boolean getUsePrintableStringSubjectDN() { return usePrintableStringSubjectDN; } 169 170 171 } | Popular Tags |