📄 certificateprofile.java
字号:
} } log.debug("CertificateProfile: constructed DN or AltName: " + retval ); return retval; } /** * Returns an ArrayList of OID.strings defined in constant EXTENDEDKEYUSAGEOIDSTRINGS. */ public ArrayList getExtendedKeyUsageAsOIDStrings(){ ArrayList returnval = new ArrayList(); ArrayList eku = (ArrayList) data.get(EXTENDEDKEYUSAGE); Iterator i = eku.iterator(); while(i.hasNext()) returnval.add(EXTENDEDKEYUSAGEOIDSTRINGS[((Integer) i.next()).intValue()]); return returnval; } /** * Returns a Collections of caids (Integer), indicating which CAs the profile should * be applicable to. * * If it contains the constant ANYCA then the profile is applicable to all CAs */ public Collection getAvailableCAs(){ return (Collection) data.get(AVAILABLECAS); } /** * Saves the CertificateProfile's list of CAs the cert profile is applicable to. * * @param availablecas a Collection of caids (Integer) */ public void setAvailableCAs(Collection availablecas){ data.put(AVAILABLECAS, availablecas); } public boolean isApplicableToAnyCA(){ return ((Collection) data.get(AVAILABLECAS)).contains(new Integer(ANYCA)); } /** * Returns a Collection of publisher id's (Integer) indicating which publishers a certificate * created with this profile should be published to. */ public Collection getPublisherList(){ return (Collection) data.get(USEDPUBLISHERS); } /** * Saves the CertificateProfile's list of publishers that certificates created with this profile * should be published to. * * @param publishers a Collection of publisherids (Integer) */ public void setPublisherList(Collection publisher){ data.put(USEDPUBLISHERS, publisher); } /** * Method indicating that Path Length Constain should be used in the BasicConstaint * */ public boolean getUsePathLengthConstraint(){ return ((Boolean) data.get(USEPATHLENGTHCONSTRAINT)).booleanValue(); } /** * Method indicating that Path Length Constain should be used in the BasicConstaint * */ public void setUsePathLengthConstraint(boolean use) { data.put(USEPATHLENGTHCONSTRAINT, Boolean.valueOf(use)); } public int getPathLengthConstraint(){ return ((Integer) data.get(PATHLENGTHCONSTRAINT)).intValue(); } public void setPathLengthConstraint(int pathlength) { data.put(PATHLENGTHCONSTRAINT, new Integer(pathlength)); } public boolean getUseOCSPServiceLocator(){ return ((Boolean) data.get(USEOCSPSERVICELOCATOR)).booleanValue(); } public void setUseOCSPServiceLocator(boolean useocspservicelocator) { data.put(USEOCSPSERVICELOCATOR, Boolean.valueOf(useocspservicelocator));} public boolean getUseDefaultOCSPServiceLocator(){ return ((Boolean) data.get(USEDEFAULTOCSPSERVICELOCATOR)).booleanValue(); } public void setUseDefaultOCSPServiceLocator(boolean usedefaultocspservicelocator) { data.put(USEDEFAULTOCSPSERVICELOCATOR, Boolean.valueOf(usedefaultocspservicelocator));} public String getOCSPServiceLocatorURI(){ return (String) data.get(OCSPSERVICELOCATORURI); } public void setOCSPServiceLocatorURI(String ocspservicelocatoruri) { if(ocspservicelocatoruri==null) data.put(OCSPSERVICELOCATORURI,""); else data.put(OCSPSERVICELOCATORURI,ocspservicelocatoruri); } public boolean getUseQCStatement(){ return ((Boolean) data.get(USEQCSTATEMENT)).booleanValue(); } public void setUseQCStatement(boolean useqcstatement) { data.put(USEQCSTATEMENT, Boolean.valueOf(useqcstatement));} public boolean getUsePkixQCSyntaxV2(){ return ((Boolean) data.get(USEPKIXQCSYNTAXV2)).booleanValue(); } public void setUsePkixQCSyntaxV2(boolean pkixqcsyntaxv2) { data.put(USEPKIXQCSYNTAXV2, Boolean.valueOf(pkixqcsyntaxv2));} public boolean getQCStatementCritical() { return ((Boolean) data.get(QCSTATEMENTCRITICAL)).booleanValue(); } public void setQCStatementCritical(boolean qcstatementcritical) { data.put(QCSTATEMENTCRITICAL, Boolean.valueOf(qcstatementcritical));} public String getQCStatementRAName(){ return (String) data.get(QCSTATEMENTRANAME); } public void setQCStatementRAName(String qcstatementraname) { if(qcstatementraname==null) data.put(QCSTATEMENTRANAME,""); else data.put(QCSTATEMENTRANAME,qcstatementraname); } public String getQCSemanticsId(){ return (String) data.get(QCSSEMANTICSID); } public void setQCSemanticsId(String qcsemanticsid) { if(qcsemanticsid==null) data.put(QCSSEMANTICSID,""); else data.put(QCSSEMANTICSID,qcsemanticsid); } public boolean getUseQCEtsiQCCompliance(){ return ((Boolean) data.get(USEQCETSIQCCOMPLIANCE)).booleanValue(); } public void setUseQCEtsiQCCompliance(boolean useqcetsiqccompliance) { data.put(USEQCETSIQCCOMPLIANCE, Boolean.valueOf(useqcetsiqccompliance));} public boolean getUseQCEtsiValueLimit(){ return ((Boolean) data.get(USEQCETSIVALUELIMIT)).booleanValue(); } public void setUseQCEtsiValueLimit(boolean useqcetsivaluelimit) { data.put(USEQCETSIVALUELIMIT, Boolean.valueOf(useqcetsivaluelimit));} public int getQCEtsiValueLimit(){return ((Integer) data.get(QCETSIVALUELIMIT)).intValue();} public void setQCEtsiValueLimit(int qcetsivaluelimit){data.put(QCETSIVALUELIMIT, new Integer(qcetsivaluelimit));} public int getQCEtsiValueLimitExp(){return ((Integer) data.get(QCETSIVALUELIMITEXP)).intValue();} public void setQCEtsiValueLimitExp(int qcetsivaluelimitexp){data.put(QCETSIVALUELIMITEXP, new Integer(qcetsivaluelimitexp));} public String getQCEtsiValueLimitCurrency(){ return (String) data.get(QCETSIVALUELIMITCURRENCY); } public void setQCEtsiValueLimitCurrency(String qcetsicaluelimitcurrency) { if(qcetsicaluelimitcurrency==null) data.put(QCETSIVALUELIMITCURRENCY,""); else data.put(QCETSIVALUELIMITCURRENCY,qcetsicaluelimitcurrency); } public boolean getUseQCEtsiSignatureDevice(){ return ((Boolean) data.get(USEQCETSISIGNATUREDEVICE)).booleanValue(); } public void setUseQCEtsiSignatureDevice(boolean useqcetsisignaturedevice) { data.put(USEQCETSISIGNATUREDEVICE, Boolean.valueOf(useqcetsisignaturedevice));} public boolean getUseQCCustomString(){ return ((Boolean) data.get(USEQCCUSTOMSTRING)).booleanValue(); } public void setUseQCCustomString(boolean useqccustomstring) { data.put(USEQCCUSTOMSTRING, Boolean.valueOf(useqccustomstring));} public String getQCCustomStringOid(){ return (String) data.get(QCCUSTOMSTRINGOID); } public void setQCCustomStringOid(String qccustomstringoid) { if(qccustomstringoid==null) data.put(QCCUSTOMSTRINGOID,""); else data.put(QCCUSTOMSTRINGOID,qccustomstringoid); } public String getQCCustomStringText(){ return (String) data.get(QCCUSTOMSTRINGTEXT); } public void setQCCustomStringText(String qccustomstringtext) { if(qccustomstringtext==null) data.put(QCCUSTOMSTRINGTEXT,""); else data.put(QCCUSTOMSTRINGTEXT,qccustomstringtext); } public boolean getUseSubjectDirAttributes(){ return ((Boolean) data.get(USESUBJECTDIRATTRIBUTES)).booleanValue(); } public void setUseSubjectDirAttributes(boolean use) { data.put(USESUBJECTDIRATTRIBUTES, Boolean.valueOf(use));} /** * Method returning a list of (Integers) of ids of * used certificate extensions. Never null. * * Autoupgradable method */ public List getUsedCertificateExtensions(){ if(data.get(USEDCERTIFICATEEXTENSIONS) == null){ return new ArrayList(); } return (List) data.get(USEDCERTIFICATEEXTENSIONS); } /** * Method setting a list of used certificate extensions * a list of Integers containing CertificateExtension Id is expected * @param usedCertificateExtensions */ public void setUsedCertificateExtensions(List usedCertificateExtensions) { if(usedCertificateExtensions==null) data.put(USEDCERTIFICATEEXTENSIONS,new ArrayList()); else data.put(USEDCERTIFICATEEXTENSIONS,usedCertificateExtensions); } public Object clone() throws CloneNotSupportedException { CertificateProfile clone = new CertificateProfile(); HashMap clonedata = (HashMap) clone.saveData(); Iterator i = (data.keySet()).iterator(); while(i.hasNext()){ Object key = i.next(); clonedata.put(key, data.get(key)); } clone.loadData(clonedata); return clone; } /** Implemtation of UpgradableDataHashMap function getLatestVersion */ public float getLatestVersion(){ return LATEST_VERSION; } /** * Implemtation of UpgradableDataHashMap function upgrade. */ public void upgrade(){ log.debug(">upgrade"); if(Float.compare(LATEST_VERSION, getVersion()) != 0) { // New version of the class, upgrade String msg = intres.getLocalizedMessage("certprofile.upgrade", new Float(getVersion())); log.info(msg); if(data.get(ALLOWKEYUSAGEOVERRIDE) == null) data.put(ALLOWKEYUSAGEOVERRIDE, Boolean.TRUE); if(data.get(USEEXTENDEDKEYUSAGE) ==null) data.put(USEEXTENDEDKEYUSAGE, Boolean.FALSE); if(data.get(EXTENDEDKEYUSAGE) ==null) data.put(EXTENDEDKEYUSAGE, new ArrayList()); if(data.get(EXTENDEDKEYUSAGECRITICAL) == null) data.put(EXTENDEDKEYUSAGECRITICAL, Boolean.FALSE); if(data.get(AVAILABLECAS) == null){ ArrayList availablecas = new ArrayList(); availablecas.add(new Integer(ANYCA)); data.put(AVAILABLECAS, availablecas); } if(data.get(USEDPUBLISHERS) == null){ data.put(USEDPUBLISHERS, new ArrayList()); } if(data.get(USEOCSPSERVICELOCATOR) == null){ setUseOCSPServiceLocator(false); setOCSPServiceLocatorURI(""); } if(data.get(USEMICROSOFTTEMPLATE) == null){ setUseMicrosoftTemplate(false); setMicrosoftTemplate(""); } if(data.get(USECNPOSTFIX) == null){ setUseCNPostfix(false); setCNPostfix(""); } if(data.get(USESUBJECTDNSUBSET) == null){ setUseSubjectDNSubSet(false); setSubjectDNSubSet(new ArrayList()); setUseSubjectAltNameSubSet(false); setSubjectAltNameSubSet(new ArrayList()); } if(data.get(USEPATHLENGTHCONSTRAINT) == null){ setUsePathLengthConstraint(false); setPathLengthConstraint(0); } if(data.get(USEQCSTATEMENT) == null){ setUseQCStatement(false); setUsePkixQCSyntaxV2(false); setQCStatementCritical(false); setQCStatementRAName(null); setQCSemanticsId(null); setUseQCEtsiQCCompliance(false); setUseQCEtsiSignatureDevice(false); setUseQCEtsiValueLimit(false); setQCEtsiValueLimit(0); setQCEtsiValueLimitExp(0); setQCEtsiValueLimitCurrency(null); } if(data.get(USEDEFAULTCRLDISTRIBUTIONPOINT) == null){ setUseDefaultCRLDistributionPoint(false); setUseDefaultOCSPServiceLocator(false); } if (data.get(POLICY_NOTICE_UNOTICE_TEXT) == null) { setUserNoticeText(null); // This actually isn't nessecary but for the principle we do it } if (data.get(POLICY_NOTICE_CPS_URL) == null) { setCpsUrl(null); // This actually isn't nessecary but for the principle we do it } if (data.get(USEQCCUSTOMSTRING) == null) { setUseQCCustomString(false); setQCCustomStringOid(null); setQCCustomStringText(null); } if (data.get(USESUBJECTDIRATTRIBUTES) == null) { setUseSubjectDirAttributes(false); } if(data.get(ALLOWVALIDITYOVERRIDE) == null) { setAllowValidityOverride(false); } if(data.get(CRLISSUER) == null) { setCRLIssuer(null); // v20 } data.put(VERSION, new Float(LATEST_VERSION)); } log.debug("<upgrade"); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -