| |
- asyncio.protocols.Protocol(asyncio.protocols.BaseProtocol)
-
- MessageExchanger
- builtins.object
-
- SecureObject
class MessageExchanger(asyncio.protocols.Protocol) |
|
MessageExchanger(rt, peer_pid=None)
Send and receive messages.
Bidirectional connection with one of the other parties (peers). |
|
- Method resolution order:
- MessageExchanger
- asyncio.protocols.Protocol
- asyncio.protocols.BaseProtocol
- builtins.object
Methods defined here:
- __init__(self, rt, peer_pid=None)
- Initialize protocol for runtime rt between this party and a peer.
The connection between the two parties will be set up with one party
listening (as server) for the other party to connect (as client).
If peer_pid=None, party rt.pid starts as server and the peer starts as
client, and the other way around otherwise. Once the connection is made,
the client will immediately send its pid to the server.
- close_connection(self)
- Close connection with the peer.
- connection_lost(self, exc)
- Called when the connection with the peer is lost or closed.
If the connection is closed normally (during shutdown) then exc is None.
Otherwise, if the connection is lost unexpectedly, exc may indicate the cause.
- connection_made(self, transport)
- Called when a connection is made.
If this party is a client for this connection, it sends its identity
to the peer as well as any PRSS keys.
- data_received(self, data)
- Called when data is received from the peer.
Received bytes are unpacked as a program counter and the payload
(actual data). The payload is passed to the appropriate Future, if any.
First message from peer is processed differently if peer is a client.
- receive(self, pc)
- Receive payload labeled with given pc from the peer.
- send(self, pc, payload)
- Send payload labeled with pc to the peer.
Message format consists of three parts:
1. pc (8 bytes signed int)
2. payload_size (4 bytes unsigned int)
3. payload (byte string of length payload_size).
Data descriptors defined here:
- buffers
- bytes
- nbytes_sent
- peer_pid
- runtime
- transport
Methods inherited from asyncio.protocols.Protocol:
- eof_received(self)
- Called when the other end calls write_eof() or equivalent.
If this returns a false value (including None), the transport
will close itself. If it returns a true value, closing the
transport is up to the protocol.
Methods inherited from asyncio.protocols.BaseProtocol:
- pause_writing(self)
- Called when the transport's buffer goes over the high-water mark.
Pause and resume calls are paired -- pause_writing() is called
once when the buffer goes strictly over the high-water mark
(even if subsequent writes increases the buffer size even
more), and eventually resume_writing() is called once when the
buffer size reaches the low-water mark.
Note that if the buffer size equals the high-water mark,
pause_writing() is not called -- it must go strictly over.
Conversely, resume_writing() is called when the buffer size is
equal or lower than the low-water mark. These end conditions
are important to ensure that things go as expected when either
mark is zero.
NOTE: This is the only Protocol callback that is not called
through EventLoop.call_soon() -- if it were, it would have no
effect when it's most needed (when the app keeps writing
without yielding until pause_writing() is called).
- resume_writing(self)
- Called when the transport's buffer drains below the low-water mark.
See pause_writing() for details.
|
class SecureObject(builtins.object) |
|
SecureObject(value=None)
A secret-shared object.
An MPC protocol operates on secret-shared objects of type SecureObject.
The basic Python operators are overloaded by SecureObject classes.
An expression like a * b will create a new SecureObject, which will
eventually contain the product of a and b. The product is computed
asynchronously, using an instance of a specific cryptographic protocol. |
|
Methods defined here:
- __bool__(self)
- Use of secret-shared objects in Boolean expressions makes no sense.
- __deepcopy__(self, memo)
- Let SecureObjects behave as immutable objects.
Introduced for github.com/meilof/oblif.
- __init__(self, value=None)
- Initialize share.
If value is None (default), the SecureObject starts out as an empty
placeholder (implemented as a Future).
- set_share(self, value)
- Set share to the given value.
The share is set directly (or recursively, for a composite SecureObject),
using callbacks if value contains Futures that are not yet done.
Data descriptors defined here:
- share
| |