After generating java keystore with: -keyalg RSA -keysize 2048 and configuring the java.security policy with:
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, RSA keySize < 2048 I keep getting errors:
java.security.cert.CertPathValidatorException: Algorithm constraints check failed on key RSA with size of 1024bits
I’m using the following command to generate a 2048bit RSA key:
keytool -genkey -alias tomcat -keyalg RSA -keysize 2048 -keystore star_domain_name.jks -storetype PKCS12 -dname "CN=*.domain_name.com,OU=Engineering, O=Company Name., L=City Name, ST=State, C=US" && keytool -certreq -alias server -file star_domain_name.com.csr -keystore star_domain_name_io.jks I then verify the above with:
openssl s_client -showcerts -connect localhost:443 That shows:
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384 Server public key is 2048 bit Secure Renegotiation IS supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 I also view the keystore with:
keytool -list -v -keystore star_domain_name.com.jks Which shows:
Certificate fingerprints: MD5: 67:4C:04:90:35:etc...etc... SHA1: AD:C8:06:74:3A:F1:72:etc...etc... SHA256: C5:D6:81:3B:C1:F7:CE:2D:43:91:06:E9:9etc...etc... Signature algorithm name: SHA256withRSA Subject Public Key Algorithm: 2048-bit RSA key Everywhere I look I see 2048-bit RSA key. However, when I want to use the java keystore in my java spring boot application, it keeps complaining:
- Caused by: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on key RSA with size of 1024bits
- Caused by: java.security.cert.CertificateException: Certificates do not conform to algorithm constraints
As soon as I edit the java.security file, and remove RSA keySize < 2048 from it, and restart the application, everything works…
Is this because I did not import a signed domain cert? Why does the application complain although I clearly configured the policy and the java keystore for 2048 bits?
My java application configuration contains:
ssl.key-store: /opt/cert_path/star_domain_name.com.jks ssl.enabled: true ssl.key-store-password: the_password_etc... ssl.key-store-type: PKCS12 ssl.key-alias: tomcat As soon as I edit the java.security file, and remove RSA keySize < 2048 from it, and restart the application, everything works…
Is this because I did not import a signed domain cert and the keystore is empty? I doubt it.
Why does the application complain although I clearly configured the policy file and the java keystore for 2048 bits?
The java.security file also contains:
jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024, DSA keySize < 1024 Should that also be adjusted?
I've actually tried to adjust that, but that had no effect...
java.security.cert.CertPathValidatorException.... "try also"jdk.certpath.disabledAlgorithms(...additionally tojdk.tls...andjdk.jar...)