Skip to content

[BUG] - RSAKey sign_ssh_data raises KeyError: 'ssh-rsa' with default algorithm #2628

Closed

Description

@ultraplanet

Are you using paramiko as a client or server?

Client

What feature(s) aren't working right?

Keys/auth

What version(s) of paramiko are you using?

5.0.0

What version(s) of Python are you using?

3.10.12

What operating system and version are you using?

WSL on Windows 11

If you're connecting as a client, which SSH server are you connecting to?

No response

If you're using paramiko as part of another tool, which tool/version?

No response

Expected/desired behavior

RSAKey.sign_ssh_data successfully signed SSH data.

Actual behavior

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ultraplanet/.local/lib/python3.10/site-packages/paramiko/rsakey.py", line 142, in sign_ssh_data
    algorithm=self.HASHES[algorithm](),
KeyError: 'ssh-rsa'

How to reproduce

key = RSAKey.generate(1024)
msg = key.sign_ssh_data(b"jerri blank")

Anything else?

'ssh-rsa' was removed in 5.0.0, I guess we should use 'rsa-sha2-256' by default. It would be better to add a check for the algorithm parameter.

Activity

  1. bitprophet commented on Oct 10, 2026

    @bitprophet
    Member

    Thanks for the report! This will be fixed in 5.0.1. Defaults to rsa-sha2-512 instead of 256, since when a user doesn't have an opinion, it felt best to default to the strongest possible algorithm.

  2. added a commit that references this issue on Oct 10, 2026
    11f9840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions