I've found some related questions, but mine is a little different.
Client app running on Windows, using Java 1.7 (71) with bouncycastle connecting to a tomcat 8.5.xx server running Java 1.8 (161) on either Linux RH or Windows 10. The Linux and Windows server installations should be identical (other than being Linux and Windows). We control the software on both sides.
Client app works correctly when connecting to Windows. When connecting to Linux it fails the SSL handshake with:
java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive)
at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenerator.java:120)
at java.security.KeyPairGenerator$Delegate.initialize(Unknown Source)
This isn't totally surprising, because Java 7 can't handle large DH keys. But when the client connects to the Windows server (same version of tomcat, same version of Java), the SSL handshake works flawlessly and the connection goes through.
Setting javax.net.debug appropriately shows that, yes, the Linux server is sending a 2048 bit DH key and Windows is sending 1024. I have no idea why.
The java.security files are the same for the Windows and Linux server (except windows has sun.security.mscapi.SunMSCAPI provider). crypto.policy=unlimited is commented out on both.
Two part question:
- Where else can I look to find out why the two systems behave differently? Is this an OS crypto library difference?
- Is there a way to resolve this problem without changing the client code (it's legacy code and we'd rather not patch)?