A NullPointerException occurs when using keytool to create a CSR file

Document ID : KB000024471
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

The keytool -certreq command is used to generate a CSR (certificate signing request) file based on the private key in the keystore file. If the message "keytool error:java.lang.NullPointerException" occurs after the prompt "Enter keystore password:", the most likely cause of the error is entering an empty password value.

ushq-ppm-dev-app01 # /usr/local/ppm/CA/jdk1.5.0_11/bin/keytool -certreq -keystore /usr/local/ppm/CA/clarity/config/.keystore -keyalg RSA -file Clarity.csr
Enter keystore password:
keytool error: java.lang.NullPointerException
[root@ushq-ppm-dev-app01 ~]

ushq-ppm-dev-app01 # /usr/local/ppm/CA/jdk1.5.0_11/bin/keytool -list -keystore /usr/local/ppm/CA/clarity/config/.keystore
Enter keystore password:

***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************

Keystore type: jks
Keystore provider: SUN

Your keystore contains 1 entry

mykey, Mar 13, 2015, keyEntry,
Certificate fingerprint (MD5): 33:F6:D3:9A:7D:4C:3C:7A:D1:55:F0:85:E5:27:94:09

Solution:

The keystore password requires a password to be entered, the value cannot be empty.