Conversation
…fault PKCS12 provider
nbenaglia
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SslUtils – hostname resolution (server cert SAN)
Wrapped InetAddress.getLocalHost() and hostname/canonical usage in a try/catch.
On any exception, log a warning and continue with a minimal SAN list: localhost, 127.0.0.1, and IPs from network interface enumeration (unchanged).
Ensures server cert generation always completes on Pi/Mac and similar setups; SAN still includes loopback and LAN IPs.
ApiService – corrupt keystore handling
When the keystore file exists and is readable, attempt to load it (with the default PKCS12 provider) before starting Jetty.
If load fails (e.g. EOFException, corrupt format), log a warning, delete the bad file, call SslUtils.generateSsl(), then continue startup.
Users no longer need to manually delete a corrupt keystore; the next startup recovers automatically.
SslUtils.createKeystore() – write with default PKCS12 provider
Replaced KeyStore.getInstance("PKCS12", "BC") with KeyStore.getInstance("PKCS12") for the keystore used in createKeystore() (the one we write and store()).
Keystore file is still standard PKCS12 (one key entry with cert chain).
Avoids “JCE cannot authenticate the provider BC” during keyStore.store() on Oracle Java SE; cert/key generation in SslUtils still uses BC.
ApiService – load keystore with default provider
Removed sslContextFactory.setKeyStoreProvider("BC") so Jetty loads the keystore with the default (e.g. SunJSSE) PKCS12 implementation.
Pre-start validation of the keystore now also uses KeyStore.getInstance("PKCS12") (default provider) so validation matches Jetty and does not falsely treat a valid keystore as corrupt on JVMs where BC cannot load PKCS12.