Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh-key: support for reading PPK format private keys #324

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
lint x2
Eugeny committed Dec 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 64d5dd4a3dd0dd5ef966ead93ee9d893e652da66
4 changes: 2 additions & 2 deletions ssh-key/src/ppk.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ use hmac::digest::KeyInit;
use hmac::{Hmac, Mac};
use sha2::Sha256;

use crate::private::{EcdsaKeypair, KeypairData};
use crate::private::KeypairData;
use crate::public::KeyData;
use crate::{Algorithm, Error, Mpint, PublicKey};
use encoding::base64::{self, Base64, Encoding};
@@ -403,7 +403,6 @@ fn decode_private_key_as(
)?))
}

#[cfg(feature = "rsa")]
(Algorithm::Rsa { .. }, KeyData::Rsa(pk)) => {
use crate::private::{RsaKeypair, RsaPrivateKey};

@@ -443,6 +442,7 @@ fn decode_private_key_as(
#[cfg(any(feature = "p256", feature = "p384", feature = "p521"))]
(Algorithm::Ecdsa { curve }, KeyData::Ecdsa(public)) => {
// PPK encodes EcDSA private exponent as an mpint
use crate::private::EcdsaKeypair;
use crate::public::EcdsaPublicKey;
use crate::EcdsaCurve;