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

📄 edithardtokenprofilejsphelper.java

📁 一套JAVA的CA证书签发系统.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
		   if(profile != null){			 if(!profile.trim().equals("")){			   if(request.getParameter(BUTTON_SAVE) != null ||			      request.getParameter(BUTTON_UPLOADENVELOPETEMP) != null ||				  request.getParameter(BUTTON_UPLOADVISUALTEMP) != null){		             				 if(profiledata == null){               				   String tokentype = request.getParameter(HIDDEN_HARDTOKENTYPE);				   if(tokentype.equals(TYPE_SWEDISHEID))					 profiledata = new SwedishEIDProfile();				   if(tokentype.equals(TYPE_ENCHANCEDEID))					 profiledata = new EnhancedEIDProfile();				 }				 // Save changes.                    				 // General settings   				 String value = request.getParameter(TEXTFIELD_SNPREFIX);				 if(value != null){                              				   value = value.trim();				   profiledata.setHardTokenSNPrefix(value); 				 }				 value = request.getParameter(CHECKBOX_EREASBLE);				 if(value != null){                              				   profiledata.setEreasableToken(value.equals(CHECKBOX_VALUE));				 }else				   profiledata.setEreasableToken(false);				 value = request.getParameter(SELECT_NUMOFTOKENCOPIES);				 if(value != null){                              				   				   profiledata.setNumberOfCopies(Integer.parseInt(value)); 				 }				value = request.getParameter(CHECKBOX_USEIDENTICALPINS);				if(value != null){                              				  profiledata.setGenerateIdenticalPINForCopies(value.equals(CHECKBOX_VALUE));				}else				  profiledata.setGenerateIdenticalPINForCopies(false);				 				 				 if(profiledata instanceof HardTokenProfileWithPINEnvelope){				   value = request.getParameter(SELECT_ENVELOPETYPE);				   if(value != null)                                               					 ((HardTokenProfileWithPINEnvelope) profiledata).setPINEnvelopeType(Integer.parseInt(value));            				   value = request.getParameter(SELECT_NUMOFENVELOPECOPIES);				   if(value != null)                                               					((HardTokenProfileWithPINEnvelope) profiledata).setNumberOfPINEnvelopeCopies(Integer.parseInt(value));					value = request.getParameter(TEXTFIELD_VISUALVALIDITY);					if(value != null)                                        					  ((HardTokenProfileWithPINEnvelope) profiledata).setVisualValidity(Integer.parseInt(value));       													            				   				 }  				 if(profiledata instanceof HardTokenProfileWithVisualLayout){				   HardTokenProfileWithVisualLayout visprof = (HardTokenProfileWithVisualLayout) profiledata;				   value = request.getParameter(SELECT_VISUALLAYOUTTYPE);				   if(value != null)                                        				     visprof.setVisualLayoutType(Integer.parseInt(value));       				 }				 if(profiledata instanceof SwedishEIDProfile){                   SwedishEIDProfile sweprof = (SwedishEIDProfile) profiledata;                   				   value = request.getParameter(SELECT_MINKEYLENGTH);				   if(value!= null){					 int val = Integer.parseInt(value);				   					 sweprof.setMinimumKeyLength(SwedishEIDProfile.CERTUSAGE_SIGN, val);					 sweprof.setMinimumKeyLength(SwedishEIDProfile.CERTUSAGE_AUTHENC, val);					 sweprof.setKeyType(SwedishEIDProfile.CERTUSAGE_SIGN, SwedishEIDProfile.KEYTYPE_RSA);					 sweprof.setKeyType(SwedishEIDProfile.CERTUSAGE_AUTHENC, SwedishEIDProfile.KEYTYPE_RSA);				   }				   	                     value = request.getParameter(SELECT_CERTIFICATEPROFILE + "0");                   if(value!= null)                     sweprof.setCertificateProfileId(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));				   value = request.getParameter(SELECT_PINTYPE + "0");				   if(value!= null)					 sweprof.setPINType(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));                    				   value = request.getParameter(SELECT_CERTIFICATEPROFILE + "1");				   if(value!= null)					 sweprof.setCertificateProfileId(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value));				   value = request.getParameter(SELECT_PINTYPE + "1");				   if(value!= null)				     sweprof.setPINType(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value));                                       				 }				 if(profiledata instanceof EnhancedEIDProfile){				   EnhancedEIDProfile enhprof = (EnhancedEIDProfile) profiledata;				   value = request.getParameter(SELECT_MINKEYLENGTH);				   if(value!= null){				   				   	 int val = Integer.parseInt(value);					 enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_SIGN, val);					 enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_AUTH, val);					 enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_ENC, val);					 enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_SIGN, SwedishEIDProfile.KEYTYPE_RSA);					 enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_ENC, SwedishEIDProfile.KEYTYPE_RSA);					 enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_ENC, SwedishEIDProfile.KEYTYPE_RSA);				   }	  				   				   value = request.getParameter(SELECT_CERTIFICATEPROFILE + "0");				   if(value!= null)					 enhprof.setCertificateProfileId(EnhancedEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));				   value = request.getParameter(SELECT_PINTYPE + "0");				   if(value!= null)					 enhprof.setPINType(EnhancedEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));                   enhprof.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_SIGN, false);                     				   value = request.getParameter(SELECT_CERTIFICATEPROFILE + "1");				   if(value!= null)					 enhprof.setCertificateProfileId(EnhancedEIDProfile.CERTUSAGE_AUTH, Integer.parseInt(value));				   value = request.getParameter(SELECT_PINTYPE + "1");				   if(value!= null)					 enhprof.setPINType(EnhancedEIDProfile.CERTUSAGE_AUTH, Integer.parseInt(value));				   enhprof.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_AUTH, false);				   value = request.getParameter(SELECT_CERTIFICATEPROFILE + "2");				   if(value!= null)					 enhprof.setCertificateProfileId(EnhancedEIDProfile.CERTUSAGE_ENC, Integer.parseInt(value));				   value = request.getParameter(SELECT_PINTYPE + "2");				   if(value!= null)					 enhprof.setPINType(EnhancedEIDProfile.CERTUSAGE_ENC, Integer.parseInt(value));				   				   value = request.getParameter(CHECKBOX_KEYRECOVERABLE + "2");					if(value != null)                              					enhprof.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_ENC, value.equals(CHECKBOX_VALUE));					else					  enhprof.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_ENC, false);				   								 }             				 				 				 if(request.getParameter(BUTTON_SAVE) != null){				   handler.changeHardTokenProfile(profile,profiledata);									   includefile="hardtokenprofilespage.jsp";				 }				 				 if(request.getParameter(BUTTON_UPLOADENVELOPETEMP) != null){				   uploadmode = UPLOADMODE_ENVELOPE;				   includefile="uploadtemplate.jsp";				 }				 if(request.getParameter(BUTTON_UPLOADVISUALTEMP) != null){				   uploadmode =	UPLOADMODE_VISUAL;				   includefile="uploadtemplate.jsp";				 }				 				 			   }			   if(request.getParameter(BUTTON_CANCEL) != null){				  // Don't save changes.				 includefile="hardtokenprofilespage.jsp";			   }			 }		  }		}				if( action.equals(ACTION_CHANGE_PROFILETYPE)){		  this.profilename = request.getParameter(HIDDEN_HARDTOKENPROFILENAME);		  String value = request.getParameter(SELECT_HARDTOKENTYPE);		  if(value!=null){        			int profiletype = Integer.parseInt(value);			switch(profiletype){          			  case SwedishEIDProfile.TYPE_SWEDISHEID :				profiledata = new SwedishEIDProfile();				break;			  case EnhancedEIDProfile.TYPE_ENHANCEDEID:				profiledata =  new EnhancedEIDProfile();				      				break;  					}   		  }		  includefile="hardtokenprofilepage.jsp";		}		if( action.equals(ACTION_UPLOADENVELOPETEMP)){          if(buttonupload){          	if(profiledata instanceof IPINEnvelopeSettings){          	  try{	                BufferedReader br = new BufferedReader(new InputStreamReader(file,"UTF8"));				String filecontent = "";				String nextline = "";				while(nextline!=null){				  nextline = br.readLine();				  if(nextline != null)				    				    filecontent += nextline + "\n";				}                			    ((IPINEnvelopeSettings) profiledata).setPINEnvelopeData(filecontent);			    ((IPINEnvelopeSettings) profiledata).setPINEnvelopeTemplateFilename(filename);			    fileuploadsuccess = true;			  }catch(IOException ioe){			    fileuploadfailed = true;              	 			  }            	 			}          }		  includefile="hardtokenprofilepage.jsp";		}		if( action.equals(ACTION_UPLOADVISUALTEMP)){			if(profiledata instanceof IVisualLayoutSettings){			  try{			  			    BufferedReader br = new BufferedReader(new InputStreamReader(file,"UTF8"));			    String filecontent = "";			    String nextline = "";			    while(nextline!=null){				  nextline = br.readLine();				  if(nextline != null)				    				    filecontent += nextline + "\n";			    }			    ((IVisualLayoutSettings) profiledata).setVisualLayoutData(filecontent);			    ((IVisualLayoutSettings) profiledata).setVisualLayoutTemplateFilename(filename);			    fileuploadsuccess = true;			  }catch(IOException ioe){				fileuploadfailed = true;              	 			  }			}		  includefile="hardtokenprofilepage.jsp";		}									  }      	          return includefile;	    }        public int getProfileType(){    	      int retval = SwedishEIDProfile.TYPE_SWEDISHEID;            if(profiledata instanceof SwedishEIDProfile)        retval = SwedishEIDProfile.TYPE_SWEDISHEID;	      	  if(profiledata instanceof EnhancedEIDProfile)      	retval = EnhancedEIDProfile.TYPE_ENHANCEDEID;	  	      		  return retval;    	    }        // Private fields.    private EjbcaWebBean ejbcawebbean;    private HardTokenInterfaceBean hardtokenbean;    private boolean initialized=false;	public boolean  hardtokenprofileexists       = false;	public boolean  hardtokenprofiledeletefailed = false;    public boolean  issuperadministrator = false;    public boolean  fileuploadsuccess = false;	public boolean  fileuploadfailed  = false;    public HardTokenProfile profiledata = null;	public String profilename = null;	public int uploadmode = 0;	}

⌨️ 快捷键说明

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