From Java 17 to 21, the JDK made several security enhancements, including:
1) Using larger key sizes by default for cryptographic algorithms like AES, ECDSA, and DH to improve resilience against attacks.
2) Adding support for post-quantum cryptography algorithms like HSS/LMS signature verification.
3) Restricting or disabling weak algorithms like SHA-1, 3DES, and RC4 by default.
4) Improving security APIs and providing replacements for deprecated ones like the Security Manager and parts of JAAS.