Ssh Crypto Policy
Resolved connection policy. Obtain a fresh snapshot with resolve after installing crypto providers. Expressions contain bare names (an exact list), or individually prefixed ^ / + / - entries. Custom overrides always use DEFAULT as their base. Protocol KEX markers are managed separately.
Preset definitions evolve with library releases:
CryptoPolicyPreset.DEFAULT: modern algorithms, with RSA and finite-field DH minimum 2048 bits.
CryptoPolicyPreset.FUTURE: hybrid post-quantum KEX only, 256-bit encryption keys, and RSA/DH minimum 3072 bits.
CryptoPolicyPreset.FIPS: an AES/SHA-2/NIST ECDH/fixed-DH/RSA-SHA2/ECDSA subset. This is an algorithm filter, not a claim of FIPS validation for the provider or application.
CryptoPolicyPreset.LEGACY: modern preferences followed by compatibility algorithms, with RSA/DH minimum 1024 bits.
An exact expression is an ordered comma-separated list of names. Delta entries individually use ^ (prepend), + (append), or - (exclude), for example ^curve25519-sha256,+diffie-hellman-group1-sha1,-ecdh-sha2-nistp256. Unsupported or unavailable positive entries are skipped and reported in warnings; callers should preserve the original expression. minimumRsaBits and minimumDhBits are independent numeric requirements that explicit algorithm selections cannot bypass. The group1 example therefore also requires minimumDhBits = 1024.
Install platform crypto providers before resolving and apply the snapshot with SshClientConfig.Builder.cryptoPolicy. Persist user expressions and preset names, rather than the runtime catalog or resolved algorithm lists. Public-key authentication selections are independent of server host-key selections.