Generating a CSR on Sun Java System Web Server 7.x

Author:Mikkel Haldorsen
Updated:Apr 29, 2025

To generate a Certificate Signing Request (CSR) for your SSL certificate using keytool, follow these steps:

  1. Create a Keystore:

    • Open your terminal or command prompt.
    • Navigate to the directory where you want your keystore file, typically keystore.jks.
    • Run the following command to create an empty keystore:
      keytool -keystore keystore.jks
      
    • You will be prompted for a password. Choose a strong password and remember it.
  2. Generate Key Pair:

    • Use the keytool -genkey command to create a key pair.
      keytool -genkey -alias mykey -keyalg RSA -keysize 2048 -keystore keystore.jks
      
    • Enter the alias (default: mykey) and provide the keystore password when prompted.
  3. Generate CSR:

    • Use the keytool -certreq command to create the CSR.
      keytool -certreq -alias mykey -file csr.csr -keystore keystore.jks
      
    • Enter the keystore password when prompted.
    • The resulting file will be csr.csr.
  4. Submit CSR:

    • Upload the csr.csr file to your Certificate Authority (CA) to request your SSL certificate.
  5. Install SSL Certificate:

    • After obtaining your certificate, follow the CA's instructions to install it on your server or website.
  6. Check for ECC Support:

    • If using curves like secp521r1, ensure your browser supports them. For broader compatibility, consider using RSA instead if you encounter issues.
  7. Verify System Setup:

    • Ensure Java Development Kit (JDK 8 or later) is installed on your system, as keytool is typically part of the JDK.