feat: updates ssh agent

This commit is contained in:
2025-05-26 00:16:39 +08:00
parent 62110ed7fb
commit febdf659cd

View File

@@ -37,9 +37,12 @@ impl Session for MySshAgent {
async fn request_identities(&mut self) -> Result<Vec<Identity>, AgentError> { async fn request_identities(&mut self) -> Result<Vec<Identity>, AgentError> {
information!("request_identities"); information!("request_identities");
// let p256_private_key_d = ecdsautil::parse_p256_private_key(&self.private_key_pem).unwrap(); // let p256_private_key_d = ecdsautil::parse_p256_private_key(&self.private_key_pem).unwrap();
let public_key_point = hex::decode("04\ let public_key_point = hex::decode(
"04\
f17326c188b9d0cffeddd8ff935f24f2074bbef128ac5b04b9cac05de967df5dbfd065698dce3b8c1f451bb9a1593ace\ f17326c188b9d0cffeddd8ff935f24f2074bbef128ac5b04b9cac05de967df5dbfd065698dce3b8c1f451bb9a1593ace\
13360bbc49c51f5213777fd873932efa44763bfcc1c764b122a8a8977bcb3e0ad099d652e63db1c5a1bda02120a16dc5").unwrap(); 13360bbc49c51f5213777fd873932efa44763bfcc1c764b122a8a8977bcb3e0ad099d652e63db1c5a1bda02120a16dc5",
)
.unwrap();
let identity = Identity { let identity = Identity {
pubkey: KeyData::Ecdsa( pubkey: KeyData::Ecdsa(
ssh_key::public::EcdsaPublicKey::from_sec1_bytes(&public_key_point).unwrap(), ssh_key::public::EcdsaPublicKey::from_sec1_bytes(&public_key_point).unwrap(),
@@ -57,14 +60,32 @@ f17326c188b9d0cffeddd8ff935f24f2074bbef128ac5b04b9cac05de967df5dbfd065698dce3b8c
let algorithm = &request.pubkey.algorithm(); let algorithm = &request.pubkey.algorithm();
match algorithm { match algorithm {
Algorithm::Dsa => {}
Algorithm::Ecdsa { curve: _ } => {} Algorithm::Ecdsa { curve: _ } => {}
Algorithm::Ed25519 => {} Algorithm::Ed25519 => {}
Algorithm::Rsa { hash: _ } => {} Algorithm::Rsa { hash: _ } => {}
Algorithm::SkEcdsaSha2NistP256 => {} Algorithm::Dsa => {
Algorithm::SkEd25519 => {} debugging!("Algorithm::Dsa not supported");
Algorithm::Other(_) => {} return Err(AgentError::Failure);
&_ => {} }
Algorithm::SkEcdsaSha2NistP256 => {
debugging!("Algorithm::SkEcdsaSha2NistP256 not supported");
return Err(AgentError::Failure);
}
Algorithm::SkEd25519 => {
debugging!("Algorithm::SkEd25519 not supported");
return Err(AgentError::Failure);
}
Algorithm::Other(algorithm_name) => {
debugging!(
"Algorithm::Other not supported, name: {}",
algorithm_name.as_str()
);
return Err(AgentError::Failure);
}
&_ => {
debugging!("Algorithm::Unknown not supported");
return Err(AgentError::Failure);
}
} }
let signature = external_command_rs::external_sign( let signature = external_command_rs::external_sign(