Bootstrap FreeKB - OpenShift - Resolve "error: tls: failed to parse private key"
OpenShift - Resolve "error: tls: failed to parse private key"

Updated:   |  OpenShift articles

Let's say "error: tls: failed to parse private key" is being returned when attempting to create a TLS secret.

~]$ oc create secret tls my-tls-secret --cert example.cer --key example.key 
error: tls: failed to parse private key

 

This will occur when the private key is encrypted.

 

~]$ cat example.key
-----BEGIN ENCRYPTED PRIVATE KEY-----

 

For example, lets say you used this one liner OpenSSL command to create a self signed public certificate example.cer and private key example.key. This command will prompt you for the pass phrase to protect the encrypted private key.

~]# openssl req -x509 -sha256 -days 365 -newkey rsa:2048 -keyout example.key -out example.cer -subj "/C=US/ST=California/L=Los Angeles/O=FreeKB/OU=IT/CN=example.com"
Generating a 2048 bit RSA private key
........................................................................+++
...........................+++
writing new private key to 'example.key'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:

 

On the other hand, this one liner can be used to create a self signed RSA public certificate. The -nodes option is used to create an unencrypted private key and you will not be prompted to create a pass phrase for the private key.

openssl req -x509 -sha512 -nodes -days 365 -newkey rsa:4096 -keyout example.key -out example.cer -subj "/C=US/ST=California/L=Los Angeles/O=FreeKB/OU=IT/CN=example.com"

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter d8f258 in the box below so that we can be sure you are a human.