Skip to content

Commit 2bfe426

Browse files
authored
Fix hardcoded public key auth negotiation (#294)
Authentication using RSA public keys was incorrectly hardcoded to use `ssh-rsa`, i.e., SHA1. This led to public keys set up to use `rsa-sha2-256` or `rsa-sha2-512` falling back to `ssh-rsa` and being rejected by modern SSH servers that are configured not to support SHA1 by default. The solution derives the hash name from the public key instead of hardcoding it.
1 parent 461d62a commit 2bfe426

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

russh/src/negotiation.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,12 @@ impl Named for () {
138138
}
139139

140140
use russh_keys::key::ED25519;
141-
use russh_keys::key::SSH_RSA;
142141

143142
impl Named for PublicKey {
144143
fn name(&self) -> &'static str {
145144
match self {
146145
PublicKey::Ed25519(_) => ED25519.0,
147-
PublicKey::RSA { .. } => SSH_RSA.0,
146+
PublicKey::RSA { ref hash, .. } => hash.name().0,
148147
PublicKey::EC { ref key } => key.algorithm(),
149148
}
150149
}

0 commit comments

Comments
 (0)