libp2p.security.secio package
Subpackages
Submodules
libp2p.security.secio.exceptions module
- exception libp2p.security.secio.exceptions.IncompatibleChoices
Bases:
SecioException
- exception libp2p.security.secio.exceptions.InconsistentNonce
Bases:
SecioException
- exception libp2p.security.secio.exceptions.InvalidSignatureOnExchange
Bases:
SecioException
- exception libp2p.security.secio.exceptions.PeerMismatchException
Bases:
SecioException
- exception libp2p.security.secio.exceptions.SecioException
Bases:
HandshakeFailure
- exception libp2p.security.secio.exceptions.SedesException
Bases:
SecioException
- exception libp2p.security.secio.exceptions.SelfEncryption
Bases:
SecioException
Raised to indicate that a host is attempting to encrypt communications with itself.
libp2p.security.secio.transport module
- class libp2p.security.secio.transport.Proposal(nonce: bytes, public_key: PublicKey, exchanges: str = 'P-256', ciphers: str = 'AES-128', hashes: str = 'SHA256')
Bases:
object
Represents the set of session parameters one peer in a pair of peers attempting to negotiate a secio channel prefers.
- class libp2p.security.secio.transport.SecioMsgReadWriter(local_encryption_parameters: EncryptionParameters, remote_encryption_parameters: EncryptionParameters, read_writer: SecioPacketReadWriter)
Bases:
EncryptedMsgReadWriter
- read_writer: SecioPacketReadWriter
- class libp2p.security.secio.transport.SecioPacketReadWriter(read_write_closer: ReadWriteCloser)
Bases:
FixedSizeLenMsgReadWriter
- class libp2p.security.secio.transport.SessionParameters
Bases:
object
- local_encryption_parameters: EncryptionParameters
- remote_encryption_parameters: EncryptionParameters
- class libp2p.security.secio.transport.Transport(local_key_pair: ~libp2p.crypto.keys.KeyPair, secure_bytes_provider: ~typing.Callable[[int], bytes] = <function default_secure_bytes_provider>)
Bases:
BaseSecureTransport
Provide a security upgrader for a
IRawConnection
, following the secio protocol defined in the libp2p specs.- async secure_inbound(conn: IRawConnection) ISecureConn
Secure the connection, either locally or by communicating with opposing node via conn, for an inbound connection (i.e. we are not the initiator)
- Returns:
secure connection object (that implements secure_conn_interface)
- async secure_outbound(conn: IRawConnection, peer_id: ID) ISecureConn
Secure the connection, either locally or by communicating with opposing node via conn, for an inbound connection (i.e. we are the initiator)
- Returns:
secure connection object (that implements secure_conn_interface)
- async libp2p.security.secio.transport.create_secure_session(local_nonce: bytes, local_peer: ID, local_private_key: PrivateKey, conn: IRawConnection, remote_peer: ID | None = None) ISecureConn
Attempt the initial secio handshake with the remote peer.
If successful, return an object that provides secure communication to the
remote_peer
. Raise SecioException when conn closed. Raise InconsistentNonce when handshake failed