-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from baloo/baloo/session-bind
Fixup extension serialization
- Loading branch information
Showing
5 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::recursive; | ||
use super::signature::Signature; | ||
|
||
/// SSH key | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct SshKey { | ||
pub alg: String, | ||
pub blob: Vec<u8>, | ||
} | ||
|
||
/// [email protected] extension | ||
/// | ||
/// This extension allows a ssh client to bind an agent connection to a | ||
/// particular SSH session. | ||
/// | ||
/// Spec: | ||
/// <https://github.com/openssh/openssh-portable/blob/cbbdf868bce431a59e2fa36ca244d5739429408d/PROTOCOL.agent#L6> | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct SessionBind { | ||
#[serde(with = "recursive")] | ||
pub host_key: SshKey, | ||
pub session_id: Vec<u8>, | ||
#[serde(with = "recursive")] | ||
pub signature: Signature, | ||
pub is_forwarding: bool, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
use super::extension::SessionBind; | ||
use super::message::{Extension, Identity, Message, SignRequest}; | ||
use super::private_key::*; | ||
use super::public_key::*; | ||
|
@@ -178,4 +179,9 @@ fn test_extension() { | |
assert_eq!(extension.extension_type, "[email protected]"); | ||
let out = to_bytes(&extension).unwrap(); | ||
assert_eq!(extension_bytes, out); | ||
|
||
let session_bind: SessionBind = from_bytes(&extension.extension_contents.0).unwrap(); | ||
|
||
let out = to_bytes(&session_bind).unwrap(); | ||
assert_eq!(extension.extension_contents.0, out); | ||
} |