1
1
//! Agent protocol message structures.
2
2
3
3
pub mod identity;
4
+ pub mod sign;
4
5
pub mod unparsed;
5
6
6
7
use core:: str:: FromStr ;
@@ -10,67 +11,14 @@ use ssh_key::{
10
11
certificate:: Certificate , private:: KeypairData , public:: KeyData , Algorithm , Error , Signature ,
11
12
} ;
12
13
13
- pub use self :: { identity:: * , unparsed:: * } ;
14
+ pub use self :: { identity:: * , sign :: * , unparsed:: * } ;
14
15
use super :: {
15
16
extension:: { KeyConstraintExtension , MessageExtension } ,
16
17
PrivateKeyData , ProtoError ,
17
18
} ;
18
19
19
20
type Result < T > = core:: result:: Result < T , ProtoError > ;
20
21
21
- /// Signature request with data to be signed with a key in an agent.
22
- ///
23
- /// This structure is sent in a [`Request::SignRequest`] (`SSH_AGENTC_SIGN_REQUEST`) message.
24
- ///
25
- /// Described in [draft-miller-ssh-agent-14 § 3.6](https://www.ietf.org/archive/id/draft-miller-ssh-agent-14.html#section-3.6)
26
- #[ derive( Clone , PartialEq , Debug ) ]
27
- pub struct SignRequest {
28
- /// The public key portion of the [`Identity`] in the agent to sign the data with
29
- pub pubkey : KeyData ,
30
-
31
- /// Binary data to be signed
32
- pub data : Vec < u8 > ,
33
-
34
- /// Signature flags, as described in
35
- /// [draft-miller-ssh-agent-14 § 3.6.1](https://www.ietf.org/archive/id/draft-miller-ssh-agent-14.html#section-3.6.1)
36
- pub flags : u32 ,
37
- }
38
-
39
- impl Decode for SignRequest {
40
- type Error = ProtoError ;
41
-
42
- fn decode ( reader : & mut impl Reader ) -> Result < Self > {
43
- let pubkey = reader. read_prefixed ( KeyData :: decode) ?;
44
- let data = Vec :: decode ( reader) ?;
45
- let flags = u32:: decode ( reader) ?;
46
-
47
- Ok ( Self {
48
- pubkey,
49
- data,
50
- flags,
51
- } )
52
- }
53
- }
54
-
55
- impl Encode for SignRequest {
56
- fn encoded_len ( & self ) -> ssh_encoding:: Result < usize > {
57
- [
58
- self . pubkey . encoded_len_prefixed ( ) ?,
59
- self . data . encoded_len ( ) ?,
60
- self . flags . encoded_len ( ) ?,
61
- ]
62
- . checked_sum ( )
63
- }
64
-
65
- fn encode ( & self , writer : & mut impl Writer ) -> ssh_encoding:: Result < ( ) > {
66
- self . pubkey . encode_prefixed ( writer) ?;
67
- self . data . encode ( writer) ?;
68
- self . flags . encode ( writer) ?;
69
-
70
- Ok ( ( ) )
71
- }
72
- }
73
-
74
22
/// A container for a public / private key pair, or a certificate / private key.
75
23
///
76
24
/// When adding an identity to an agent, a user can provide either:
0 commit comments