We have a requirement to use Java SSL authentication to a host that has its certificate created by a private CA. We have added the private intermediate and root certificates to the cacerts keystore in /usr/local/openjdk11/lib/security/cacerts but we still get this error:
Synopsis of solution:
1. First, the importance of the alias value in the keystore file was not evident to me. Where OpenSSL is given specific certificates and searches the provided CA bundle file serially from bottom to top to validate Java searches the keystore for key certificate pairs using the alias value. Once this matter was cleared up the remaining problems were artifacts of previous attempts at a solution.
2. In the end we used an open source application named KeyStore Explorer http://keystore-explorer.org/ o manage the applicaityon keystore . This is considerably less painful means of managing Java key/trust stores than using
3. It is possible that having multiple versions of OpenJDK installed contributed to confusing the solution to the problem.
Code:
openssl s_client -connect mx32.harte-lyne.ca:465
CONNECTED(00000003)
depth=2 CN = CA_HLL_ROOT_2016, ST = Ontario, O = Harte & Lyne Limited, OU = Networked Data Services, C = CA, DC = harte-lyne, DC = ca, L = Hamilton
verify return:1
depth=1 CN = CA_HLL_ISSUER_2016, OU = Networked Data Services, O = Harte & Lyne Limited, L = Hamilton, ST = Ontario, C = CA, DC = harte-lyne, DC = ca
verify return:1
depth=0 CN = mx32.harte-lyne.ca, OU = Networked Data Systems, O = Harte & Lyne Limited, L = Hamilton, ST = Ontario, C = CA, DC = hamilton, DC = harte-lyne, DC = ca
verify return:1
. . .
JAVA_VERSION="11" keytool -list -rfc -cacerts > cacerts.txt
grep 'Alias name' cacerts.txt | grep hll
Alias name: hartelyneissuer2016 [hll]
Alias name: hartelyneroot2016 [hll]
JAVA_VERSION="11" java SSLPoke mx32.harte-lyne.ca 465
sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Path does not chain with any of the trust anchors
Synopsis of solution:
1. First, the importance of the alias value in the keystore file was not evident to me. Where OpenSSL is given specific certificates and searches the provided CA bundle file serially from bottom to top to validate Java searches the keystore for key certificate pairs using the alias value. Once this matter was cleared up the remaining problems were artifacts of previous attempts at a solution.
2. In the end we used an open source application named KeyStore Explorer http://keystore-explorer.org/ o manage the applicaityon keystore . This is considerably less painful means of managing Java key/trust stores than using
keytool
.3. It is possible that having multiple versions of OpenJDK installed contributed to confusing the solution to the problem.
Last edited: