Commit Graph

797 Commits

Author SHA1 Message Date
af2e50aaf4 Add facility for authenticated encryption 2019-08-24 22:37:45 +02:00
228c17ae9e Add ECDH key exchange utility 2019-08-24 22:37:44 +02:00
fb13dfa7b3 Add sign and verify operations for secp256k1 keys 2019-08-24 22:37:44 +02:00
3c97a5a0ed Add ECC key implementation 2019-08-24 22:37:44 +02:00
91e11f3ec0 [wip] more secio implementation 2019-08-24 22:37:44 +02:00
0cc3fc24a7 Add source for some secure bytes, e.g. to provide a nonce 2019-08-24 22:37:44 +02:00
b59c5d6ca1 Add "msgio" functions 2019-08-24 22:37:44 +02:00
26165b0729 [wip] sketch of secio handshake 2019-08-24 22:37:44 +02:00
fd08bcf624 Add secio protobufs 2019-08-24 22:37:43 +02:00
23f53ef954 Allow optional peer ID in a security session 2019-08-24 22:37:43 +02:00
27c0a4f77b formatting 2019-08-24 22:37:43 +02:00
3e07faf343 Merge pull request #266 from ralexstokes/remove-unrelated-cde
Remove test suite for `asyncio`, *not* `py-libp2p`
2019-08-24 22:22:06 +02:00
d764ca2884 Merge pull request #265 from ralexstokes/add-wait-closed
Add call to `wait_closed` method of asyncio.StreamWriter
2019-08-24 22:17:29 +02:00
7ccdeaf308 Remove test suite for asyncio, *not* py-libp2p 2019-08-24 22:10:47 +02:00
5b32bfdd3f Add call to wait_closed method of asyncio.StreamWriter 2019-08-24 22:06:24 +02:00
d9883ee4f0 Merge pull request #263 from ralexstokes/remove-stream-from-connection
Encapsulate the concept of a stream to the stream multiplexer
2019-08-24 21:58:59 +02:00
9c5fb4fa5a Encapsulate concept of a "stream id" to a "muxed" connection 2019-08-24 21:50:07 +02:00
e29c1507bf remove unused fields 2019-08-24 21:50:06 +02:00
9a74797068 Merge pull request #264 from ralexstokes/remove-simple-security
Removes the SimpleSecurityTransport
2019-08-24 21:49:29 +02:00
73495038e1 remove simple security 2019-08-24 21:39:25 +02:00
1790e48c99 Remove deprecated file 2019-08-24 21:36:30 +02:00
da3c8be464 Merge pull request #253 from mhchia/feature/plaintext-2.0.0
Add `/plaintext/2.0.0` secure channel
2019-08-22 23:40:02 +08:00
b516579256 Remove the unnecessary RSAPrivateKey.from_bytes 2019-08-22 22:54:14 +08:00
c1eacf221f PR feedback
- Check if the received peer id matches the one we initialize the
session with.
- Move the check inside `run_handshake`
2019-08-22 22:53:49 +08:00
7c630df610 Update libp2p/security/insecure/transport.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-08-22 22:53:49 +08:00
16a4fd33c1 PR feedbacks
- Move exceptions to exceptions.py
- Raise `UpgradeFailure` in upgrader
- Refine the try/catch for upgraders in swarm
2019-08-22 22:53:49 +08:00
3e04480d62 Raise HandshakeFailure in transport
Change the exception handling flow.
Raise `SecurityUpgradeFailure` in security_multistream.
2019-08-22 22:53:48 +08:00
80452d9589 Fix make_exchange_message to use the new API 2019-08-22 22:53:48 +08:00
921bfb65cc 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`
2019-08-22 22:53:48 +08:00
ef476e555b Use RawConnection.read
Instead of accessing its reader and writer directly.

TODO: considering add `ReaderWriterCloser` interface and let connection
and stream inherit from it.
2019-08-22 22:53:48 +08:00
0b466ddc86 Add lock to RawConnection
To avoid `self.writer.drain()` is called in parallel.
Reference: https://bugs.python.org/issue29930
2019-08-22 22:53:47 +08:00
5768daa9bf PR feedbacks
- Nits
- Add `SecurityUpgradeFailure` and handle `UpgradeFailure` in Swarm.
2019-08-22 22:53:47 +08:00
2a1367b011 Apply suggestions from code review
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-08-22 22:53:47 +08:00
0b62321265 Fix test_security_multistream
By passing initiator keypairs to node.
2019-08-22 22:53:47 +08:00
de8d356955 Fix tests failure due to lack of peer id
Fix it through doing plaintext handshake.
2019-08-22 22:53:47 +08:00
bb7d37fd4f Fix msg encoding
- Change varint-prefix encode to fixedint-prefix(4 bytes) encode.
2019-08-22 22:53:46 +08:00
22b1a5395d A working plaintext 2.0 without validation 2019-08-22 22:53:46 +08:00
a0923d202a Move varint and delim read/write to toplevel
To `libp2p.utils`.
2019-08-22 22:53:46 +08:00
5192944724 Update pb 2019-08-22 22:53:46 +08:00
59b373b48a Add plaintext.proto
Update Makefile to handle the import in `plaintext.proto`.
Import path is modified to be relative to the project root.
And we run `protoc` from where `Makefile` locates, i.e. the project
root.

Reference:
- plaintext.proto: 62b2c6c482/sec/insecure/pb/plaintext.proto
2019-08-22 22:53:46 +08:00
7bc363f2fa Remove initiator in Mplex
Besides, fix the wrong passed `multi_addr` to `mplex_stream`.
2019-08-22 22:53:45 +08:00
8217319c28 Merge pull request #258 from NIC619/adjust_coincurve_version_to_match_trinity
Adjust coincurve version to match Trinity's
2019-08-22 22:19:25 +08:00
87f5a86950 Adjust coincurve version 2019-08-22 18:01:41 +08:00
46b4a446c3 Merge pull request #257 from mhchia/fix/add-missing-initpy
Fix the issue when importing from other package
2019-08-22 16:32:34 +08:00
2752e7a04b Ignore mypy error here 2019-08-22 15:58:38 +08:00
dbd4ed44dd Fix the issue when importing from other package 2019-08-22 15:36:17 +08:00
6b05d9ab8f Merge pull request #252 from mhchia/fix/add-negotiation-when-upgrading-to-mplex
Negotiate multiplexer protocol when upgrading to `MuxedConn`
2019-08-21 12:30:22 +08:00
550c23f9f9 PR feedback
- Use the order in `MuxerMultistream` as the precedence in multiselect
2019-08-21 11:43:25 +08:00
8596f7390f PR feedback: set protocol_id to constants 2019-08-21 11:43:24 +08:00
d7d8440b2c PR feedback: nitpicks 2019-08-21 11:43:24 +08:00