I am trying to secure my private docker registry using SSL encryption. According to this, I need to copy a .crt and .key to a /certs directory and it will work.
What I have now is a .csr, .keystore and .cer and a root ca, intermediate certificate.
I used Java Keytool to generate .csr and keystore and CA gave me .cer, root ca and intermediate certificate.
Now according to link mentioned above, I specifically need .crt and .key.
What I did that
I imported
root certificate (root ca),intermediate certificatandreceived signed certificate (.cer)intokeystorekeytool -import -trustcacerts -alias rootca -file Primary.pem -keystore hostname.keystorekeytool -import -trustcacerts -alias intermediate -file Secondary.pem -keystore hostname.keystorekeytool -import -trustcacerts -alias hostname -file cert.cer -keystore hostname.keystorewhere
Primary.pemandSecondary.pemare Root and Intermediate certificates respectively andcert.ceris received signed certificate andhostname.keystoreis keystore used.Then I tried to generate
.keyand.crtfromhostname.keystoreby first converting it intoPKCS12as described here but after the first step, I got following errorProblem importing entry for alias rootca: java.security.KeyStoreException: TrustedCertEntry not supportedSee below for command and error:
keytool -importkeystore -srckeystore hostname.keystore -destkeystore hostname.p12 -deststoretype PKCS12Enter destination keystore password: Enter source keystore password:Problem importing entry for alias rootca: java.security.KeyStoreException: TrustedCertEntry not supported. Entry for alias rootca not imported. Do you want to quit the import process? [no]: noProblem importing entry for alias intermediate: java.security.KeyStoreException: TrustedCertEntry not supported. Entry for alias intermediate not imported. Do you want to quit the import process? [no]: noExisting entry alias domain exists, overwrite? [no]: yes Entry for alias domain successfully imported.Problem importing entry for alias hostname: java.security.KeyStoreException: TrustedCertEntry not supported. Entry for alias hostname not imported. Do you want to quit the import process? [no]: noImport command completed: 1 entries successfully imported, 3 entries failed or cancelledHow to solve this issue and secure the registry? Is it related to Java version?
Platform: RHEL 4.1
Java Version: 1.7.0_75