SIA SSH fails with error: signature algorithm "rsa-sha2-512" isn't a key format; key is malformed and should be re-encoded with type "ssh-rsa"
Symptom
When attempting to connect to a FortiGate device via SSH using Idira SIA, the connection fails immediately during the SSH handshake phase.
Common symptoms include:
- SIA session fails before a shell is established
- No successful SSH session is recorded on the FortiGate
- SIA session diagnostics show:
ssh: handshake failed: signature algorithm "rsa-sha2-512" isn't a key format; key is malformed and should be re-encoded with type "ssh-rsa" - SSH connections from permissive clients (for example, some OpenSSH builds) may still succeed to the same device
- The issue occurs consistently for the affected target and is reproducible
Environment
Secure Infrastructure Access (formerly DPA) DPA for SSH
Cause
The FortiGate SSH server sends a malformed SSH_MSG_KEX_REPLY packet where the host key type is incorrectly set to a signature algorithm name (rsa-sha2-512) instead of a valid SSH host key format (such as ssh-rsa or ssh-ed25519).
This violates the SSH protocol specification.
Idira SIA correctly rejects this during the SSH handshake.
How to Identify
- Capture the SSH traffic between the SIA connector and the FortiGate.
- Open the capture in Wireshark.
- Apply the display filter:
ssh.message_code == 31 - Inspect the Elliptic Curve Diffie-Hellman Key Exchange Reply.
Bad (problematic) behavior:
KEX host key (type: rsa-sha2-512)
KEX host signature (type: rsa-sha2-512)
Good (valid) behavior:
KEX host key (type: ssh-rsa)
KEX host signature (type: rsa-sha2-256)
or
KEX host key (type: ssh-ed25519)
KEX host signature (type: ssh-ed25519)
If rsa-sha2-256 or rsa-sha2-512 appears as the host key type, the SSH server is malformed and SIA will fail the connection.
Resolution
There is no CyberArk-side fix for this issue.
The malformed SSH host key encoding originates from the FortiGate SSH implementation. Resolution requires a FortiGate-side change, such as:
- Upgrading FortiOS to a build that correctly advertises the SSH host key type.
- Applying a Fortinet-recommended fix or firmware update.
Workarounds
- Verify whether a FortiOS firmware upgrade resolves the issue on the affected device.
- Use an alternative access method (for example, PSMP) if supported and acceptable.
- Engage Fortinet support and provide the packet capture showing the malformed
SSH_MSG_KEX_REPLY.
Additional Notes
- This issue is not tied to a specific FortiOS major version; working and failing behavior has been observed across different FortiOS builds.
- There is no FortiOS CLI command or configuration that can intentionally force or correct this malformed SSH host key behavior.
- The presence of
rsa-sha2-256orrsa-sha2-512is valid only in the host signature field, not as the host key type.