Skip to content

Accept rsa-sha2-256 and rsa-sha2-512 labels in RSAKey public-key parsing - #2738

Open
sudonishant wants to merge 1 commit into
paramiko:mainfrom
sudonishant:fix-2735-rsa-sha2-pubkey-label
Open

sudonishant wants to merge 1 commit into
paramiko:mainfrom
sudonishant:fix-2735-rsa-sha2-pubkey-label

Conversation

@sudonishant

Copy link
Copy Markdown

Summary

When an SSH server sends an RSA public-key blob whose leading type string is rsa-sha2-256 or rsa-sha2-512 (instead of ssh-rsa), RSAKey.__init__() previously rejected it in _check_type_and_load_cert() because only key_type=self.name ("ssh-rsa") was accepted.

This change updates RSAKey.__init__() (paramiko/rsakey.py) to accept (self.name, "rsa-sha2-256", "rsa-sha2-512") (and the corresponding [email protected] cert types) when loading the key material, while keeping self.name == "ssh-rsa".

Closes #2735.

Validation

  • Added test_rsa_public_key_accepts_rsa_sha2_labels in tests/test_pkey.py covering ssh-rsa, rsa-sha2-256, and rsa-sha2-512.
  • Ran python3 -m pytest --noconftest tests/test_pkey.py tests/test_hostkeys.py -q (52 passed, 1 skipped, 3 subtests passed).
  • git diff --check passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - RSA host-key parsing rejects rsa-sha2-512-labelled public key blob (interoperability)

1 participant