⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 certificateprofile.java

📁 一套JAVA的CA证书签发系统.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    public String getCertificatePolicyId() { return (String) data.get(CERTIFICATEPOLICYID); }    public void  setCertificatePolicyId(String policyid){      if(policyid == null)        data.put(CERTIFICATEPOLICYID,"");      else        data.put(CERTIFICATEPOLICYID,policyid);    }    public int getType(){ return ((Integer) data.get(TYPE)).intValue(); }    public void setType(int type){ data.put(TYPE, new Integer(type)); }    public boolean isTypeCA() { return ((Integer) data.get(TYPE)).intValue() == TYPE_SUBCA; }    public boolean isTypeRootCA() { return ((Integer) data.get(TYPE)).intValue() == TYPE_ROOTCA; }    public boolean isTypeEndEntity() { return ((Integer) data.get(TYPE)).intValue() == TYPE_ENDENTITY; }    public int[] getAvailableBitLengths(){      ArrayList availablebitlengths = (ArrayList) data.get(AVAILABLEBITLENGTHS);      int[] returnval = new int[availablebitlengths.size()];      for(int i=0; i < availablebitlengths.size(); i++){        returnval[i] = ((Integer) availablebitlengths.get(i)).intValue();      }      return returnval;    }    public void setAvailableBitLengths(int[] availablebitlengths){      ArrayList availbitlengths = new ArrayList(availablebitlengths.length);      int minimumavailablebitlength = 99999999;      int maximumavailablebitlength = 0;      for(int i=0;i< availablebitlengths.length;i++){        if( availablebitlengths[i] > maximumavailablebitlength)          maximumavailablebitlength = availablebitlengths[i];        if( availablebitlengths[i] < minimumavailablebitlength)          minimumavailablebitlength = availablebitlengths[i];        availbitlengths.add(new Integer(availablebitlengths[i]));      }      data.put(AVAILABLEBITLENGTHS, availbitlengths);      data.put(MINIMUMAVAILABLEBITLENGTH, new Integer(minimumavailablebitlength));      data.put(MAXIMUMAVAILABLEBITLENGTH, new Integer(maximumavailablebitlength));    }    public int getMinimumAvailableBitLength(){return ((Integer) data.get(MINIMUMAVAILABLEBITLENGTH)).intValue();}    public int getMaximumAvailableBitLength(){return ((Integer) data.get(MAXIMUMAVAILABLEBITLENGTH)).intValue();}    public boolean[] getKeyUsage(){      ArrayList keyusage = (ArrayList) data.get(KEYUSAGE);      boolean[] returnval = new boolean[keyusage.size()];      for(int i=0; i < keyusage.size(); i++){        returnval[i] = ((Boolean) keyusage.get(i)).booleanValue();      }      return returnval;    }    public boolean getKeyUsage(int keyusageconstant){      return ((Boolean) ((ArrayList) data.get(KEYUSAGE)).get(keyusageconstant)).booleanValue();    }    public void setKeyUsage(boolean[] keyusage){      ArrayList keyuse = new ArrayList(keyusage.length);      for(int i=0;i< keyusage.length;i++){        keyuse.add(Boolean.valueOf(keyusage[i]));      }      data.put(KEYUSAGE, keyuse);    }    public void setKeyUsage(int keyusageconstant, boolean value){      ((ArrayList) data.get(KEYUSAGE)).set(keyusageconstant, Boolean.valueOf(value));    }    public void setAllowKeyUsageOverride(boolean override) {        data.put(ALLOWKEYUSAGEOVERRIDE, Boolean.valueOf(override));    }    public boolean getAllowKeyUsageOverride() {        return ((Boolean) data.get(ALLOWKEYUSAGEOVERRIDE)).booleanValue();    }    public void setUseExtendedKeyUsage(boolean use) {        data.put(USEEXTENDEDKEYUSAGE, Boolean.valueOf(use));    }    public boolean getUseExtendedKeyUsage() {        return ((Boolean) data.get(USEEXTENDEDKEYUSAGE)).booleanValue();    }    public void setExtendedKeyUsageCritical(boolean critical) {        data.put(EXTENDEDKEYUSAGECRITICAL, Boolean.valueOf(critical));    }    public boolean getExtendedKeyUsageCritical() {        return ((Boolean) data.get(EXTENDEDKEYUSAGECRITICAL)).booleanValue();    }    /**     * Extended Key Usage is an arraylist of constant Integers.     */    public void setExtendedKeyUsage(ArrayList extendedkeyusage) {        data.put(EXTENDEDKEYUSAGE, extendedkeyusage);    }    /**     * Extended Key Usage is an arraylist of constant Integers.     */    public ArrayList getExtendedKeyUsage() {        return (ArrayList) data.get(EXTENDEDKEYUSAGE);    }    /**     * 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);       }       		public boolean getUseOCSPServiceLocator(){ return ((Boolean) data.get(USEOCSPSERVICELOCATOR)).booleanValue(); }	public void setUseOCSPServiceLocator(boolean useocspservicelocator) { data.put(USEOCSPSERVICELOCATOR, Boolean.valueOf(useocspservicelocator));}	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 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(LATEST_VERSION != getVersion()){            // New version of the class, upgrade            log.info("upgrading certificateprofile with version "+getVersion());            data.put(VERSION, new Float(LATEST_VERSION));            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("");            }        }        log.debug("<upgrade");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -