Verify the remote pubkey and peer_id

- Add `from_bytes` in RSAPublicKey and Secp256k1PublicKey
- Add `pubkey_from_protobuf` to parse pubkey from protobuf
- Verify key and peer_id in `InsecureSession.run_handshake`
This commit is contained in:
mhchia
2019-08-20 23:54:33 +08:00
parent ef476e555b
commit 921bfb65cc
5 changed files with 62 additions and 6 deletions

View File

@ -13,6 +13,12 @@ class BaseSession(ISecureConn):
is only meant to be used in clases that derive from it.
"""
local_peer: ID
local_private_key: PrivateKey
conn: IRawConnection
remote_peer_id: ID
remote_permanent_pubkey: PublicKey
def __init__(
self, transport: BaseSecureTransport, conn: IRawConnection, peer_id: ID
) -> None: