Using the TemplateTool utility

Purpose

The TemplateTool utility works with certificate template files. It performs functions that you need if you implement the web application using Java™Server pages (JSPs). There are three certificate template files that are used by PKI Services:
  • A text CGI template file, pkiserv.tmpl, used to implement the web application using REXX CGI execs.
  • An XML template file, pkitmpl.xml, used to implement the web application using JavaServer pages (JSPs).
  • A text CGI template file, pkixgen.tmpl, generated from the XML template file, and used by the PKI Services daemon if you implement the web application using JSPs. Any time that you update pkitmpl.xml, you must use TemplateTool to create an equivalent copy of pkixgen.tmpl. If you do not do this, the daemon writes the following message to the daemon log file when it determines that pkixgen.tmpl is not current:
    IKYC068I The templates file used may not be current
The TemplateTool utility performs the following functions:
  • validateXML

    The validateXML function validates an XML template file against the XML schema file. It can optionally convert the XML template file to a text CGI template file. Use this function after you make changes to your XML schema file, pkiserv.tmpl, to validate the changes and create a CGI template file, pkixgen.tmpl, for use by the PKI Services daemon.

  • convertCGI

    The convertCGI function converts a text CGI template file to an XML template file. This function can assist PKI Services administrators in converting the web application from the REXX CGI execs to the JSPs. The conversion process might not convert all tags, so you should always verify the contents of the resulting XML template file.

  • help

    The help function prints the format of the utility.

Requirement: You must have Java V5.0 or higher installed to run the TemplateTool utility.

Path setup

Update your PATH and CLASSPATH environment variables with the appropriate directories before you run TemplateTool. (Note that you are updating the environment variables for the user running the utility, not updating values in the PKI Services environment variables file, pkiserv.envars.) When you have updated these variables, you can run TemplateTool from the shell script or from Java.
Variable name You must add …
PATH /install-dir/pkiserv/bin
  The directory containing the java command.
CLASSPATH /install-dir/pkiserv/lib/pki_xml.jar
The default directory for install-dir is /usr/lpp.

Format

TemplateTool -help |

             -validateXML [-XMLTemplate XML_template_file]
                          [-CGITemplate CGI_template_file]  |

             -convertCGI [-CGITemplate CGI_template_file]
                         [-XMLTemplate XML_template_file]
To run the utility from Java:
java com.ibm.pki.template.TemplateTool function parameters
To run the utility from the shell script:
TemplateTool function parameters

Parameters

-XMLTemplate XML_template_file
An XML template file. Specify the name of the XML template file if it is in the current directory, or the full path name.

For the validateXML function, this parameter is required. The specified XML template file is validated against the XML schema file PKIServ.xsd, which must be in the same directory.

For the convertCGI function, this parameter is required. The CGI template file specified as input is converted to an XML template file using the XML schema file PKIServ.xsd, and output to the file specified by -XMLTemplate.

-CGITemplate CGI_template_file
A CGI template file. Specify the name of the CGI template file if it is in the current directory, or the full path name.

For the validateXML function, this parameter is optional. If specified, the XML template file specified as input is converted into CGI format and output to the file specified by -CGITemplate. If the CGI template file is to be used by the PKI Services daemon, it must be named pkixgen.tmpl.

For the convertCGI function, this parameter is required. The CGI template file specified is converted to an XML template file using the XML schema file PKIServ.xsd, which must be in the same directory, and output to the file specified by -XMLTemplate.

Examples

Example 1:
TemplateTool -validateXML -XMLTemplate pkitmpl.xml -CGITemplate pkixgen.tmpl
Action: Invokes TemplateTool from the shell script. Validates that the XML template file pkitmpl.xml is valid, and generates a text CGI template file from it named pkixgen.tmpl, for use by the PKI Services daemon.
Example 2:
java com.ibm.pki.template.TemplateTool -convertCGI -CGITemplate pkiserv.tmpl 
-XMLtemplate pkitmpl.xml
Action: Invokes TemplateTool from Java. Converts the text CGI template file named pkiserv.tmpl to an XML template file named pkitmpl.xml.