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

📄 editcertificateprofiles.jsp

📁 一套JAVA的CA证书签发系统.
💻 JSP
📖 第 1 页 / 共 2 页
字号:
<html><%@page contentType="text/html"%><%@page errorPage="/errorpage.jsp" import="java.util.*, se.anatom.ejbca.webdist.webconfiguration.EjbcaWebBean,se.anatom.ejbca.ra.raadmin.GlobalConfiguration, se.anatom.ejbca.SecConst, se.anatom.ejbca.authorization.AuthorizationDeniedException,               se.anatom.ejbca.webdist.cainterface.CAInterfaceBean, se.anatom.ejbca.ca.store.certificateprofiles.CertificateProfile, se.anatom.ejbca.webdist.cainterface.CertificateProfileDataHandler,                se.anatom.ejbca.ca.exception.CertificateProfileExistsException, se.anatom.ejbca.webdist.rainterface.CertificateView"%><jsp:useBean id="ejbcawebbean" scope="session" class="se.anatom.ejbca.webdist.webconfiguration.EjbcaWebBean" /><jsp:useBean id="cabean" scope="session" class="se.anatom.ejbca.webdist.cainterface.CAInterfaceBean" /><%! // Declarations   static final String ACTION                              = "action";  static final String ACTION_EDIT_CERTIFICATEPROFILES     = "editcertificateprofiles";  static final String ACTION_EDIT_CERTIFICATEPROFILE      = "editcertificateprofile";  static final String CHECKBOX_VALUE           = CertificateProfile.TRUE;//  Used in profiles.jsp  static final String BUTTON_EDIT_CERTIFICATEPROFILES      = "buttoneditcertificateprofile";   static final String BUTTON_DELETE_CERTIFICATEPROFILES    = "buttondeletecertificateprofile";  static final String BUTTON_ADD_CERTIFICATEPROFILES       = "buttonaddcertificateprofile";   static final String BUTTON_RENAME_CERTIFICATEPROFILES    = "buttonrenamecertificateprofile";  static final String BUTTON_CLONE_CERTIFICATEPROFILES     = "buttonclonecertificateprofile";  static final String SELECT_CERTIFICATEPROFILES           = "selectcertificateprofile";  static final String TEXTFIELD_CERTIFICATEPROFILESNAME    = "textfieldcertificateprofilename";  static final String HIDDEN_CERTIFICATEPROFILENAME        = "hiddencertificateprofilename"; // Buttons used in profile.jsp  static final String BUTTON_SAVE              = "buttonsave";  static final String BUTTON_CANCEL            = "buttoncancel";   static final String TEXTFIELD_VALIDITY              = "textfieldvalidity";  static final String TEXTFIELD_CRLDISTURI            = "textfieldcrldisturi";  static final String TEXTFIELD_CERTIFICATEPOLICYID   = "textfieldcertificatepolicyid";  static final String TEXTFIELD_OCSPSERVICELOCATOR    = "textfieldocspservicelocatoruri";  static final String CHECKBOX_BASICCONSTRAINTS                   = "checkboxbasicconstraints";  static final String CHECKBOX_BASICCONSTRAINTSCRITICAL           = "checkboxbasicconstraintscritical";  static final String CHECKBOX_KEYUSAGE                           = "checkboxkeyusage";  static final String CHECKBOX_KEYUSAGECRITICAL                   = "checkboxkeyusagecritical";  static final String CHECKBOX_SUBJECTKEYIDENTIFIER               = "checkboxsubjectkeyidentifier";  static final String CHECKBOX_SUBJECTKEYIDENTIFIERCRITICAL       = "checkboxsubjectkeyidentifiercritical";  static final String CHECKBOX_AUTHORITYKEYIDENTIFIER             = "checkboxauthoritykeyidentifier";  static final String CHECKBOX_AUTHORITYKEYIDENTIFIERCRITICAL     = "checkboxauthoritykeyidentifiercritical";  static final String CHECKBOX_SUBJECTALTERNATIVENAME             = "checkboxsubjectalternativename";  static final String CHECKBOX_SUBJECTALTERNATIVENAMECRITICAL     = "checkboxsubjectalternativenamecritical";  static final String CHECKBOX_CRLDISTRIBUTIONPOINT               = "checkboxcrldistributionpoint";  static final String CHECKBOX_CRLDISTRIBUTIONPOINTCRITICAL       = "checkboxcrldistributionpointcritical";  static final String CHECKBOX_USECERTIFICATEPOLICIES             = "checkusecertificatepolicies";  static final String CHECKBOX_CERTIFICATEPOLICIESCRITICAL        = "checkcertificatepoliciescritical";  static final String CHECKBOX_ALLOWKEYUSAGEOVERRIDE              = "checkallowkeyusageoverride";  static final String CHECKBOX_USEEXTENDEDKEYUSAGE                = "checkuseextendedkeyusage";  static final String CHECKBOX_EXTENDEDKEYUSAGECRITICAL           = "checkboxextendedkeyusagecritical";  static final String CHECKBOX_USEOCSPSERVICELOCATOR              = "checkuseocspservicelocator";  static final String SELECT_AVAILABLEBITLENGTHS                  = "selectavailablebitlengths";  static final String SELECT_KEYUSAGE                             = "selectkeyusage";  static final String SELECT_EXTENDEDKEYUSAGE                     = "selectextendedkeyusage";  static final String SELECT_TYPE                                 = "selecttype";  static final String SELECT_AVAILABLECAS                         = "selectavailablecas";  static final String SELECT_AVAILABLEPUBLISHERS                  = "selectavailablepublishers";  // Declare Language file.%><%   // Initialize environment  String certprofile = null;  String includefile = "certificateprofilespage.jsp";   boolean  triedtoeditfixedcertificateprofile   = false;  boolean  triedtodeletefixedcertificateprofile = false;  boolean  triedtoaddfixedcertificateprofile    = false;  boolean  certificateprofileexists             = false;  boolean  certificateprofiledeletefailed       = false;  GlobalConfiguration globalconfiguration = ejbcawebbean.initialize(request, "/ca_functionality/edit_certificate_profiles");                                             cabean.initialize(request, ejbcawebbean);   String THIS_FILENAME            =  globalconfiguration.getCaPath()  + "/editcertificateprofiles/editcertificateprofiles.jsp";    boolean issuperadministrator = false;  try{    issuperadministrator = ejbcawebbean.isAuthorizedNoLog("/super_administrator");  }catch(AuthorizationDeniedException ade){}     String[] keyusagetexts = CertificateView.KEYUSAGETEXTS;  String[] extendedkeyusagetexts = CertificateView.EXTENDEDKEYUSAGETEXTS;int[]    defaultavailablebitlengths = {512,1024,2048,4096};  %> <head>  <title><%= globalconfiguration .getEjbcaTitle() %></title>  <base href="<%= ejbcawebbean.getBaseUrl() %>">  <link rel=STYLESHEET href="<%= ejbcawebbean.getCssFile() %>">  <script language=javascript src="<%= globalconfiguration .getAdminWebPath() %>ejbcajslib.js"></script></head><body><%  // Determine action   if( request.getParameter(ACTION) != null){    if( request.getParameter(ACTION).equals(ACTION_EDIT_CERTIFICATEPROFILES)){      if( request.getParameter(BUTTON_EDIT_CERTIFICATEPROFILES) != null){          // Display  profilepage.jsp         certprofile = request.getParameter(SELECT_CERTIFICATEPROFILES);         if(certprofile != null){           if(!certprofile.trim().equals("")){             if(!certprofile.endsWith("(FIXED)")){                includefile="certificateprofilepage.jsp";              }else{                triedtoeditfixedcertificateprofile=true;                certprofile= null;             }           }            else{             certprofile= null;          }         }        if(certprofile == null){             includefile="certificateprofilespage.jsp";             }      }      if( request.getParameter(BUTTON_DELETE_CERTIFICATEPROFILES) != null) {          // Delete profile and display profilespage.           certprofile = request.getParameter(SELECT_CERTIFICATEPROFILES);          if(certprofile != null){            if(!certprofile.trim().equals("")){              if(!certprofile.endsWith("(FIXED)")){                 certificateprofiledeletefailed = !cabean.removeCertificateProfile(certprofile);              }else{                triedtodeletefixedcertificateprofile=true;              }            }          }          includefile="certificateprofilespage.jsp";                   }      if( request.getParameter(BUTTON_RENAME_CERTIFICATEPROFILES) != null){          // Rename selected profile and display profilespage.       String newcertificateprofilename = request.getParameter(TEXTFIELD_CERTIFICATEPROFILESNAME);       String oldcertificateprofilename = request.getParameter(SELECT_CERTIFICATEPROFILES);       if(oldcertificateprofilename != null && newcertificateprofilename != null){         if(!newcertificateprofilename.trim().equals("") && !oldcertificateprofilename.trim().equals("")){           if(!oldcertificateprofilename.endsWith("(FIXED)")){              try{               cabean.renameCertificateProfile(oldcertificateprofilename.trim(),newcertificateprofilename.trim());             }catch( CertificateProfileExistsException e){               certificateprofileexists=true;             }           }else{              triedtoeditfixedcertificateprofile=true;           }                 }       }             includefile="certificateprofilespage.jsp";       }      if( request.getParameter(BUTTON_ADD_CERTIFICATEPROFILES) != null){         // Add profile and display profilespage.         certprofile = request.getParameter(TEXTFIELD_CERTIFICATEPROFILESNAME);         if(certprofile != null){           if(!certprofile.trim().equals("")){             if(!certprofile.endsWith("(FIXED)")){               try{                 cabean.addCertificateProfile(certprofile.trim());               }catch( CertificateProfileExistsException e){                 certificateprofileexists=true;               }             }else{               triedtoaddfixedcertificateprofile=true;              }           }               }         includefile="certificateprofilespage.jsp";       }      if( request.getParameter(BUTTON_CLONE_CERTIFICATEPROFILES) != null){         // clone profile and display profilespage.       String newcertificateprofilename = request.getParameter(TEXTFIELD_CERTIFICATEPROFILESNAME);       String oldcertificateprofilename = request.getParameter(SELECT_CERTIFICATEPROFILES);       if(oldcertificateprofilename != null && newcertificateprofilename != null){         if(!newcertificateprofilename.trim().equals("") && !oldcertificateprofilename.trim().equals("")){             if(oldcertificateprofilename.endsWith("(FIXED)"))               oldcertificateprofilename = oldcertificateprofilename.substring(0,oldcertificateprofilename.length()-8);             try{                cabean.cloneCertificateProfile(oldcertificateprofilename.trim(),newcertificateprofilename.trim());             }catch( CertificateProfileExistsException e){               certificateprofileexists=true;             }         }       }                includefile="certificateprofilespage.jsp";       }    }    if( request.getParameter(ACTION).equals(ACTION_EDIT_CERTIFICATEPROFILE)){         // Display edit access rules page.       certprofile = request.getParameter(HIDDEN_CERTIFICATEPROFILENAME);       if(certprofile != null){         if(!certprofile.trim().equals("")){           if(request.getParameter(BUTTON_SAVE) != null){             CertificateProfile certificateprofiledata = cabean.getCertificateProfile(certprofile);             // Save changes.                    String value = request.getParameter(TEXTFIELD_VALIDITY);             if(value != null){               value=value.trim();               if(!value.equals(""))                 certificateprofiledata.setValidity(Long.parseLong(value));             }               boolean use = false;             value = request.getParameter(CHECKBOX_BASICCONSTRAINTS);             if(value != null){                 use = value.equals(CHECKBOX_VALUE);                 certificateprofiledata.setUseBasicConstraints(use);                 value = request.getParameter(CHECKBOX_BASICCONSTRAINTSCRITICAL);                  if(value != null){                   certificateprofiledata.setBasicConstraintsCritical(value.equals(CHECKBOX_VALUE));                 }                  else                   certificateprofiledata.setBasicConstraintsCritical(false);             }             else{                 certificateprofiledata.setUseBasicConstraints(false);                 certificateprofiledata.setBasicConstraintsCritical(false);              }                          use = false;             value = request.getParameter(CHECKBOX_KEYUSAGE);             if(value != null){                 use = value.equals(CHECKBOX_VALUE);                 certificateprofiledata.setUseKeyUsage(use);

⌨️ 快捷键说明

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