1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
//! The messages of the PET protocol. //! //! The [`Message`]s adhere to the common [`Header`] and [`Payload`] scheme. They are parsed via //! [`MessageBuffer`]s which provide a checked access to the raw message, whereas the serialization //! and deserialization is implemented via the [`ToBytes`] and [`FromBytes`] traits. //! //! All messages are signed and encrypted in an authenticated encryption scheme via [`MessageSeal`] //! and [`MessageOpen`], which employ the wrappers of the [crypto module]. //! //! # The sum message //! The [`Sum`] message is an abstraction for the values which a sum participant communicates to //! XayNet during the sum phase of the PET protocol. It contains the following values: //! - The sum signature proves the eligibility of the participant for the sum task. //! - The ephemeral public key is used by update participants to encrypt mask seeds in the update //! phase for the process of mask aggregation in the sum2 phase. //! //! # The update message //! The [`Update`] message is an abstraction for the values which an update participant communicates //! to XayNet during the update phase of the PET protocol. It contains the following values: //! - The sum signature proves the ineligibility of the participant for the sum task. //! - The update signature proves the eligibility of the participant for the update task. //! - The masked model is the encrypted local update to the global model, which is trained on the //! local data of the update participant. //! - The local seed dictionary stores the encrypted mask seed, which generates the local mask for //! the local model, which is encrypted by the ephemeral public keys of the sum participants. //! //! # The sum2 message //! The [`Sum2`] message is an abstraction for the values which a sum participant communicates to //! XayNet during the sum2 phase of the PET protocol. It contains the following values: //! - The sum signature proves the eligibility of the participant for the sum task. //! - The global mask is used by XayNet to unmask the aggregated global model. //! //! [crypto module]: ../crypto/index.html pub(crate) mod buffer; pub(crate) mod header; #[allow(clippy::module_inception)] pub(crate) mod message; pub(crate) mod payload; pub(crate) mod traits; pub(crate) mod utils; pub use self::{ buffer::MessageBuffer, header::{Flags, Header, HeaderOwned, Tag}, message::{Message, MessageOpen, MessageOwned, MessageSeal}, payload::{ sum::{Sum, SumBuffer, SumOwned}, sum2::{Sum2, Sum2Buffer, Sum2Owned}, update::{Update, UpdateBuffer, UpdateOwned}, Payload, PayloadOwned, }, traits::{FromBytes, LengthValueBuffer, ToBytes}, }; /// An error that signals a failure when trying to decrypt and parse a message. /// /// This is kept generic on purpose to not reveal to the sender what specifically failed during /// decryption or parsing. pub type DecodeError = anyhow::Error;