spring-projects / spring-projects/spring-boot

SslConfigurationValidator should check if the configured key alias is for a key and certificate

Open
#25,112 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: pending-design-work theme: ssl type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

When using a PKCS12 keystore without a password, one will simply receive errors such as this on the clientside:

* NSS error -12286 (SSL_ERROR_NO_CYPHER_OVERLAP)
* Cannot communicate securely with peer: no common encryption algorithm(s).

This is due to the Sun keystore loading the key, but not the certificate entries from a PKCS12 store without a password.

org.springframework.boot.web.server.SslConfigurationValidator#validateKeyAlias validates that the configured key alias is present (which it is), but no corresponding certificate alias will be present, which leads to a handshake failure deep down in the guts of the JDK's SSL handshaker.

SslConfigurationValidator could potentially use keyStore.isCertificateEntry(keyAlias) and keyStore.isKeyEntry(keyAlias) to check for this case.

I am unaware if every TLS ciphersuites requires a certificate, but potentially having a warning here would be nice to avoid chasing this problem.

Some references to OpenJDK not "truly" supporting PKCS12 without a password can also be found here:
https://stackoverflow.com/questions/58345405/how-to-use-non-password-protected-p12-ssl-certificate-in-spring-boot

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with org.springframework.boot.web.server.SslConfigurationValidator#validateKeyAlias and inspect how the configured alias is currently validated against the keystore. Determine how missing certificate and key entries should be reported for passwordless PKCS12 stores, then verify that the validator catches the handshake-failure case without rejecting valid aliases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.