Skip to content

Commit

Permalink
added support for PPK format private keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Dec 29, 2024
1 parent 21ac760 commit 571dbe3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sha1 = { version = "0.10.5", features = ["oid"] }
sha2 = { version = "0.10.6", features = ["oid"] }
signature = "2.2"
ssh-encoding = { version = "0.2", features = ["bytes"] }
ssh-key = { version = "0.6.3-internal.2", features = [
ssh-key = { version = "0.6.7-internal.4", features = [
"ed25519",
"rsa",
"rsa-sha1",
Expand All @@ -36,6 +36,7 @@ ssh-key = { version = "0.6.3-internal.2", features = [
"p521",
"encryption",
], package = "internal-russh-forked-ssh-key" }
"ppk",
thiserror = "1.0.30"
tokio = { version = "1.17.0" }
tokio-stream = { version = "0.1.3", features = ["net", "sync"] }
3 changes: 3 additions & 0 deletions russh-keys/src/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ enum Format {
/// Decode a secret key, possibly deciphering it with the supplied
/// password.
pub fn decode_secret_key(secret: &str, password: Option<&str>) -> Result<PrivateKey, Error> {
if secret.trim().starts_with("PuTTY-User-Key-File-") {
return Ok(PrivateKey::from_ppk(secret, password.map(Into::into))?);
}
let mut format = None;
let secret = {
let mut started = false;
Expand Down

0 comments on commit 571dbe3

Please sign in to comment.