diff -urN ../../312/ejbca/Changelog.txt ./Changelog.txt --- ../../312/ejbca/Changelog.txt Thu Aug 18 16:36:46 2005 +++ ./Changelog.txt Wed Nov 30 10:01:29 2005 @@ -1,3 +1,49 @@ +3.1.3 +--- +Bug + * [ECA-75] - SCEP not working with Hard token CAs (HSMs) + * [ECA-107] - can't view logs using oracle due to column 'comment' + * [ECA-139] - It is not possible to use a HSM to sign a pkcs10 req to an external root CA. + * [ECA-141] - Unstable default idle-timeout for datasource + * [ECA-144] - Scep not working with Cryptlib + * [ECA-145] - Bug in hard token profile pages, Nullpointer when changing profile type or saving new pages + * [ECA-147] - Star (*) not working in subject alt names + * [ECA-148] - Scep not working with Cisco PIX + * [ECA-149] - unstructuredName/address in DN does not work + * [ECA-153] - cli not working on windows when java_home contains space char + * [ECA-154] - install does not work when JAVA_HOME contain space char + * [ECA-155] - OCSP using CA key does not work with HSMs + * [ECA-156] - binary chars in ejbca-mail-service.xml + * [ECA-160] - display of mail.smtp.host during ant deploy is wrong (cosmetic) + * [ECA-165] - Not possible to remove UnstructuredName from entity profile + * [ECA-167] - CN Postfix doesn't work if UID have the same value or DN is reversed + * [ECA-168] - Hard Token SN search doesn't work with primecard 1.3 > + * [ECA-169] - Hard Token Profiles cannot be cloned + * [ECA-170] - Malformed SVG Template craches the Hard Token Profile pages + * [ECA-171] - Typo in language file + * [ECA-176] - Method CertUtil.getEMailAddress(X509Certificate certificate) hangs jboss + * [ECA-177] - SCEP not working with Netscreen/Juniper boxes + * [ECA-180] - Select, unselect javascript features doesn't work anymort + +New Feature + * [ECA-109] - Support RSASSA-PSS signatures + * [ECA-140] - Add $UID as a variable to the SVG templates + * [ECA-181] - Javascript checks use unicode for internationlized chars + * [ECA-182] - Possible to select a subset of fields in DN and Subject AltNames in the certificate profiles + * [ECA-186] - Possibility to specify the BasicConstraint path length + +Task + * [ECA-127] - Add references of installations to EJBCA home page + +Improvement + * [ECA-146] - Device schema for sun directory server missing X-ORIGIN + * [ECA-159] - Not possible to view historical data in CertReqHistory + * [ECA-161] - easy configuration of smtp auth + * [ECA-163] - Describe how to install com.mysql.jdbc.Driver in the documentation + * [ECA-178] - Better error messages when HSM provider not found + * [ECA-183] - Possible to configure for different JBoss targets + * [ECA-185] - new version of batik lib + 3.1.2 --- New Feature diff -urN ../../312/ejbca/bin/cli.xml ./bin/cli.xml --- ../../312/ejbca/bin/cli.xml Tue Jun 14 14:20:31 2005 +++ ./bin/cli.xml Sun Sep 25 11:30:28 2005 @@ -81,8 +81,8 @@ - - + + diff -urN ../../312/ejbca/bin/ejbca.cmd ./bin/ejbca.cmd --- ../../312/ejbca/bin/ejbca.cmd Tue May 3 18:34:20 2005 +++ ./bin/ejbca.cmd Sun Sep 25 11:17:38 2005 @@ -85,6 +85,6 @@ shift set m=%9 rem echo %a% %b% %c% %d% %e% %f% %g% %h% %i% %j% %k% %l% %m% -%JAVA_HOME%\bin\java -cp %CLASSPATH% %class_name% %a% %b% %c% %d% %e% %f% %g% %h% %i% %j% %k% %l% %m% +"%JAVA_HOME%\bin\java" -cp %CLASSPATH% %class_name% %a% %b% %c% %d% %e% %f% %g% %h% %i% %j% %k% %l% %m% :end diff -urN ../../312/ejbca/bin/jboss.xml ./bin/jboss.xml --- ../../312/ejbca/bin/jboss.xml Mon May 9 17:34:38 2005 +++ ./bin/jboss.xml Fri Nov 25 10:09:13 2005 @@ -2,12 +2,12 @@ - - - - - - + + + + + + @@ -38,7 +38,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -85,7 +85,7 @@ - + diff -urN ../../312/ejbca/build.xml ./build.xml --- ../../312/ejbca/build.xml Thu Aug 18 16:32:07 2005 +++ ./build.xml Fri Nov 25 10:09:10 2005 @@ -3,7 +3,7 @@ - + @@ -14,6 +14,8 @@ net it checks the properties file here. --> + + @@ -63,7 +65,7 @@ - + @@ -71,7 +73,9 @@ - + + + @@ -113,8 +117,9 @@ - - + + + @@ -136,6 +141,7 @@ ---------- ${app.version} CONFIGURATION PROPERTIES ---------- jboss.home = ${jboss.home} +java.ver = ${java.ver} ca.keystorepass = ${ca.keystorepass} ca.ocspkeystorepass = ${ca.ocspkeystorepass} ocsp.defaultresponder = ${ocsp.defaultresponder} @@ -153,8 +159,8 @@ mail.message = ${mail.message} mail.user = ${mail.user} mail.password = ${mail.password} -mail.pop3 = ${mail.pop3} -mail.smtp = ${mail.smtp} +mail.smtp.host = ${mail.smtp.host} +mail.smtp.auth = ${mail.smtp.auth} mail.debug = ${mail.debug} httpserver.pubhttp = ${httpserver.pubhttp} httpserver.pubhttps = ${httpserver.pubhttps} @@ -263,6 +269,7 @@ + @@ -289,6 +296,12 @@ + Ignore warnings about 'Couldn't find file' during preprocessing if you are running jdk 1.4 + + + + + - + @@ -536,7 +549,7 @@ - + @@ -654,11 +667,11 @@ - + - + diff -urN ../../312/ejbca/doc/RELEASE_NOTES ./doc/RELEASE_NOTES --- ../../312/ejbca/doc/RELEASE_NOTES Thu Aug 18 16:36:46 2005 +++ ./doc/RELEASE_NOTES Sun Nov 27 12:12:33 2005 @@ -1,10 +1,45 @@ +EJBCA V3.1.3 +------------ +This is a minor release with some new features and some bugfixes. +Read the changelog for details. + +This is a plugin-upgrade from 3.1.2. +Simply keep/copy ejbca.properties from the earlier installation, +copy the directory 'p12' from the earlier installation and 'ant deploy' +(or deploywithjbossservice) this new one. + +Note that to fix ECA-144, 148 and 75, new version of lib/bcmail*.jar and +lib/bcprov*.jar are used. Since they are binary files they are not +included in the patch from version 3.1.2 to 3.1.3. You can use the patch and +manually replace the jar-files from the full distribution. + +The 3.1.3 release have support for RSASSA-PSS signatures to conform to the +Swedish standard for MRTD certificates (Electronic Passports). +The RSASSA-PSS parameters can be seen and edited in the file +src/java/se/anatom/ejbca/ca/caadmin/ExtendedX509Util.java.15 + +IMPORTANT, compliation using jdk1.5 is required for this algorithm. +Otherwise this algorithm option won't show up + +Enhanced support for international characters in the adminweb gui (Add/Edit pages). +Should work with most languages now. + +It's now also possible to select a subset of a users SubjectDN and SubjectAltName +fields used in a particular kind of certificate. This is defined in the certificate profiles + + EJBCA V3.1.2 ------------ -This is a minor release with a few minor new features and some bugfixes. +This is a minor release with two new features and some bugfixes. Read the changelog for details. This is a plugin-upgrade from 3.1/3.1.1. Simply keep ejbca.properties from the earlier release, and 'ant deploy' this new one. + +Note that to fix ECA-126, new version of lib/bcmail-jdk14.jar and +lib/bcprov-jdk14.jar are used. Since they are binary files they are not +included in the patch from version 3.1 to 3.1.2. You can use the patch and +manually replace the jar-files. EJBCA V3.1.1 ------------ diff -urN ../../312/ejbca/doc/howto/HOWTO-database.txt ./doc/howto/HOWTO-database.txt --- ../../312/ejbca/doc/howto/HOWTO-database.txt Fri May 20 13:02:52 2005 +++ ./doc/howto/HOWTO-database.txt Fri Nov 25 09:22:51 2005 @@ -95,7 +95,8 @@ Typically for mysql: 'mysqladmin create ejbca' will create the database. Start 'mysql -u root mysql' and create the user with "grant all on ejbca.* to ejbca@'' identified by ''". -3. Put the JDBC driver for the database in /server/default/lib/. +3. Put the JDBC driver for the database in /server/default/lib/ (or replace default if you are running + another JBoss target, perhaps all?). 4. DONE! Start JBoss. Run tests with 'ant test:run'. Use your favorite database graphic editor to look at the beautiful database tables. @@ -109,6 +110,11 @@ Download JDBC driver for mySQL from http://www.mysql.com/ +Sometimes there can be problems with MySQL related to case sensitivity of database tables. +If you run into this see: +http://mysqld.active-venture.com/Name_case_sensitivity.html +http://dev.mysql.com/doc/refman/4.1/en/name-case-sensitivity.html + PostgreSQL specifics -------------------- EJBCA have been tested with PostgreSQL 7.2 and 8.0. @@ -128,9 +134,19 @@ The JDBC-driver from http://www.datadirect.com/ also works fine, but it's not for free. JDBC driver: ojdbc14.zip -Use latest driver from at least Oracle 10 that can be downloaded from http://www.oracle.com/. +Use latest driver from at least Oracle 10 that can be downloaded from http://www.oracle.com/. +We also had reports that some version of the Oracle 10 driver does not work, but that the driver +from Oracle 9.2i works. Since oracles JDBC driver seems to be of such bad quality, we have to +recommend that you try different versions until you find one that works...or use another database. +Version 10.1.0.4.0 is confirmed to work. MS-SQL specifics ---------------- -JDBC driver: http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/MSDN-FILES/027/001/779/msdncompositedoc.xml&frame=true +Microsofts JDBC driver: +http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/MSDN-FILES/027/001/779/msdncompositedoc.xml&frame=true + +There is also an open source JDBC driver at: +http://jtds.sourceforge.net/ +This driver is not tested by us (yet), but it has received very good reviews as beeing much better than Microsofts +driver, so I suggest you take it for a spin. diff -urN ../../312/ejbca/doc/ldapschema/85ejbca.ldif ./doc/ldapschema/85ejbca.ldif --- ../../312/ejbca/doc/ldapschema/85ejbca.ldif Sun Feb 20 17:56:55 2005 +++ ./doc/ldapschema/85ejbca.ldif Thu Sep 15 10:05:26 2005 @@ -30,6 +30,7 @@ NAME 'ejbcaDeviceCertificate' DESC 'Cerfificate for devices' SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 + X-ORIGIN 'EJBCA' ) # #******************************************************************** @@ -51,6 +52,7 @@ AUXILIARY MUST ( ejbcaDeviceCertificate ) MAY ( description ) + X-ORIGIN 'EJBCA' ) # #******************************************************************** diff -urN ../../312/ejbca/doc/xdocs/index.xml ./doc/xdocs/index.xml --- ../../312/ejbca/doc/xdocs/index.xml Mon Jun 13 11:46:42 2005 +++ ./doc/xdocs/index.xml Thu Aug 18 21:35:38 2005 @@ -8,7 +8,7 @@
- EJBCA 3.1.0 is now available for download.

diff -urN ../../312/ejbca/ejbca.properties.sample ./ejbca.properties.sample --- ../../312/ejbca/ejbca.properties.sample Fri Jun 10 08:50:12 2005 +++ ./ejbca.properties.sample Fri Nov 25 10:09:10 2005 @@ -1,5 +1,5 @@ # -# $Id: ejbca.properties.sample,v 1.21 2005/06/10 06:50:12 anatom Exp $ +# $Id: ejbca.properties.sample,v 1.21.2.6 2005/11/25 09:09:10 primelars Exp $ # # This is a sample file to override properties used # during development (or deployment) of EJBCA @@ -17,6 +17,10 @@ # default: javac #build.compiler=jikes +# which java version to use 14 for 1.4 and 15 for 1.5 +# default: 14 +java.ver =14 + # ------------ Basic CA configuration --------------------- # When upgrading, the important options are: # - ca.keystorepass @@ -103,11 +107,14 @@ # Default 8443 #httpserver.privhttps=8443 -# Defines the available languages by languagecodes separated with a comma (example EN,CH). +# Defines the available languages by languagecodes separated with a comma (example EN,ZH). +# If you are not sure that you know how to add a new language (languagefile.XX.properties etc), +# we suggest you stick with the default the first time you install if you wan't to add your own language. +# Otherwise you may not be able to log in to the admin-GUI. # Default: EN,FR,IT,ES #web.availablelanguages=EN,FR,IT,ES -# Default content encoding used to display JSP pages. +# Default content encoding used to display JSP pages, for example ISO-8859-1 or UTF-8. # Default: ISO-8859-1 #web.contentencoding=ISO-8859-1 @@ -184,12 +191,13 @@ #mail.user=ejbca_user #mail.password=primekey -# POP3 and SMTP servers. +# SMTP server for sending mail. # Default: localhost -#mail.pop3.host=localhost #mail.smtp.host=localhost -#mail.pop3.host=pop3.domain.com -#mail.smtp.host=smtp.domain.com + +# Use SMTP authentication if you smtp host requires it +# Default: false +#mail.smtp.auth=false # Email address used to send emails. # Default: ejbca-donotreply@domain.com @@ -204,7 +212,16 @@ #mail.subject=Retrieve your certificate # Defines the default message of the notification. -# Use the values $Username, $Password, $CN, $O, $OU, $C, $DATE to indicate which texts -# that should be replaced (Case insensitive), $NL stands for newline. +# Use the values ${USERNAME}, ${PASSWORD}, ${CN}, ${O}, ${OU}, ${C}, ${DATE} to indicate which texts +# that should be replaced (Case sensitive), ${NL} stands for newline. # Default: below -#mail.message=Hello $CN$NL$NL This is a notification. $NL$NL Your username: $Username$NL password: $Password$NL$NL Your are NOT supposed to go and fetch your certificate, this is only a test. +#mail.message=Hello ${CN}${NL}${NL} This is a notification. ${NL}${NL} Your username: ${USERNAME}${NL} password: ${PASSWORD}${NL}${NL} Your are NOT supposed to go and fetch your certificate, this is only a test. + +# ----------------- cluster configuration ---------------- +# The configuration. Use "all" when clustering. +# Default: default +#jboss.config=all + +# Name of the farm directory. Use "farm" when clustering. +# Default: deploy +#jboss.farm.name=farm \ No newline at end of file Binary files ../../312/ejbca/lib/batik-awt-util.jar and ./lib/batik-awt-util.jar differ Binary files ../../312/ejbca/lib/batik-bridge.jar and ./lib/batik-bridge.jar differ Binary files ../../312/ejbca/lib/batik-css.jar and ./lib/batik-css.jar differ Binary files ../../312/ejbca/lib/batik-dom.jar and ./lib/batik-dom.jar differ Binary files ../../312/ejbca/lib/batik-ext.jar and ./lib/batik-ext.jar differ Binary files ../../312/ejbca/lib/batik-gvt.jar and ./lib/batik-gvt.jar differ Binary files ../../312/ejbca/lib/batik-parser.jar and ./lib/batik-parser.jar differ Binary files ../../312/ejbca/lib/batik-script.jar and ./lib/batik-script.jar differ Binary files ../../312/ejbca/lib/batik-svg-dom.jar and ./lib/batik-svg-dom.jar differ Binary files ../../312/ejbca/lib/batik-svggen.jar and ./lib/batik-svggen.jar differ Binary files ../../312/ejbca/lib/batik-transcoder.jar and ./lib/batik-transcoder.jar differ Binary files ../../312/ejbca/lib/batik-util.jar and ./lib/batik-util.jar differ Binary files ../../312/ejbca/lib/batik-xml.jar and ./lib/batik-xml.jar differ Binary files ../../312/ejbca/lib/bcmail-jdk14.jar and ./lib/bcmail-jdk14.jar differ Binary files ../../312/ejbca/lib/bcmail-jdk15.jar and ./lib/bcmail-jdk15.jar differ Binary files ../../312/ejbca/lib/bcprov-jdk14.jar and ./lib/bcprov-jdk14.jar differ Binary files ../../312/ejbca/lib/bcprov-jdk15.jar and ./lib/bcprov-jdk15.jar differ diff -urN ../../312/ejbca/src/adminweb/ca/editcas/editcas.jsp ./src/adminweb/ca/editcas/editcas.jsp --- ../../312/ejbca/src/adminweb/ca/editcas/editcas.jsp Mon Nov 8 13:59:31 2004 +++ ./src/adminweb/ca/editcas/editcas.jsp Thu Nov 24 22:16:37 2005 @@ -1,817 +1,817 @@ -<%@ page pageEncoding="ISO-8859-1"%> -<%@page errorPage="/errorpage.jsp" import="java.util.*, java.io.*, org.apache.commons.fileupload.*, se.anatom.ejbca.webdist.webconfiguration.EjbcaWebBean,se.anatom.ejbca.ra.raadmin.GlobalConfiguration, se.anatom.ejbca.SecConst, se.anatom.ejbca.util.FileTools, se.anatom.ejbca.util.CertTools, se.anatom.ejbca.authorization.AuthorizationDeniedException, - se.anatom.ejbca.webdist.cainterface.CAInterfaceBean, se.anatom.ejbca.ca.caadmin.CAInfo, se.anatom.ejbca.ca.caadmin.X509CAInfo, se.anatom.ejbca.ca.caadmin.CATokenInfo, se.anatom.ejbca.ca.caadmin.SoftCATokenInfo, se.anatom.ejbca.webdist.cainterface.CADataHandler, - se.anatom.ejbca.webdist.rainterface.RevokedInfoView, se.anatom.ejbca.ca.caadmin.CATokenInfo, se.anatom.ejbca.ca.caadmin.SoftCATokenInfo, se.anatom.ejbca.webdist.webconfiguration.InformationMemory, org.bouncycastle.asn1.x509.X509Name, org.bouncycastle.jce.PKCS10CertificationRequest, - se.anatom.ejbca.protocol.PKCS10RequestMessage, se.anatom.ejbca.ca.exception.CAExistsException, se.anatom.ejbca.ca.exception.CADoesntExistsException, se.anatom.ejbca.ca.exception.CATokenOfflineException, se.anatom.ejbca.ca.exception.CATokenAuthenticationFailedException, - se.anatom.ejbca.ca.caadmin.extendedcaservices.OCSPCAServiceInfo, se.anatom.ejbca.ca.caadmin.extendedcaservices.ExtendedCAServiceInfo, se.anatom.ejbca.ca.caadmin.hardcatokens.HardCATokenManager, se.anatom.ejbca.ca.caadmin.AvailableHardCAToken, se.anatom.ejbca.ca.caadmin.HardCATokenInfo"%> - - - - - -<%! // Declarations - static final String ACTION = "action"; - static final String ACTION_EDIT_CAS = "editcas"; - static final String ACTION_EDIT_CA = "editca"; - static final String ACTION_CREATE_CA = "createca"; - static final String ACTION_CHOOSE_CATYPE = "choosecatype"; - static final String ACTION_CHOOSE_CATOKENTYPE = "choosecatokentype"; - static final String ACTION_MAKEREQUEST = "makerequest"; - static final String ACTION_RECEIVERESPONSE = "receiveresponse"; - static final String ACTION_PROCESSREQUEST = "processrequest"; - static final String ACTION_PROCESSREQUEST2 = "processrequest2"; - static final String ACTION_RENEWCA_MAKEREQUEST = "renewcamakeresponse"; - static final String ACTION_RENEWCA_RECIEVERESPONSE = "renewcarecieveresponse"; - - - - static final String CHECKBOX_VALUE = "true"; - -// Used in choosecapage.jsp - static final String BUTTON_EDIT_CA = "buttoneditca"; - static final String BUTTON_DELETE_CA = "buttondeleteca"; - static final String BUTTON_CREATE_CA = "buttoncreateca"; - static final String BUTTON_RENAME_CA = "buttonrenameca"; - static final String BUTTON_PROCESSREQUEST = "buttonprocessrequest"; - - - static final String SELECT_CAS = "selectcas"; - static final String TEXTFIELD_CANAME = "textfieldcaname"; - static final String HIDDEN_CANAME = "hiddencaname"; - static final String HIDDEN_CAID = "hiddencaid"; - static final String HIDDEN_CATYPE = "hiddencatype"; - static final String HIDDEN_CATOKENPATH = "hiddencatokenpath"; - static final String HIDDEN_CATOKENTYPE = "hiddencatokentype"; - -// Buttons used in editcapage.jsp - static final String BUTTON_SAVE = "buttonsave"; - static final String BUTTON_CREATE = "buttoncreate"; - static final String BUTTON_CANCEL = "buttoncancel"; - static final String BUTTON_MAKEREQUEST = "buttonmakerequest"; - static final String BUTTON_RECEIVEREQUEST = "buttonreceiverequest"; - static final String BUTTON_RENEWCA = "buttonrenewca"; - static final String BUTTON_REVOKECA = "buttonrevokeca"; - static final String BUTTON_RECIEVEFILE = "buttonrecievefile"; - static final String BUTTON_PUBLISHCA = "buttonpublishca"; - static final String BUTTON_REVOKERENEWOCSPCERTIFICATE = "checkboxrenewocspcertificate"; - - static final String TEXTFIELD_SUBJECTDN = "textfieldsubjectdn"; - static final String TEXTFIELD_SUBJECTALTNAME = "textfieldsubjectaltname"; - static final String TEXTFIELD_CRLPERIOD = "textfieldcrlperiod"; - static final String TEXTFIELD_DESCRIPTION = "textfielddescription"; - static final String TEXTFIELD_VALIDITY = "textfieldvalidity"; - static final String TEXTFIELD_POLICYID = "textfieldpolicyid"; - static final String TEXTFIELD_HARDCATOKENPROPERTIES = "textfieldhardcatokenproperties"; - static final String TEXTFIELD_AUTHENTICATIONCODE = "textfieldauthenticationcode"; - - static final String CHECKBOX_AUTHORITYKEYIDENTIFIER = "checkboxauthoritykeyidentifier"; - static final String CHECKBOX_AUTHORITYKEYIDENTIFIERCRITICAL = "checkboxauthoritykeyidentifiercritical"; - static final String CHECKBOX_USECRLNUMBER = "checkboxusecrlnumber"; - static final String CHECKBOX_CRLNUMBERCRITICAL = "checkboxcrlnumbercritical"; - static final String CHECKBOX_FINISHUSER = "checkboxfinishuser"; - static final String CHECKBOX_ACTIVATEOCSPSERVICE = "checkboxactivateocspservice"; - - static final String HIDDEN_CATOKEN = "hiddencatoken"; - - static final String SELECT_REVOKEREASONS = "selectrevokereasons"; - static final String SELECT_CATYPE = "selectcatype"; - static final String SELECT_CATOKEN = "selectcatoken"; - static final String SELECT_SIGNEDBY = "selectsignedby"; - static final String SELECT_KEYSIZE = "selectsize"; - static final String SELECT_AVAILABLECRLPUBLISHERS = "selectavailablecrlpublishers"; - static final String SELECT_CERTIFICATEPROFILE = "selectcertificateprofile"; - static final String SELECT_SIGNATUREALGORITHM = "selectsignaturealgorithm"; - - static final String FILE_RECIEVEFILE = "filerecievefile"; - static final String FILE_CACERTFILE = "filecacertfile"; - static final String FILE_REQUESTFILE = "filerequestfile"; - - static final String CERTSERNO_PARAMETER = "certsernoparameter"; - - static final int MAKEREQUESTMODE = 0; - static final int RECIEVERESPONSEMODE = 1; - static final int PROCESSREQUESTMODE = 2; - - static final int CERTREQGENMODE = 0; - static final int CERTGENMODE = 1; -%> -<% - - // Initialize environment - int caid = 0; - String caname = null; - String includefile = "choosecapage.jspf"; - String processedsubjectdn = ""; - int catype = CAInfo.CATYPE_X509; // default - int catokentype = CATokenInfo.CATOKENTYPE_P12; // default - String catokenpath = "NONE"; - - InputStream file = null; - - boolean caexists = false; - boolean cadeletefailed = false; - boolean illegaldnoraltname = false; - boolean errorrecievingfile = false; - boolean ocsprenewed = false; - boolean catokenoffline = false; - boolean catokenauthfailed = false; - - - GlobalConfiguration globalconfiguration = ejbcawebbean.initialize(request, "/super_administrator"); - cabean.initialize(request, ejbcawebbean); - - CADataHandler cadatahandler = cabean.getCADataHandler(); - String THIS_FILENAME = globalconfiguration.getCaPath() + "/editcas/editcas.jsp"; - String action = ""; - - final String VIEWCERT_LINK = globalconfiguration.getBaseUrl() + globalconfiguration.getAdminWebPath() + "viewcertificate.jsp"; - - boolean issuperadministrator = false; - boolean editca = false; - boolean processrequest = false; - boolean buttoncancel = false; - boolean caactivated = false; - boolean carenewed = false; - boolean capublished = false; - - int filemode = 0; - int row = 0; - - HashMap caidtonamemap = cabean.getCAIdToNameMap(); - InformationMemory info = ejbcawebbean.getInformationMemory(); - -%> - - - <%= globalconfiguration .getEjbcaTitle() %> - - - - - - -<% - if(FileUpload.isMultipartContent(request)){ - errorrecievingfile = true; - DiskFileUpload upload = new DiskFileUpload(); - upload.setSizeMax(60000); - upload.setSizeThreshold(59999); - List /* FileItem */ items = upload.parseRequest(request); - - Iterator iter = items.iterator(); - while (iter.hasNext()) { - FileItem item = (FileItem) iter.next(); - - - if (item.isFormField()) { - if(item.getFieldName().equals(ACTION)) - action = item.getString(); - if(item.getFieldName().equals(HIDDEN_CAID)) - caid = Integer.parseInt(item.getString()); - if(item.getFieldName().equals(HIDDEN_CANAME)) - caname = item.getString(); - if(item.getFieldName().equals(BUTTON_CANCEL)) - buttoncancel = true; - }else{ - file = item.getInputStream(); - errorrecievingfile = false; - } - } - }else{ - action = request.getParameter(ACTION); - } - try{ - // Determine action - if( action != null){ - if( action.equals(ACTION_EDIT_CAS)){ - // Actions in the choose CA page. - if( request.getParameter(BUTTON_EDIT_CA) != null){ - // Display profilepage.jsp - includefile="choosecapage.jspf"; - if(request.getParameter(SELECT_CAS) != null){ - caid = Integer.parseInt(request.getParameter(SELECT_CAS)); - if(caid != 0){ - editca = true; - includefile="editcapage.jspf"; - } - } - } - if( request.getParameter(BUTTON_DELETE_CA) != null) { - // Delete profile and display choosecapage. - if(request.getParameter(SELECT_CAS) != null){ - caid = Integer.parseInt(request.getParameter(SELECT_CAS)); - if(caid != 0){ - cadeletefailed = !cadatahandler.removeCA(caid); - } - } - includefile="choosecapage.jspf"; - } - if( request.getParameter(BUTTON_RENAME_CA) != null){ - // Rename selected profile and display profilespage. - if(request.getParameter(SELECT_CAS) != null && request.getParameter(TEXTFIELD_CANAME) != null){ - String newcaname = request.getParameter(TEXTFIELD_CANAME).trim(); - String oldcaname = (String) caidtonamemap.get(new Integer(request.getParameter(SELECT_CAS))); - if(!newcaname.equals("") ){ - try{ - cadatahandler.renameCA(oldcaname, newcaname); - }catch( CAExistsException e){ - caexists=true; - } - } - } - includefile="choosecapage.jspf"; - } - if( request.getParameter(BUTTON_CREATE_CA) != null){ - // Add profile and display profilespage. - includefile="choosecapage.jspf"; - caname = request.getParameter(TEXTFIELD_CANAME); - if(caname != null){ - caname = caname.trim(); - if(!caname.equals("")){ - editca = false; - includefile="editcapage.jspf"; - } - } - } - if( request.getParameter(BUTTON_PROCESSREQUEST) != null){ - caname = request.getParameter(TEXTFIELD_CANAME); - if(caname != null){ - caname = caname.trim(); - if(!caname.equals("")){ - filemode = PROCESSREQUESTMODE; - includefile="recievefile.jspf"; - } - } - } - } - if( action.equals(ACTION_CREATE_CA)){ - if( request.getParameter(BUTTON_CREATE) != null || request.getParameter(BUTTON_MAKEREQUEST) != null){ - // Create and save CA - caname = request.getParameter(HIDDEN_CANAME); - - CATokenInfo catoken = null; - catokentype = Integer.parseInt(request.getParameter(HIDDEN_CATOKENTYPE)); - if(catokentype == CATokenInfo.CATOKENTYPE_P12){ - int keysize = Integer.parseInt(request.getParameter(SELECT_KEYSIZE)); - String signalg = request.getParameter(SELECT_SIGNATUREALGORITHM); - if(keysize == 0 || signalg == null) - throw new Exception("Error in CATokenData"); - catoken = new SoftCATokenInfo(); - catoken.setSignatureAlgorithm(signalg); - ((SoftCATokenInfo) catoken).setKeySize(keysize); - } - if(catokentype == CATokenInfo.CATOKENTYPE_HSM){ - catokenpath = request.getParameter(HIDDEN_CATOKENPATH); - String properties = request.getParameter(TEXTFIELD_HARDCATOKENPROPERTIES); - String signalg = request.getParameter(SELECT_SIGNATUREALGORITHM); - String authenticationcode = request.getParameter(TEXTFIELD_AUTHENTICATIONCODE); - if(catokenpath == null || catokenpath == null || signalg == null) - throw new Exception("Error in CATokenData"); - catoken = new HardCATokenInfo(); - ((HardCATokenInfo) catoken).setClassPath(catokenpath); - ((HardCATokenInfo) catoken).setProperties(properties); - ((HardCATokenInfo) catoken).setSignatureAlgorithm(signalg); - ((HardCATokenInfo) catoken).setAuthenticationCode(authenticationcode); - } - - catype = Integer.parseInt(request.getParameter(HIDDEN_CATYPE)); - String subjectdn = request.getParameter(TEXTFIELD_SUBJECTDN); - try{ - X509Name dummy = new X509Name(subjectdn); - }catch(Exception e){ - illegaldnoraltname = true; - } - int certprofileid = 0; - if(request.getParameter(SELECT_CERTIFICATEPROFILE) != null) - certprofileid = Integer.parseInt(request.getParameter(SELECT_CERTIFICATEPROFILE)); - int signedby = 0; - if(request.getParameter(SELECT_SIGNEDBY) != null) - signedby = Integer.parseInt(request.getParameter(SELECT_SIGNEDBY)); - String description = request.getParameter(TEXTFIELD_DESCRIPTION); - if(description == null) - description = ""; - - int validity = 0; - if(request.getParameter(TEXTFIELD_VALIDITY) != null) - validity = Integer.parseInt(request.getParameter(TEXTFIELD_VALIDITY)); - - if(catoken != null && catype != 0 && subjectdn != null && caname != null - && signedby != 0 ){ - if(catype == CAInfo.CATYPE_X509){ - // Create a X509 CA - String subjectaltname = request.getParameter(TEXTFIELD_SUBJECTALTNAME); - if(subjectaltname == null) - subjectaltname = ""; - else{ - if(!subjectaltname.trim().equals("")){ - se.anatom.ejbca.ra.raadmin.DNFieldExtractor subtest = - new se.anatom.ejbca.ra.raadmin.DNFieldExtractor(subjectaltname,se.anatom.ejbca.ra.raadmin.DNFieldExtractor.TYPE_SUBJECTALTNAME); - if(subtest.isIllegal() || subtest.existsOther()){ - illegaldnoraltname = true; - } - } - } - - String policyid = request.getParameter(TEXTFIELD_POLICYID); - if(policyid == null || policyid.trim().equals("")) - policyid = null; - - int crlperiod = Integer.parseInt(request.getParameter(TEXTFIELD_CRLPERIOD)); - - boolean useauthoritykeyidentifier = false; - boolean authoritykeyidentifiercritical = false; - String value = request.getParameter(CHECKBOX_AUTHORITYKEYIDENTIFIER); - if(value != null){ - useauthoritykeyidentifier = value.equals(CHECKBOX_VALUE); - value = request.getParameter(CHECKBOX_AUTHORITYKEYIDENTIFIERCRITICAL); - if(value != null){ - authoritykeyidentifiercritical = value.equals(CHECKBOX_VALUE); - } - else - authoritykeyidentifiercritical = false; - } - - boolean usecrlnumber = false; - boolean crlnumbercritical = false; - value = request.getParameter(CHECKBOX_USECRLNUMBER); - if(value != null){ - usecrlnumber = value.equals(CHECKBOX_VALUE); - value = request.getParameter(CHECKBOX_CRLNUMBERCRITICAL); - if(value != null){ - crlnumbercritical = value.equals(CHECKBOX_VALUE); - } - else - crlnumbercritical = false; - } - - boolean finishuser = false; - value = request.getParameter(CHECKBOX_FINISHUSER); - if(value != null) - finishuser = value.equals(CHECKBOX_VALUE); - - String[] values = request.getParameterValues(SELECT_AVAILABLECRLPUBLISHERS); - ArrayList crlpublishers = new ArrayList(); - if(values != null){ - for(int i=0; i < values.length; i++){ - crlpublishers.add(new Integer(values[i])); - } - } - - int ocspactive = ExtendedCAServiceInfo.STATUS_INACTIVE; - value = request.getParameter(CHECKBOX_ACTIVATEOCSPSERVICE); - if(value != null && value.equals(CHECKBOX_VALUE)) - ocspactive = ExtendedCAServiceInfo.STATUS_ACTIVE; - - if(crlperiod != 0 && !illegaldnoraltname){ - if(request.getParameter(BUTTON_CREATE) != null){ - - // Create and active OSCP CA Service. - ArrayList extendedcaservices = new ArrayList(); - extendedcaservices.add( - new OCSPCAServiceInfo(ocspactive, - "CN=OCSPSignerCertificate, " + subjectdn, - "", - 2048, - OCSPCAServiceInfo.KEYALGORITHM_RSA)); - X509CAInfo x509cainfo = new X509CAInfo(subjectdn, caname, 0, subjectaltname, - certprofileid, validity, - null, catype, signedby, - null, catoken, description, -1, null, - policyid, crlperiod, crlpublishers, - useauthoritykeyidentifier, - authoritykeyidentifiercritical, - usecrlnumber, - crlnumbercritical, - finishuser, extendedcaservices); - try{ - cadatahandler.createCA((CAInfo) x509cainfo); - }catch(CAExistsException caee){ - caexists = true; - }catch(CATokenAuthenticationFailedException catfe){ - catokenauthfailed = true; - } - includefile="choosecapage.jspf"; - } - if(request.getParameter(BUTTON_MAKEREQUEST) != null){ - caid = CertTools.stringToBCDNString(subjectdn).hashCode(); - // Create and OSCP CA Service. - ArrayList extendedcaservices = new ArrayList(); - extendedcaservices.add( - new OCSPCAServiceInfo(ocspactive, - "CN=OCSPSignerCertificate, " + subjectdn, - "", - 2048, - OCSPCAServiceInfo.KEYALGORITHM_RSA)); - X509CAInfo x509cainfo = new X509CAInfo(subjectdn, caname, caid, subjectaltname, - certprofileid, validity, - null, catype, CAInfo.SIGNEDBYEXTERNALCA, - null, catoken, description, -1, null, - policyid, crlperiod, crlpublishers, - useauthoritykeyidentifier, - authoritykeyidentifiercritical, - usecrlnumber, - crlnumbercritical, - finishuser, extendedcaservices); - cabean.saveRequestInfo(x509cainfo); - filemode = MAKEREQUESTMODE; - includefile="recievefile.jspf"; - } - } - } - } - } - if(request.getParameter(BUTTON_CANCEL) != null){ - // Don't save changes. - includefile="choosecapage.jspf"; - } - } - if( action.equals(ACTION_EDIT_CA)){ - if( request.getParameter(BUTTON_SAVE) != null || - request.getParameter(BUTTON_RECEIVEREQUEST) != null || - request.getParameter(BUTTON_RENEWCA) != null || - request.getParameter(BUTTON_REVOKECA) != null || - request.getParameter(BUTTON_PUBLISHCA) != null || - request.getParameter(BUTTON_REVOKERENEWOCSPCERTIFICATE) != null){ - // Create and save CA - caid = Integer.parseInt(request.getParameter(HIDDEN_CAID)); - caname = request.getParameter(HIDDEN_CANAME); - catype = Integer.parseInt(request.getParameter(HIDDEN_CATYPE)); - - CATokenInfo catoken = null; - catokentype = Integer.parseInt(request.getParameter(HIDDEN_CATOKENTYPE)); - if(catokentype == CATokenInfo.CATOKENTYPE_P12){ - catoken = new SoftCATokenInfo(); - } - if(catokentype == CATokenInfo.CATOKENTYPE_HSM){ - String properties = request.getParameter(TEXTFIELD_HARDCATOKENPROPERTIES); - if(catokenpath == null) - throw new Exception("Error in CATokenData"); - catoken = new HardCATokenInfo(); - ((HardCATokenInfo) catoken).setProperties(properties); - } - - - String description = request.getParameter(TEXTFIELD_DESCRIPTION); - - int validity = 0; - if(request.getParameter(TEXTFIELD_VALIDITY) != null) - validity = Integer.parseInt(request.getParameter(TEXTFIELD_VALIDITY)); - - - if(caid != 0 && description != null && catype !=0 ){ - if(catype == CAInfo.CATYPE_X509){ - // Edit X509 CA data - - int crlperiod = Integer.parseInt(request.getParameter(TEXTFIELD_CRLPERIOD)); - - boolean useauthoritykeyidentifier = false; - boolean authoritykeyidentifiercritical = false; - String value = request.getParameter(CHECKBOX_AUTHORITYKEYIDENTIFIER); - if(value != null){ - useauthoritykeyidentifier = value.equals(CHECKBOX_VALUE); - value = request.getParameter(CHECKBOX_AUTHORITYKEYIDENTIFIERCRITICAL); - if(value != null){ - authoritykeyidentifiercritical = value.equals(CHECKBOX_VALUE); - } - else - authoritykeyidentifiercritical = false; - } - - - boolean usecrlnumber = false; - boolean crlnumbercritical = false; - - value = request.getParameter(CHECKBOX_USECRLNUMBER); - if(value != null){ - usecrlnumber = value.equals(CHECKBOX_VALUE); - value = request.getParameter(CHECKBOX_CRLNUMBERCRITICAL); - if(value != null){ - crlnumbercritical = value.equals(CHECKBOX_VALUE); - } - else - crlnumbercritical = false; - } - - boolean finishuser = false; - value = request.getParameter(CHECKBOX_FINISHUSER); - if(value != null) - finishuser = value.equals(CHECKBOX_VALUE); - - String[] values = request.getParameterValues(SELECT_AVAILABLECRLPUBLISHERS); - ArrayList crlpublishers = new ArrayList(); - if(values != null){ - for(int i=0; i < values.length; i++){ - crlpublishers.add(new Integer(values[i])); - } - } - - // Create extended CA Service updatedata. - int active = ExtendedCAServiceInfo.STATUS_INACTIVE; - value = request.getParameter(CHECKBOX_ACTIVATEOCSPSERVICE); - if(value != null && value.equals(CHECKBOX_VALUE)) - active = ExtendedCAServiceInfo.STATUS_ACTIVE; - - boolean renew = false; - if(active == ExtendedCAServiceInfo.STATUS_ACTIVE && - request.getParameter(BUTTON_REVOKERENEWOCSPCERTIFICATE) != null){ - cadatahandler.revokeOCSPCertificate(caid); - renew=true; - ocsprenewed = true; - includefile="choosecapage.jspf"; - } - - ArrayList extendedcaservices = new ArrayList(); - extendedcaservices.add( - new OCSPCAServiceInfo(active, renew)); - - if(crlperiod != 0){ - X509CAInfo x509cainfo = new X509CAInfo(caid, validity, - catoken, description, - crlperiod, crlpublishers, - useauthoritykeyidentifier, - authoritykeyidentifiercritical, - usecrlnumber, - crlnumbercritical, - finishuser,extendedcaservices); - - cadatahandler.editCA((CAInfo) x509cainfo); - - - - if(request.getParameter(BUTTON_SAVE) != null){ - // Do nothing More - - includefile="choosecapage.jspf"; - } - if(request.getParameter(BUTTON_RECEIVEREQUEST) != null){ - filemode = RECIEVERESPONSEMODE; - includefile="recievefile.jspf"; - } - if(request.getParameter(BUTTON_RENEWCA) != null){ - int signedby = cadatahandler.getCAInfo(caid).getCAInfo().getSignedBy(); - if(signedby != CAInfo.SIGNEDBYEXTERNALCA){ - cadatahandler.renewCA(caid, null); - carenewed = true; - }else{ - includefile="renewexternal.jspf"; - } - } - if(request.getParameter(BUTTON_REVOKECA) != null){ - int revokereason = Integer.parseInt(request.getParameter(SELECT_REVOKEREASONS)); - cadatahandler.revokeCA(caid, revokereason); - includefile="choosecapage.jspf"; - } - if(request.getParameter(BUTTON_PUBLISHCA) != null){ - cadatahandler.publishCA(caid); - capublished = true; - includefile="choosecapage.jspf"; - } - - } - } - } - } - if(request.getParameter(BUTTON_CANCEL) != null){ - // Don't save changes. - includefile="choosecapage.jspf"; - } - - - } - if( action.equals(ACTION_MAKEREQUEST)){ - if(!buttoncancel){ - try{ - Collection certchain = CertTools.getCertsFromPEM(file); - try{ - CAInfo cainfo = cabean.getRequestInfo(); - cadatahandler.createCA(cainfo); - PKCS10CertificationRequest certreq = null; - try{ - certreq=cadatahandler.makeRequest(caid, certchain, true); - cabean.savePKCS10RequestData(certreq); - filemode = CERTREQGENMODE; - includefile = "displayresult.jspf"; - }catch(Exception e){ - cadatahandler.removeCA(caid); - errorrecievingfile = true; - includefile="choosecapage.jspf"; - } - }catch(CAExistsException caee){ - caexists = true; - } - }catch(Exception e){ - errorrecievingfile = true; - } - }else{ - cabean.saveRequestInfo((CAInfo) null); - } - } - - if( action.equals(ACTION_RECEIVERESPONSE)){ - if(!buttoncancel){ - try{ - if (caid != 0) { - cadatahandler.receiveResponse(caid, file); - caactivated = true; - } - }catch(Exception e){ - errorrecievingfile = true; - } - } - } - if( action.equals(ACTION_PROCESSREQUEST)){ - if(!buttoncancel){ - try{ - BufferedReader bufRdr = new BufferedReader(new InputStreamReader(file)); - while (bufRdr.ready()) { - ByteArrayOutputStream ostr = new ByteArrayOutputStream(); - PrintStream opstr = new PrintStream(ostr); - String temp; - while ((temp = bufRdr.readLine()) != null){ - opstr.print(temp + "\n"); - } - opstr.close(); - - PKCS10RequestMessage certreq = se.anatom.ejbca.apply.RequestHelper.genPKCS10RequestMessageFromPEM(ostr.toByteArray()); - - if (certreq != null) { - cabean.savePKCS10RequestData(certreq.getCertificationRequest()); - processedsubjectdn = certreq.getCertificationRequest().getCertificationRequestInfo().getSubject().toString(); - processrequest = true; - includefile="editcapage.jspf"; - } - } - }catch(Exception e){ - errorrecievingfile = true; - } - }else{ - cabean.savePKCS10RequestData((org.bouncycastle.jce.PKCS10CertificationRequest) null); - } - } - if( action.equals(ACTION_PROCESSREQUEST2)){ - if(request.getParameter(BUTTON_CANCEL) == null){ - // Create and process CA - caname = request.getParameter(HIDDEN_CANAME); - - catype = Integer.parseInt(request.getParameter(HIDDEN_CATYPE)); - String subjectdn = request.getParameter(TEXTFIELD_SUBJECTDN); - try{ - X509Name dummy = new X509Name(subjectdn); - }catch(Exception e){ - illegaldnoraltname = true; - } - - int certprofileid = 0; - if(request.getParameter(SELECT_CERTIFICATEPROFILE) != null) - certprofileid = Integer.parseInt(request.getParameter(SELECT_CERTIFICATEPROFILE)); - int signedby = 0; - if(request.getParameter(SELECT_SIGNEDBY) != null) - signedby = Integer.parseInt(request.getParameter(SELECT_SIGNEDBY)); - String description = request.getParameter(TEXTFIELD_DESCRIPTION); - if(description == null) - description = ""; - - int validity = 0; - if(request.getParameter(TEXTFIELD_VALIDITY) != null) - validity = Integer.parseInt(request.getParameter(TEXTFIELD_VALIDITY)); - - if(catype != 0 && subjectdn != null && caname != null && - certprofileid != 0 && signedby != 0 && validity !=0 ){ - if(catype == CAInfo.CATYPE_X509){ - // Create a X509 CA - String subjectaltname = request.getParameter(TEXTFIELD_SUBJECTALTNAME); - if(subjectaltname == null) - subjectaltname = ""; - else{ - if(!subjectaltname.trim().equals("")){ - se.anatom.ejbca.ra.raadmin.DNFieldExtractor subtest = - new se.anatom.ejbca.ra.raadmin.DNFieldExtractor(subjectaltname,se.anatom.ejbca.ra.raadmin.DNFieldExtractor.TYPE_SUBJECTALTNAME); - if(subtest.isIllegal() || subtest.existsOther()){ - illegaldnoraltname = true; - } - } - } - - String policyid = request.getParameter(TEXTFIELD_POLICYID); - if(policyid == null || policyid.trim().equals("")) - policyid = null; - - int crlperiod = 0; - - boolean useauthoritykeyidentifier = false; - boolean authoritykeyidentifiercritical = false; - - boolean usecrlnumber = false; - boolean crlnumbercritical = false; - - boolean finishuser = false; - ArrayList crlpublishers = new ArrayList(); - - if(!illegaldnoraltname){ - if(request.getParameter(BUTTON_PROCESSREQUEST) != null){ - X509CAInfo x509cainfo = new X509CAInfo(subjectdn, caname, 0, subjectaltname, - certprofileid, validity, - null, catype, signedby, - null, null, description, -1, null, - policyid, crlperiod, crlpublishers, - useauthoritykeyidentifier, - authoritykeyidentifiercritical, - usecrlnumber, - crlnumbercritical, - finishuser, - new ArrayList()); - try{ - PKCS10CertificationRequest req = cabean.getPKCS10RequestData(); - java.security.cert.Certificate result = cadatahandler.processRequest(x509cainfo, new PKCS10RequestMessage(req)); - cabean.saveProcessedCertificate(result); - filemode = CERTGENMODE; - includefile="displayresult.jspf"; - }catch(CAExistsException caee){ - caexists = true; - } - } - } - } - } - } - } - - if( action.equals(ACTION_RENEWCA_MAKEREQUEST)){ - if(!buttoncancel){ - try{ - Collection certchain = CertTools.getCertsFromPEM(file); - PKCS10CertificationRequest certreq = cadatahandler.makeRequest(caid, certchain, false); - cabean.savePKCS10RequestData(certreq); - - filemode = CERTREQGENMODE; - includefile = "displayresult.jspf"; - }catch(Exception e){ - errorrecievingfile = true; - includefile="choosecapage.jspf"; - } - }else{ - cabean.saveRequestInfo((CAInfo) null); - } - } - if( action.equals(ACTION_RENEWCA_RECIEVERESPONSE)){ - if(!buttoncancel){ - try{ - if (caid != 0) { - cadatahandler.receiveResponse(caid, file); - carenewed = true; - } - }catch(Exception e){ - errorrecievingfile = true; - } - } - } - if( action.equals(ACTION_CHOOSE_CATYPE)){ - // Currently not need - } - if( action.equals(ACTION_CHOOSE_CATOKENTYPE)){ - - catokenpath = request.getParameter(SELECT_CATOKEN); - caname = request.getParameter(HIDDEN_CANAME); - if(catokenpath.equals("NONE")){ - catokentype = CATokenInfo.CATOKENTYPE_P12; - }else{ - catokentype = CATokenInfo.CATOKENTYPE_HSM; - } - editca = false; - includefile="editcapage.jspf"; - } - - } - }catch(CATokenOfflineException ctoe){ - catokenoffline = true; - includefile="choosecapage.jspf"; - } - - - // Include page - if( includefile.equals("editcapage.jspf")){ -%> - <%@ include file="editcapage.jspf" %> -<%} - if( includefile.equals("choosecapage.jspf")){ %> - <%@ include file="choosecapage.jspf" %> -<%} - if( includefile.equals("recievefile.jspf")){ %> - <%@ include file="recievefile.jspf" %> -<%} - if( includefile.equals("displayresult.jspf")){ %> - <%@ include file="displayresult.jspf" %> -<%} - if( includefile.equals("renewexternal.jspf")){ %> - <%@ include file="renewexternal.jspf" %> -<%} - - - // Include Footer - String footurl = globalconfiguration.getFootBanner(); %> - - - - - - +<%@ page pageEncoding="ISO-8859-1"%> +<%@page errorPage="/errorpage.jsp" import="java.util.*, java.io.*, org.apache.commons.fileupload.*, se.anatom.ejbca.webdist.webconfiguration.EjbcaWebBean,se.anatom.ejbca.ra.raadmin.GlobalConfiguration, se.anatom.ejbca.SecConst, se.anatom.ejbca.util.FileTools, se.anatom.ejbca.util.CertTools, se.anatom.ejbca.authorization.AuthorizationDeniedException, + se.anatom.ejbca.webdist.cainterface.CAInterfaceBean, se.anatom.ejbca.ca.caadmin.CAInfo, se.anatom.ejbca.ca.caadmin.X509CAInfo, se.anatom.ejbca.ca.caadmin.CATokenInfo, se.anatom.ejbca.ca.caadmin.SoftCATokenInfo, se.anatom.ejbca.webdist.cainterface.CADataHandler, + se.anatom.ejbca.webdist.rainterface.RevokedInfoView, se.anatom.ejbca.ca.caadmin.CATokenInfo, se.anatom.ejbca.ca.caadmin.SoftCATokenInfo, se.anatom.ejbca.webdist.webconfiguration.InformationMemory, org.bouncycastle.asn1.x509.X509Name, se.anatom.ejbca.common.ExtendedPKCS10CertificationRequest, + se.anatom.ejbca.protocol.PKCS10RequestMessage, se.anatom.ejbca.ca.exception.CAExistsException, se.anatom.ejbca.ca.exception.CADoesntExistsException, se.anatom.ejbca.ca.exception.CATokenOfflineException, se.anatom.ejbca.ca.exception.CATokenAuthenticationFailedException, + se.anatom.ejbca.ca.caadmin.extendedcaservices.OCSPCAServiceInfo, se.anatom.ejbca.ca.caadmin.extendedcaservices.ExtendedCAServiceInfo, se.anatom.ejbca.ca.caadmin.hardcatokens.HardCATokenManager, se.anatom.ejbca.ca.caadmin.AvailableHardCAToken, se.anatom.ejbca.ca.caadmin.HardCATokenInfo"%> + + + + + +<%! // Declarations + static final String ACTION = "action"; + static final String ACTION_EDIT_CAS = "editcas"; + static final String ACTION_EDIT_CA = "editca"; + static final String ACTION_CREATE_CA = "createca"; + static final String ACTION_CHOOSE_CATYPE = "choosecatype"; + static final String ACTION_CHOOSE_CATOKENTYPE = "choosecatokentype"; + static final String ACTION_MAKEREQUEST = "makerequest"; + static final String ACTION_RECEIVERESPONSE = "receiveresponse"; + static final String ACTION_PROCESSREQUEST = "processrequest"; + static final String ACTION_PROCESSREQUEST2 = "processrequest2"; + static final String ACTION_RENEWCA_MAKEREQUEST = "renewcamakeresponse"; + static final String ACTION_RENEWCA_RECIEVERESPONSE = "renewcarecieveresponse"; + + + + static final String CHECKBOX_VALUE = "true"; + +// Used in choosecapage.jsp + static final String BUTTON_EDIT_CA = "buttoneditca"; + static final String BUTTON_DELETE_CA = "buttondeleteca"; + static final String BUTTON_CREATE_CA = "buttoncreateca"; + static final String BUTTON_RENAME_CA = "buttonrenameca"; + static final String BUTTON_PROCESSREQUEST = "buttonprocessrequest"; + + + static final String SELECT_CAS = "selectcas"; + static final String TEXTFIELD_CANAME = "textfieldcaname"; + static final String HIDDEN_CANAME = "hiddencaname"; + static final String HIDDEN_CAID = "hiddencaid"; + static final String HIDDEN_CATYPE = "hiddencatype"; + static final String HIDDEN_CATOKENPATH = "hiddencatokenpath"; + static final String HIDDEN_CATOKENTYPE = "hiddencatokentype"; + +// Buttons used in editcapage.jsp + static final String BUTTON_SAVE = "buttonsave"; + static final String BUTTON_CREATE = "buttoncreate"; + static final String BUTTON_CANCEL = "buttoncancel"; + static final String BUTTON_MAKEREQUEST = "buttonmakerequest"; + static final String BUTTON_RECEIVEREQUEST = "buttonreceiverequest"; + static final String BUTTON_RENEWCA = "buttonrenewca"; + static final String BUTTON_REVOKECA = "buttonrevokeca"; + static final String BUTTON_RECIEVEFILE = "buttonrecievefile"; + static final String BUTTON_PUBLISHCA = "buttonpublishca"; + static final String BUTTON_REVOKERENEWOCSPCERTIFICATE = "checkboxrenewocspcertificate"; + + static final String TEXTFIELD_SUBJECTDN = "textfieldsubjectdn"; + static final String TEXTFIELD_SUBJECTALTNAME = "textfieldsubjectaltname"; + static final String TEXTFIELD_CRLPERIOD = "textfieldcrlperiod"; + static final String TEXTFIELD_DESCRIPTION = "textfielddescription"; + static final String TEXTFIELD_VALIDITY = "textfieldvalidity"; + static final String TEXTFIELD_POLICYID = "textfieldpolicyid"; + static final String TEXTFIELD_HARDCATOKENPROPERTIES = "textfieldhardcatokenproperties"; + static final String TEXTFIELD_AUTHENTICATIONCODE = "textfieldauthenticationcode"; + + static final String CHECKBOX_AUTHORITYKEYIDENTIFIER = "checkboxauthoritykeyidentifier"; + static final String CHECKBOX_AUTHORITYKEYIDENTIFIERCRITICAL = "checkboxauthoritykeyidentifiercritical"; + static final String CHECKBOX_USECRLNUMBER = "checkboxusecrlnumber"; + static final String CHECKBOX_CRLNUMBERCRITICAL = "checkboxcrlnumbercritical"; + static final String CHECKBOX_FINISHUSER = "checkboxfinishuser"; + static final String CHECKBOX_ACTIVATEOCSPSERVICE = "checkboxactivateocspservice"; + + static final String HIDDEN_CATOKEN = "hiddencatoken"; + + static final String SELECT_REVOKEREASONS = "selectrevokereasons"; + static final String SELECT_CATYPE = "selectcatype"; + static final String SELECT_CATOKEN = "selectcatoken"; + static final String SELECT_SIGNEDBY = "selectsignedby"; + static final String SELECT_KEYSIZE = "selectsize"; + static final String SELECT_AVAILABLECRLPUBLISHERS = "selectavailablecrlpublishers"; + static final String SELECT_CERTIFICATEPROFILE = "selectcertificateprofile"; + static final String SELECT_SIGNATUREALGORITHM = "selectsignaturealgorithm"; + + static final String FILE_RECIEVEFILE = "filerecievefile"; + static final String FILE_CACERTFILE = "filecacertfile"; + static final String FILE_REQUESTFILE = "filerequestfile"; + + static final String CERTSERNO_PARAMETER = "certsernoparameter"; + + static final int MAKEREQUESTMODE = 0; + static final int RECIEVERESPONSEMODE = 1; + static final int PROCESSREQUESTMODE = 2; + + static final int CERTREQGENMODE = 0; + static final int CERTGENMODE = 1; +%> +<% + + // Initialize environment + int caid = 0; + String caname = null; + String includefile = "choosecapage.jspf"; + String processedsubjectdn = ""; + int catype = CAInfo.CATYPE_X509; // default + int catokentype = CATokenInfo.CATOKENTYPE_P12; // default + String catokenpath = "NONE"; + + InputStream file = null; + + boolean caexists = false; + boolean cadeletefailed = false; + boolean illegaldnoraltname = false; + boolean errorrecievingfile = false; + boolean ocsprenewed = false; + boolean catokenoffline = false; + boolean catokenauthfailed = false; + + + GlobalConfiguration globalconfiguration = ejbcawebbean.initialize(request, "/super_administrator"); + cabean.initialize(request, ejbcawebbean); + + CADataHandler cadatahandler = cabean.getCADataHandler(); + String THIS_FILENAME = globalconfiguration.getCaPath() + "/editcas/editcas.jsp"; + String action = ""; + + final String VIEWCERT_LINK = globalconfiguration.getBaseUrl() + globalconfiguration.getAdminWebPath() + "viewcertificate.jsp"; + + boolean issuperadministrator = false; + boolean editca = false; + boolean processrequest = false; + boolean buttoncancel = false; + boolean caactivated = false; + boolean carenewed = false; + boolean capublished = false; + + int filemode = 0; + int row = 0; + + HashMap caidtonamemap = cabean.getCAIdToNameMap(); + InformationMemory info = ejbcawebbean.getInformationMemory(); + +%> + + + <%= globalconfiguration .getEjbcaTitle() %> + + + + + + +<% + if(FileUpload.isMultipartContent(request)){ + errorrecievingfile = true; + DiskFileUpload upload = new DiskFileUpload(); + upload.setSizeMax(60000); + upload.setSizeThreshold(59999); + List /* FileItem */ items = upload.parseRequest(request); + + Iterator iter = items.iterator(); + while (iter.hasNext()) { + FileItem item = (FileItem) iter.next(); + + + if (item.isFormField()) { + if(item.getFieldName().equals(ACTION)) + action = item.getString(); + if(item.getFieldName().equals(HIDDEN_CAID)) + caid = Integer.parseInt(item.getString()); + if(item.getFieldName().equals(HIDDEN_CANAME)) + caname = item.getString(); + if(item.getFieldName().equals(BUTTON_CANCEL)) + buttoncancel = true; + }else{ + file = item.getInputStream(); + errorrecievingfile = false; + } + } + }else{ + action = request.getParameter(ACTION); + } + try{ + // Determine action + if( action != null){ + if( action.equals(ACTION_EDIT_CAS)){ + // Actions in the choose CA page. + if( request.getParameter(BUTTON_EDIT_CA) != null){ + // Display profilepage.jsp + includefile="choosecapage.jspf"; + if(request.getParameter(SELECT_CAS) != null){ + caid = Integer.parseInt(request.getParameter(SELECT_CAS)); + if(caid != 0){ + editca = true; + includefile="editcapage.jspf"; + } + } + } + if( request.getParameter(BUTTON_DELETE_CA) != null) { + // Delete profile and display choosecapage. + if(request.getParameter(SELECT_CAS) != null){ + caid = Integer.parseInt(request.getParameter(SELECT_CAS)); + if(caid != 0){ + cadeletefailed = !cadatahandler.removeCA(caid); + } + } + includefile="choosecapage.jspf"; + } + if( request.getParameter(BUTTON_RENAME_CA) != null){ + // Rename selected profile and display profilespage. + if(request.getParameter(SELECT_CAS) != null && request.getParameter(TEXTFIELD_CANAME) != null){ + String newcaname = request.getParameter(TEXTFIELD_CANAME).trim(); + String oldcaname = (String) caidtonamemap.get(new Integer(request.getParameter(SELECT_CAS))); + if(!newcaname.equals("") ){ + try{ + cadatahandler.renameCA(oldcaname, newcaname); + }catch( CAExistsException e){ + caexists=true; + } + } + } + includefile="choosecapage.jspf"; + } + if( request.getParameter(BUTTON_CREATE_CA) != null){ + // Add profile and display profilespage. + includefile="choosecapage.jspf"; + caname = request.getParameter(TEXTFIELD_CANAME); + if(caname != null){ + caname = caname.trim(); + if(!caname.equals("")){ + editca = false; + includefile="editcapage.jspf"; + } + } + } + if( request.getParameter(BUTTON_PROCESSREQUEST) != null){ + caname = request.getParameter(TEXTFIELD_CANAME); + if(caname != null){ + caname = caname.trim(); + if(!caname.equals("")){ + filemode = PROCESSREQUESTMODE; + includefile="recievefile.jspf"; + } + } + } + } + if( action.equals(ACTION_CREATE_CA)){ + if( request.getParameter(BUTTON_CREATE) != null || request.getParameter(BUTTON_MAKEREQUEST) != null){ + // Create and save CA + caname = request.getParameter(HIDDEN_CANAME); + + CATokenInfo catoken = null; + catokentype = Integer.parseInt(request.getParameter(HIDDEN_CATOKENTYPE)); + if(catokentype == CATokenInfo.CATOKENTYPE_P12){ + int keysize = Integer.parseInt(request.getParameter(SELECT_KEYSIZE)); + String signalg = request.getParameter(SELECT_SIGNATUREALGORITHM); + if(keysize == 0 || signalg == null) + throw new Exception("Error in CATokenData"); + catoken = new SoftCATokenInfo(); + catoken.setSignatureAlgorithm(signalg); + ((SoftCATokenInfo) catoken).setKeySize(keysize); + } + if(catokentype == CATokenInfo.CATOKENTYPE_HSM){ + catokenpath = request.getParameter(HIDDEN_CATOKENPATH); + String properties = request.getParameter(TEXTFIELD_HARDCATOKENPROPERTIES); + String signalg = request.getParameter(SELECT_SIGNATUREALGORITHM); + String authenticationcode = request.getParameter(TEXTFIELD_AUTHENTICATIONCODE); + if(catokenpath == null || catokenpath == null || signalg == null) + throw new Exception("Error in CATokenData"); + catoken = new HardCATokenInfo(); + ((HardCATokenInfo) catoken).setClassPath(catokenpath); + ((HardCATokenInfo) catoken).setProperties(properties); + ((HardCATokenInfo) catoken).setSignatureAlgorithm(signalg); + ((HardCATokenInfo) catoken).setAuthenticationCode(authenticationcode); + } + + catype = Integer.parseInt(request.getParameter(HIDDEN_CATYPE)); + String subjectdn = request.getParameter(TEXTFIELD_SUBJECTDN); + try{ + X509Name dummy = new X509Name(subjectdn); + }catch(Exception e){ + illegaldnoraltname = true; + } + int certprofileid = 0; + if(request.getParameter(SELECT_CERTIFICATEPROFILE) != null) + certprofileid = Integer.parseInt(request.getParameter(SELECT_CERTIFICATEPROFILE)); + int signedby = 0; + if(request.getParameter(SELECT_SIGNEDBY) != null) + signedby = Integer.parseInt(request.getParameter(SELECT_SIGNEDBY)); + String description = request.getParameter(TEXTFIELD_DESCRIPTION); + if(description == null) + description = ""; + + int validity = 0; + if(request.getParameter(TEXTFIELD_VALIDITY) != null) + validity = Integer.parseInt(request.getParameter(TEXTFIELD_VALIDITY)); + + if(catoken != null && catype != 0 && subjectdn != null && caname != null + && signedby != 0 ){ + if(catype == CAInfo.CATYPE_X509){ + // Create a X509 CA + String subjectaltname = request.getParameter(TEXTFIELD_SUBJECTALTNAME); + if(subjectaltname == null) + subjectaltname = ""; + else{ + if(!subjectaltname.trim().equals("")){ + se.anatom.ejbca.ra.raadmin.DNFieldExtractor subtest = + new se.anatom.ejbca.ra.raadmin.DNFieldExtractor(subjectaltname,se.anatom.ejbca.ra.raadmin.DNFieldExtractor.TYPE_SUBJECTALTNAME); + if(subtest.isIllegal() || subtest.existsOther()){ + illegaldnoraltname = true; + } + } + } + + String policyid = request.getParameter(TEXTFIELD_POLICYID); + if(policyid == null || policyid.trim().equals("")) + policyid = null; + + int crlperiod = Integer.parseInt(request.getParameter(TEXTFIELD_CRLPERIOD)); + + boolean useauthoritykeyidentifier = false; + boolean authoritykeyidentifiercritical = false; + String value = request.getParameter(CHECKBOX_AUTHORITYKEYIDENTIFIER); + if(value != null){ + useauthoritykeyidentifier = value.equals(CHECKBOX_VALUE); + value = request.getParameter(CHECKBOX_AUTHORITYKEYIDENTIFIERCRITICAL); + if(value != null){ + authoritykeyidentifiercritical = value.equals(CHECKBOX_VALUE); + } + else + authoritykeyidentifiercritical = false; + } + + boolean usecrlnumber = false; + boolean crlnumbercritical = false; + value = request.getParameter(CHECKBOX_USECRLNUMBER); + if(value != null){ + usecrlnumber = value.equals(CHECKBOX_VALUE); + value = request.getParameter(CHECKBOX_CRLNUMBERCRITICAL); + if(value != null){ + crlnumbercritical = value.equals(CHECKBOX_VALUE); + } + else + crlnumbercritical = false; + } + + boolean finishuser = false; + value = request.getParameter(CHECKBOX_FINISHUSER); + if(value != null) + finishuser = value.equals(CHECKBOX_VALUE); + + String[] values = request.getParameterValues(SELECT_AVAILABLECRLPUBLISHERS); + ArrayList crlpublishers = new ArrayList(); + if(values != null){ + for(int i=0; i < values.length; i++){ + crlpublishers.add(new Integer(values[i])); + } + } + + int ocspactive = ExtendedCAServiceInfo.STATUS_INACTIVE; + value = request.getParameter(CHECKBOX_ACTIVATEOCSPSERVICE); + if(value != null && value.equals(CHECKBOX_VALUE)) + ocspactive = ExtendedCAServiceInfo.STATUS_ACTIVE; + + if(crlperiod != 0 && !illegaldnoraltname){ + if(request.getParameter(BUTTON_CREATE) != null){ + + // Create and active OSCP CA Service. + ArrayList extendedcaservices = new ArrayList(); + extendedcaservices.add( + new OCSPCAServiceInfo(ocspactive, + "CN=OCSPSignerCertificate, " + subjectdn, + "", + 2048, + OCSPCAServiceInfo.KEYALGORITHM_RSA)); + X509CAInfo x509cainfo = new X509CAInfo(subjectdn, caname, 0, subjectaltname, + certprofileid, validity, + null, catype, signedby, + null, catoken, description, -1, null, + policyid, crlperiod, crlpublishers, + useauthoritykeyidentifier, + authoritykeyidentifiercritical, + usecrlnumber, + crlnumbercritical, + finishuser, extendedcaservices); + try{ + cadatahandler.createCA((CAInfo) x509cainfo); + }catch(CAExistsException caee){ + caexists = true; + }catch(CATokenAuthenticationFailedException catfe){ + catokenauthfailed = true; + } + includefile="choosecapage.jspf"; + } + if(request.getParameter(BUTTON_MAKEREQUEST) != null){ + caid = CertTools.stringToBCDNString(subjectdn).hashCode(); + // Create and OSCP CA Service. + ArrayList extendedcaservices = new ArrayList(); + extendedcaservices.add( + new OCSPCAServiceInfo(ocspactive, + "CN=OCSPSignerCertificate, " + subjectdn, + "", + 2048, + OCSPCAServiceInfo.KEYALGORITHM_RSA)); + X509CAInfo x509cainfo = new X509CAInfo(subjectdn, caname, caid, subjectaltname, + certprofileid, validity, + null, catype, CAInfo.SIGNEDBYEXTERNALCA, + null, catoken, description, -1, null, + policyid, crlperiod, crlpublishers, + useauthoritykeyidentifier, + authoritykeyidentifiercritical, + usecrlnumber, + crlnumbercritical, + finishuser, extendedcaservices); + cabean.saveRequestInfo(x509cainfo); + filemode = MAKEREQUESTMODE; + includefile="recievefile.jspf"; + } + } + } + } + } + if(request.getParameter(BUTTON_CANCEL) != null){ + // Don't save changes. + includefile="choosecapage.jspf"; + } + } + if( action.equals(ACTION_EDIT_CA)){ + if( request.getParameter(BUTTON_SAVE) != null || + request.getParameter(BUTTON_RECEIVEREQUEST) != null || + request.getParameter(BUTTON_RENEWCA) != null || + request.getParameter(BUTTON_REVOKECA) != null || + request.getParameter(BUTTON_PUBLISHCA) != null || + request.getParameter(BUTTON_REVOKERENEWOCSPCERTIFICATE) != null){ + // Create and save CA + caid = Integer.parseInt(request.getParameter(HIDDEN_CAID)); + caname = request.getParameter(HIDDEN_CANAME); + catype = Integer.parseInt(request.getParameter(HIDDEN_CATYPE)); + + CATokenInfo catoken = null; + catokentype = Integer.parseInt(request.getParameter(HIDDEN_CATOKENTYPE)); + if(catokentype == CATokenInfo.CATOKENTYPE_P12){ + catoken = new SoftCATokenInfo(); + } + if(catokentype == CATokenInfo.CATOKENTYPE_HSM){ + String properties = request.getParameter(TEXTFIELD_HARDCATOKENPROPERTIES); + if(catokenpath == null) + throw new Exception("Error in CATokenData"); + catoken = new HardCATokenInfo(); + ((HardCATokenInfo) catoken).setProperties(properties); + } + + + String description = request.getParameter(TEXTFIELD_DESCRIPTION); + + int validity = 0; + if(request.getParameter(TEXTFIELD_VALIDITY) != null) + validity = Integer.parseInt(request.getParameter(TEXTFIELD_VALIDITY)); + + + if(caid != 0 && description != null && catype !=0 ){ + if(catype == CAInfo.CATYPE_X509){ + // Edit X509 CA data + + int crlperiod = Integer.parseInt(request.getParameter(TEXTFIELD_CRLPERIOD)); + + boolean useauthoritykeyidentifier = false; + boolean authoritykeyidentifiercritical = false; + String value = request.getParameter(CHECKBOX_AUTHORITYKEYIDENTIFIER); + if(value != null){ + useauthoritykeyidentifier = value.equals(CHECKBOX_VALUE); + value = request.getParameter(CHECKBOX_AUTHORITYKEYIDENTIFIERCRITICAL); + if(value != null){ + authoritykeyidentifiercritical = value.equals(CHECKBOX_VALUE); + } + else + authoritykeyidentifiercritical = false; + } + + + boolean usecrlnumber = false; + boolean crlnumbercritical = false; + + value = request.getParameter(CHECKBOX_USECRLNUMBER); + if(value != null){ + usecrlnumber = value.equals(CHECKBOX_VALUE); + value = request.getParameter(CHECKBOX_CRLNUMBERCRITICAL); + if(value != null){ + crlnumbercritical = value.equals(CHECKBOX_VALUE); + } + else + crlnumbercritical = false; + } + + boolean finishuser = false; + value = request.getParameter(CHECKBOX_FINISHUSER); + if(value != null) + finishuser = value.equals(CHECKBOX_VALUE); + + String[] values = request.getParameterValues(SELECT_AVAILABLECRLPUBLISHERS); + ArrayList crlpublishers = new ArrayList(); + if(values != null){ + for(int i=0; i < values.length; i++){ + crlpublishers.add(new Integer(values[i])); + } + } + + // Create extended CA Service updatedata. + int active = ExtendedCAServiceInfo.STATUS_INACTIVE; + value = request.getParameter(CHECKBOX_ACTIVATEOCSPSERVICE); + if(value != null && value.equals(CHECKBOX_VALUE)) + active = ExtendedCAServiceInfo.STATUS_ACTIVE; + + boolean renew = false; + if(active == ExtendedCAServiceInfo.STATUS_ACTIVE && + request.getParameter(BUTTON_REVOKERENEWOCSPCERTIFICATE) != null){ + cadatahandler.revokeOCSPCertificate(caid); + renew=true; + ocsprenewed = true; + includefile="choosecapage.jspf"; + } + + ArrayList extendedcaservices = new ArrayList(); + extendedcaservices.add( + new OCSPCAServiceInfo(active, renew)); + + if(crlperiod != 0){ + X509CAInfo x509cainfo = new X509CAInfo(caid, validity, + catoken, description, + crlperiod, crlpublishers, + useauthoritykeyidentifier, + authoritykeyidentifiercritical, + usecrlnumber, + crlnumbercritical, + finishuser,extendedcaservices); + + cadatahandler.editCA((CAInfo) x509cainfo); + + + + if(request.getParameter(BUTTON_SAVE) != null){ + // Do nothing More + + includefile="choosecapage.jspf"; + } + if(request.getParameter(BUTTON_RECEIVEREQUEST) != null){ + filemode = RECIEVERESPONSEMODE; + includefile="recievefile.jspf"; + } + if(request.getParameter(BUTTON_RENEWCA) != null){ + int signedby = cadatahandler.getCAInfo(caid).getCAInfo().getSignedBy(); + if(signedby != CAInfo.SIGNEDBYEXTERNALCA){ + cadatahandler.renewCA(caid, null); + carenewed = true; + }else{ + includefile="renewexternal.jspf"; + } + } + if(request.getParameter(BUTTON_REVOKECA) != null){ + int revokereason = Integer.parseInt(request.getParameter(SELECT_REVOKEREASONS)); + cadatahandler.revokeCA(caid, revokereason); + includefile="choosecapage.jspf"; + } + if(request.getParameter(BUTTON_PUBLISHCA) != null){ + cadatahandler.publishCA(caid); + capublished = true; + includefile="choosecapage.jspf"; + } + + } + } + } + } + if(request.getParameter(BUTTON_CANCEL) != null){ + // Don't save changes. + includefile="choosecapage.jspf"; + } + + + } + if( action.equals(ACTION_MAKEREQUEST)){ + if(!buttoncancel){ + try{ + Collection certchain = CertTools.getCertsFromPEM(file); + try{ + CAInfo cainfo = cabean.getRequestInfo(); + cadatahandler.createCA(cainfo); + ExtendedPKCS10CertificationRequest certreq = null; + try{ + certreq=cadatahandler.makeRequest(caid, certchain, true); + cabean.savePKCS10RequestData(certreq); + filemode = CERTREQGENMODE; + includefile = "displayresult.jspf"; + }catch(Exception e){ + cadatahandler.removeCA(caid); + errorrecievingfile = true; + includefile="choosecapage.jspf"; + } + }catch(CAExistsException caee){ + caexists = true; + } + }catch(Exception e){ + errorrecievingfile = true; + } + }else{ + cabean.saveRequestInfo((CAInfo) null); + } + } + + if( action.equals(ACTION_RECEIVERESPONSE)){ + if(!buttoncancel){ + try{ + if (caid != 0) { + cadatahandler.receiveResponse(caid, file); + caactivated = true; + } + }catch(Exception e){ + errorrecievingfile = true; + } + } + } + if( action.equals(ACTION_PROCESSREQUEST)){ + if(!buttoncancel){ + try{ + BufferedReader bufRdr = new BufferedReader(new InputStreamReader(file)); + while (bufRdr.ready()) { + ByteArrayOutputStream ostr = new ByteArrayOutputStream(); + PrintStream opstr = new PrintStream(ostr); + String temp; + while ((temp = bufRdr.readLine()) != null){ + opstr.print(temp + "\n"); + } + opstr.close(); + + PKCS10RequestMessage certreq = se.anatom.ejbca.apply.RequestHelper.genPKCS10RequestMessageFromPEM(ostr.toByteArray()); + + if (certreq != null) { + cabean.savePKCS10RequestData(certreq.getCertificationRequest()); + processedsubjectdn = certreq.getCertificationRequest().getCertificationRequestInfo().getSubject().toString(); + processrequest = true; + includefile="editcapage.jspf"; + } + } + }catch(Exception e){ + errorrecievingfile = true; + } + }else{ + cabean.savePKCS10RequestData((ExtendedPKCS10CertificationRequest) null); + } + } + if( action.equals(ACTION_PROCESSREQUEST2)){ + if(request.getParameter(BUTTON_CANCEL) == null){ + // Create and process CA + caname = request.getParameter(HIDDEN_CANAME); + + catype = Integer.parseInt(request.getParameter(HIDDEN_CATYPE)); + String subjectdn = request.getParameter(TEXTFIELD_SUBJECTDN); + try{ + X509Name dummy = new X509Name(subjectdn); + }catch(Exception e){ + illegaldnoraltname = true; + } + + int certprofileid = 0; + if(request.getParameter(SELECT_CERTIFICATEPROFILE) != null) + certprofileid = Integer.parseInt(request.getParameter(SELECT_CERTIFICATEPROFILE)); + int signedby = 0; + if(request.getParameter(SELECT_SIGNEDBY) != null) + signedby = Integer.parseInt(request.getParameter(SELECT_SIGNEDBY)); + String description = request.getParameter(TEXTFIELD_DESCRIPTION); + if(description == null) + description = ""; + + int validity = 0; + if(request.getParameter(TEXTFIELD_VALIDITY) != null) + validity = Integer.parseInt(request.getParameter(TEXTFIELD_VALIDITY)); + + if(catype != 0 && subjectdn != null && caname != null && + certprofileid != 0 && signedby != 0 && validity !=0 ){ + if(catype == CAInfo.CATYPE_X509){ + // Create a X509 CA + String subjectaltname = request.getParameter(TEXTFIELD_SUBJECTALTNAME); + if(subjectaltname == null) + subjectaltname = ""; + else{ + if(!subjectaltname.trim().equals("")){ + se.anatom.ejbca.ra.raadmin.DNFieldExtractor subtest = + new se.anatom.ejbca.ra.raadmin.DNFieldExtractor(subjectaltname,se.anatom.ejbca.ra.raadmin.DNFieldExtractor.TYPE_SUBJECTALTNAME); + if(subtest.isIllegal() || subtest.existsOther()){ + illegaldnoraltname = true; + } + } + } + + String policyid = request.getParameter(TEXTFIELD_POLICYID); + if(policyid == null || policyid.trim().equals("")) + policyid = null; + + int crlperiod = 0; + + boolean useauthoritykeyidentifier = false; + boolean authoritykeyidentifiercritical = false; + + boolean usecrlnumber = false; + boolean crlnumbercritical = false; + + boolean finishuser = false; + ArrayList crlpublishers = new ArrayList(); + + if(!illegaldnoraltname){ + if(request.getParameter(BUTTON_PROCESSREQUEST) != null){ + X509CAInfo x509cainfo = new X509CAInfo(subjectdn, caname, 0, subjectaltname, + certprofileid, validity, + null, catype, signedby, + null, null, description, -1, null, + policyid, crlperiod, crlpublishers, + useauthoritykeyidentifier, + authoritykeyidentifiercritical, + usecrlnumber, + crlnumbercritical, + finishuser, + new ArrayList()); + try{ + ExtendedPKCS10CertificationRequest req = cabean.getPKCS10RequestData(); + java.security.cert.Certificate result = cadatahandler.processRequest(x509cainfo, new PKCS10RequestMessage(req)); + cabean.saveProcessedCertificate(result); + filemode = CERTGENMODE; + includefile="displayresult.jspf"; + }catch(CAExistsException caee){ + caexists = true; + } + } + } + } + } + } + } + + if( action.equals(ACTION_RENEWCA_MAKEREQUEST)){ + if(!buttoncancel){ + try{ + Collection certchain = CertTools.getCertsFromPEM(file); + ExtendedPKCS10CertificationRequest certreq = cadatahandler.makeRequest(caid, certchain, false); + cabean.savePKCS10RequestData(certreq); + + filemode = CERTREQGENMODE; + includefile = "displayresult.jspf"; + }catch(Exception e){ + errorrecievingfile = true; + includefile="choosecapage.jspf"; + } + }else{ + cabean.saveRequestInfo((CAInfo) null); + } + } + if( action.equals(ACTION_RENEWCA_RECIEVERESPONSE)){ + if(!buttoncancel){ + try{ + if (caid != 0) { + cadatahandler.receiveResponse(caid, file); + carenewed = true; + } + }catch(Exception e){ + errorrecievingfile = true; + } + } + } + if( action.equals(ACTION_CHOOSE_CATYPE)){ + // Currently not need + } + if( action.equals(ACTION_CHOOSE_CATOKENTYPE)){ + + catokenpath = request.getParameter(SELECT_CATOKEN); + caname = request.getParameter(HIDDEN_CANAME); + if(catokenpath.equals("NONE")){ + catokentype = CATokenInfo.CATOKENTYPE_P12; + }else{ + catokentype = CATokenInfo.CATOKENTYPE_HSM; + } + editca = false; + includefile="editcapage.jspf"; + } + + } + }catch(CATokenOfflineException ctoe){ + catokenoffline = true; + includefile="choosecapage.jspf"; + } + + + // Include page + if( includefile.equals("editcapage.jspf")){ +%> + <%@ include file="editcapage.jspf" %> +<%} + if( includefile.equals("choosecapage.jspf")){ %> + <%@ include file="choosecapage.jspf" %> +<%} + if( includefile.equals("recievefile.jspf")){ %> + <%@ include file="recievefile.jspf" %> +<%} + if( includefile.equals("displayresult.jspf")){ %> + <%@ include file="displayresult.jspf" %> +<%} + if( includefile.equals("renewexternal.jspf")){ %> + <%@ include file="renewexternal.jspf" %> +<%} + + + // Include Footer + String footurl = globalconfiguration.getFootBanner(); %> + + + + + + diff -urN ../../312/ejbca/src/adminweb/ca/editcertificateprofiles/certificateprofilepage.jspf ./src/adminweb/ca/editcertificateprofiles/certificateprofilepage.jspf --- ../../312/ejbca/src/adminweb/ca/editcertificateprofiles/certificateprofilepage.jspf Tue Jun 28 15:01:32 2005 +++ ./src/adminweb/ca/editcertificateprofiles/certificateprofilepage.jspf Thu Nov 24 22:16:37 2005 @@ -20,6 +20,26 @@ TreeMap authorizedpublishers = ejbcawebbean.getInformationMemory().getAuthorizedPublisherNames(); HashMap publisheridtonamemap = ejbcawebbean.getInformationMemory().getPublisherIdToNameMap(); + int[] usefieldsindn = {DNFieldExtractor.CN, DNFieldExtractor.UID, DNFieldExtractor.SN, + DNFieldExtractor.GIVENNAME, DNFieldExtractor.SURNAME, DNFieldExtractor.T, + DNFieldExtractor.L, DNFieldExtractor.INITIALS, DNFieldExtractor.E, + DNFieldExtractor.ST, DNFieldExtractor.C, DNFieldExtractor.O, DNFieldExtractor.OU, + DNFieldExtractor.UNSTRUCTUREDADDRESS, DNFieldExtractor.UNSTRUCTUREDNAME }; + + String[] usefieldsindntexts = {"MATCHCOMMONNAME","MATCHUID","MATCHDNSERIALNUMBER", + "MATCHGIVENNAME", "MATCHSURNAME","MATCHTITLE", + "MATCHLOCALE","MATCHINITIALS","OLDEMAILDN1", "MATCHSTATE", + "MATCHCOUNTRY", "MATCHORGANIZATION", "MATCHORGANIZATIONUNIT", + "UNSTRUCTUREDADDRESS","UNSTRUCTUREDNAME"}; + + int[] usefieldsinaltname = {DNFieldExtractor.RFC822NAME, DNFieldExtractor.DNSNAME, DNFieldExtractor.IPADDRESS, + DNFieldExtractor.URI, DNFieldExtractor.UPN, DNFieldExtractor.GUID}; + + + String[] usefieldsinaltnametexts = {"RFC822NAME","DNSNAME","IPADDRESS", + "UNIFORMRESOURCEID", "UPN","GUID"}; + + int row = 0; %>