Under the KISS method generating Apache/Tomcat certificate requests (CSRs) under Windows can be a pain if you don’t do it that often. Below is a sample batch script to automatically generate the certificates for you.
echo off REM building up the variables set myFQDN=%COMPUTERNAME%.liquidobject.com set myFileBase=%COMPUTERNAME%_liquidobject.com set myJavaPath=C:\jdk1.6.0_14\bin\ set myOutputPath=C:\ssl_keys\ set myKeySize=2048 set myOrganization=OU=My Department, O=My Business, L=My City, ST=My State, C=us REM variables set cls echo. echo. echo Generating a certificate for %myFQDN%, please wait... echo. echo. echo Please supply a password for the keystore file echo. %myJavaPath%keytool -genkey -alias server -keyalg RSA -keysize %myKeySize% -keystore %myOutputPath%%myFileBase%.jks -dname "CN=%myFQDN%, %myOrganization%" %myJavaPath%keytool -certreq -alias server -file %myOutputPath%%myFileBase%.csr -keystore %myOutputPath%%myFileBase%.jks echo. echo. echo Your certificate signing request is in %myFileBase%.csr. echo Your keystore file is %myFileBase%.jks. echo. echo. echo CSR output below: echo. more %myOutputPath%%myFileBase%.csr echo on