Protocol#
- class Protocol#
A Protocol for Multi-Party operations between multiple parties.
- execute_next_round(self: pyhelayers.Protocol, output_messages: std::vector<helayers::ProtocolMessage, std::allocator<helayers::ProtocolMessage> >, input_messages: std::vector<helayers::ProtocolMessage, std::allocator<helayers::ProtocolMessage> >) bool #
Execute the next round of this protocol and generate output messages for the next round for all parties.
- Parameters:
output_messages (Vector of ProtocolMessage objects.) – The output messages of the round.
input_messages (Vector of ProtocolMessage objects.) – The input messages for the round.
- Returns:
A boolean value indicates whether the protocol received all the needed messages to execute the next round successfully.
- Return type:
bool.
- Raises:
RuntimeError – if the given input messages are not valid.
- get_current_round(self: pyhelayers.Protocol) int #
- Returns:
Returns the current round number.
- Return type:
int.
- get_protocol_type(self: pyhelayers.Protocol) pyhelayers.ProtocolType #
- Returns:
Returns the protocol type of this protocol.
- Return type:
ProtocolType.
- get_roles(self: pyhelayers.Protocol) std::set<helayers::MultiPartyRole, std::less<helayers::MultiPartyRole>, std::allocator<helayers::MultiPartyRole> > #
- Returns:
Returns the roles in the protocol of the current participant.
- Return type:
Set of integers.
- get_total_number_of_rounds(self: pyhelayers.Protocol) int #
- Returns:
Returns the total number of rounds in the protocol.
- Return type:
int.
- is_input_message_valid_for_current_round(self: pyhelayers.Protocol, input_message: helayers::ProtocolMessage) bool #
- Parameters:
input_message (ProtocolMessage.) – The input message to check.
- Returns:
Returns true if the given message is a valid input message for the current round (e.g., that the destination role of the message matches the role of the current participant).
- Return type:
bool.
- is_role(self: pyhelayers.Protocol, role: pyhelayers.MultiPartyRole) bool #
- Parameters:
role (MultiPartyRole.) – The role to check.
- Returns:
Return true if the current participant has the given role in the protocol.
- Return type:
bool.
- needs_another_round(self: pyhelayers.Protocol) bool #
- Returns:
Returns true iff this protocol needs another round.
- Return type:
bool.
- reset_protocol(self: pyhelayers.Protocol) None #
Reset the protocol prior to another use.
- set_verbosity(self: pyhelayers.Protocol, verbosity: pyhelayers.Verbosity) None #
Sets the verbosity level.
- Parameters:
verbosity (Verbosity.) – The verbosity level.
-
class Protocol : public helayers::Printable#
A Protocol for multi-party operations between multiple parties.
Subclassed by helayers::DecryptProtocol, helayers::InitProtocol
Public Functions
-
virtual ~Protocol() = default#
-
bool executeNextRound(std::vector<ProtocolMessage> &outputMessages, const std::vector<ProtocolMessage> &inputMessages)#
Execute the next round of this protocol and generate output messages for the next round for all parties.
- Parameters:
outputMessages – The output messages of the round.
inputMessages – The input messages for the round.
- Throws:
invalid_argument – if the given input messages are not valid.
- Returns:
bool indicates whether the protocol received all the needed messages to execute the next round successfully.
-
bool needsAnotherRound() const#
Returns true iff this protocol needs another round.
-
int32_t getCurrentRound() const#
Returns the current round number.
-
int32_t getTotalNumberOfRounds() const#
Returns the total number of rounds in the protocol.
-
std::set<MultiPartyRole> getRoles() const#
Returns the roles in the protocol of the current participant.
-
bool isRole(MultiPartyRole role) const#
Return true if the current participant has the given role in the protocol.
- Parameters:
role – The role to check.
-
bool isInputMessageValidForCurrentRound(const ProtocolMessage &inputMessage) const#
Returns true if the given message is a valid input message for the current round (e.g., that the destination role of the message matches the role of the current participant).
- Parameters:
inputMessage – The input message to check.
-
ProtocolType getProtocolType() const#
Returns the protocol type of this protocol.
-
virtual void resetProtocol()#
Reset the protocol prior to another use.
-
void setVerbosity(Verbosity verbosity)#
Sets the verbosity level.
- Parameters:
verbosity – The verbosity level.
-
virtual void debugPrint(const std::string &title = "", Verbosity verbosity = VERBOSITY_REGULAR, std::ostream &out = std::cout) const override#
Prints the content of this object.
- Parameters:
title – Text to add to the print
verbosity – Verbosity level
out – Output stream
-
virtual ~Protocol() = default#