Very new to SSL installation in Tomcat 8.5. OS: CentOS 7
I have SSL certificates from GoDaddy and have the private key used to generate the certificates.
This private key was shared in a .txt file and I copied it into a .key file to distinguish it from other files. It is stored in a file sitename.com.key
In a bundle from GoDaddy downloaded for Tomcat following files are present
- a-hash-code.crt
- a-hash-code.pem
- gd_bundle-g2-g1.crt
- gdig2.crt.pem
Going through Tomcat 8.5 documentation and other guides I have done the following steps to create a keystore and import certificates into the keystore.
- sudo keytool -import -trustcacerts -alias intermediate -file
gd_bundle-g2-g1.crt -keystore keystore-name.keystore
- sudo keytool -import -trustcacerts -alias root -file a-hash-code.crt -keystore keystore-name.keystore
Importing Private Key into the Keystore
- sudo openssl pkcs12 -export -name servercert -in gd_bundle-g2-g1.crt -inkey sitename.com.key -out p12keystore.12
This step 3 throws error in terminal
unable to load private key
140041401685904:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:707:Expecting: ANY PRIVATE KEY
Private Key file is of the following format
-----BEGIN PRIVATE KEY-----
Hash
-----END PRIVATE KEY-----
Checked key file mime type and it shows UTF8.
$ file -i sitename.com.key
sitename.com.key: text/plain; charset=utf-8
OpenSSL Version
OpenSSL 3.0.7 1 Nov 2022 (Library: OpenSSL 3.0.7 1 Nov 2022)
What is the problem here?