Fixes
parent: tbd commit: 74f247e
1 | use ; |
2 | |
3 | use |
4 | , |
5 | , |
6 | , | Sha256
7 | , |
8 | RsaPrivateKey, RsaPublicKey, |
9 | ; |
10 | use ; |
11 | |
12 | use crate HandshakeMessage; |
13 | |
14 | use ; |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | Handshake, |
24 | Repository, |
25 | Authentication, |
26 | |
27 | |
28 | /// An authenticated message. |
29 | /// |
30 | /// Includes the message, with a digest generated with |
31 | /// our private key. |
32 | |
33 | |
34 | #[serde(flatten)] |
35 | message: T, |
36 | token: String, |
37 | digest: , |
38 | |
39 | |
40 | |
41 | |
42 | T: Clone + Serialize, |
43 | |
44 | |
45 | Self |
46 | message: self.message.clone, |
47 | token: self.token.clone, |
48 | digest: self.digest.clone, |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | T: Debug + Serialize, |
56 | |
57 | |
58 | f.debug_struct |
59 | .field |
60 | .field |
61 | .field |
62 | .finish |
63 | |
64 | |
65 | |
66 | |
67 | |
68 | let mut rng = thread_rng; |
69 | |
70 | let private_key = from_pkcs8_pem?; |
71 | let signing_key = new; |
72 | |
73 | let message_json = to_vec?; |
74 | |
75 | let signature = signing_key.sign_with_rng; |
76 | |
77 | Ok |
78 | message, |
79 | token, |
80 | digest: signature.to_vec, |
81 | |
82 | |
83 | |
84 | pub async |
85 | &self.message |
86 | |
87 | |
88 | pub async |
89 | let public_key = from_public_key_pem?; |
90 | |
91 | let verifying_key: = new; |
92 | |
93 | let message_json = to_vec?; |
94 | |
95 | verifying_key.verify?; |
96 | |
97 | Ok |
98 | |
99 | |
100 |