I have a Spring Boot web project, I'm trying to set up SSL with a certificate provided by my employer.
The PFX file is currently working fine to achieve SSL on stand-alone Tomcat with the following config:
<Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" enableLookups="false" disableUploadTimeout="true" keystoreFile="server.pfx" keystoreType="PKCS12" keystorePass="secret" acceptCount="100" scheme="https" secure="true" SSLEnabled="true" clientAuth="false" sslProtocol="TLS" /> In Spring Boot, with the embedded Tomcat I use the following application.properties:
server.port=8088 security.require-ssl=true server.ssl.enabled=true server.ssl.key-password=secret server.ssl.key-store=classpath:server.pfx server.ssl.key-store-provider=SUN server.ssl.key-store-type=PKCS12 server.ssl.key-alias=1 when I start the project, I get the error message
Caused by: java.io.IOException: Failed to load keystore type [PKCS12] with path [file:/Users/user/workspace/tracking/target/classes/server.pfx] due to [PKCS12 not found]
the command keytool -list -keystore /Users/user/workspace/tracking/target/classes/server.pfx'
returns
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
1, 15-Mar-2018, PrivateKeyEntry, Certificate fingerprint (SHA1): F8:A0:CF:A6:AF:B4:ED:53:A0:79:25:03:04:D9:79:F0:FC:B2:49:DF
is there a different value I should be using for server.ssl.key-store-type?
UPDATE
I also tried changing to server.ssl.key-store-type=JKS but then I get:
IllegalArgumentException: Private key must be accompanied by certificate chain
Is there a way around either of these problems?
KeyStore PKCS12was (and still is) in providerSunJSSEnotSUN-- that's why you got not-found. You're generally better off not specifying the provider and letting JCA find it. @MarcoA.Hernandez+ however since 8u60 in 2015 a 'compatibility' feature allows theKeyStore JKSimplementation to read PKCS12 as well -- and Java 8 keytool misleadingly lists it as type: JKS just as you posted. Thus specifying JKS should have worked if keytool (from the same version?) did. I doubt you still have the problem, but if you do with a keystore you can share I'd be interested to look.