Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept keystore password also for truststore. #2248

Open
aioobe opened this issue Feb 4, 2022 · 2 comments
Open

Accept keystore password also for truststore. #2248

aioobe opened this issue Feb 4, 2022 · 2 comments

Comments

@aioobe
Copy link

aioobe commented Feb 4, 2022

What happened?

keytool (and the JDK in general) is moving away from the proprietary JKS format and over to the wider used standardized PKCS12 format (JEP 229). The default format for keytool for example, is as of JDK 9, PKCS12 instead of JKS.

One difference between these two formats is that PKCS12 requires password protection also for public certificates. (At least to the extent of my knowledge. I've managed to create a PKCS12 keystore programatically with an empty password, but not without a password.)

In a JKS keystore you may have noticed that keytool -list can show public certificates, even if you just hit enter at the password prompt. As for PKCS12 keystores this is not the case.

In our SslSocketFactories class we've hardcoded the choice to use no password at all when loading the truststore:

keyStore = KeyStores.loadKeyStore(trustStoreType.name(), trustStorePath, Optional.empty());

What did you want to happen?

I would suggest we extend the SslConfiguration class which now accepts...

  • trustStorePath
  • keyStorePath
  • keyStorePassword

...to also include

  • trustStorePassword

and make use of this value when loading truststore certificates in the line linked above.

@robert3005
Copy link
Contributor

I have done bunch of work a while back to not use jks nor pkcs12 and implemented pem parsers. Arguably we don't support encrypted pems but ideally you'd switch to those.

@aioobe
Copy link
Author

aioobe commented Feb 5, 2022

[...] ideally you'd switch to those.

Are you suggesting to drop support for JKS / PKCS12 in favor of PEM?

I noticed that we do have some support form PEM too (SslSocketFactories.java:263) but perhaps not with encryption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants