Commit Graph

79 Commits

Author SHA1 Message Date
gpotter2
f0761b888a Update scapy
scapy-python3 is an unofficial fork that is getting very oudated (many bug fixes missing).
Migrates to original and up-to-date scapy, which now supports both python 2 and 3
2018-06-04 11:29:40 +02:00
Piotr Lizończyk
0eab4f2cb1 Release 0.2.2 2018-03-21 12:25:13 +01:00
Piotr Lizończyk
b45aa5cd63 Merge pull request #21 from warner/unpin-cryptography
setup.py: relax the pin on 'cryptography'
2018-03-21 11:54:18 +01:00
Brian Warner
413e1f518b setup.py: relax the pin on 'cryptography'
refs #20
2018-03-16 08:37:07 -07:00
Piotr Lizończyk
79165cfc85 Merge pull request #19 from warner/fix-py35
fix python_requires= to allow installation under py3.5
2018-03-16 16:01:58 +01:00
Brian Warner
90f120f508 fix python_requires= to allow installation under py3.5
According to PEP440, a comma in a version specifier behaves as a logical AND,
so the previous "~=3.5,~=3.6" is equivalent to just "~=3.6", which excludes
python3.5.

This patch replaces it with "~=3.5", which is equivalent to ">=3.5, ==3.*",
so it includes 3.5, 3.6, 3.7, and beyond (but not 4.0).
2018-03-15 12:28:15 -07:00
Piotr Lizończyk
9286b18a05 Update README.md 2018-01-14 14:30:32 +01:00
Piotr Lizończyk
4b2ceb8313 Merge pull request #17 from plizonczyk/dependabot/pip/cryptography-2.1.4
Bump cryptography from 2.1.3 to 2.1.4
2018-01-14 14:28:08 +01:00
dependabot[bot]
0fc6fa0bd9 chore(dependencies): Bump cryptography from 2.1.3 to 2.1.4
Bumps [cryptography](https://github.com/pyca/cryptography) from 2.1.3 to 2.1.4.
- [Changelog](https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/2.1.3...2.1.4)
2017-11-30 07:05:45 +00:00
Piotr Lizończyk
dba4840489 Merge pull request #16 from plizonczyk/trunk
Release 0.2.1
2017-11-04 02:23:56 +01:00
Piotr Lizonczyk
d560ad7ca8 Release 0.2.1
Bumping Cryptography to 2.1.3 - OpenSSL security issue
2017-11-04 02:17:15 +01:00
Piotr Lizończyk
4e0fe3992c Merge pull request #15 from plizonczyk/windows
Support for Windows and OS X
2017-11-04 01:54:36 +01:00
Piotr Lizończyk
fa29011030 Update .travis.yml
OS X workaround
2017-11-04 00:51:38 +01:00
Piotr Lizończyk
25cc97aa24 Update README.md 2017-11-04 00:05:58 +01:00
Piotr Lizończyk
88eb72f5c3 Update .travis.yml 2017-11-04 00:04:35 +01:00
Piotr Lizonczyk
08d0859a79 Enable OS X build. Fix Windows build.
Update README and trove classifiers in setup.py
2017-11-03 23:37:02 +01:00
Piotr Lizonczyk
4be0891658 Trying out appveyor Windows builds 2017-11-03 23:19:29 +01:00
Piotr Lizonczyk
5a9f814a81 Adding some dev requirements 2017-11-01 11:35:40 +01:00
Piotr Lizończyk
bf658e6c4b Merge pull request #13 from plizonczyk/trunk
0.2.0 pre-release commit
2017-11-01 11:28:04 +01:00
Piotr Lizonczyk
7366c45e72 0.2.0 pre-release commit
Renamed NoiseBuilder to NoiseConnection
Bumped Cryptography from 2.1.1 to 2.1.2
Ready to release

Closes #5
2017-11-01 11:17:07 +01:00
Piotr Lizończyk
82776dac65 Merge pull request #12 from plizonczyk/trunk
Trunk to master - towards 0.2.0 release
2017-10-30 23:37:46 +01:00
Piotr Lizonczyk
2aa9166f9d Improved README with responder example.
Closes #11
2017-10-30 21:38:55 +01:00
Piotr Lizonczyk
f5e892fc96 Update documentation generation
Added information about documentation in README

Closes #8
2017-10-14 18:07:40 +02:00
Piotr Lizonczyk
59c11248ff Ensure compatibility with revision 33
* Allowed '/' in protocol name
* Added SymmetricState.GetHandshakeHash()
* Added CipherState.SetNonce()
* Unittests to ensure that each of above is working

Closes #3
2017-10-14 17:47:58 +02:00
Piotr Lizonczyk
2bac81d05c Do not reinitialise cipher class every time
Now CipherState holds instance of Cipher wrapper and manages
initialization of underlying cipher method with keys.

Closes #6
2017-10-14 17:06:51 +02:00
Piotr Lizonczyk
d636c506d3 Changelog and setup.py update 2017-10-11 19:00:35 +02:00
Piotr Lizończyk
3bfb39883e Cryptography version update (#10)
* 2.1 version of pyca/cryptography got released. Version bumped
* Python 3.5 support reintroduced, as we are now using BLAKE from
Cryptography, not hashlib
* Removed hashlib references, uncommented Cryptography references.
* Enum fix for python 3.5 compat

Closes #9
2017-10-11 18:58:07 +02:00
Piotr Lizonczyk
81a2f7e845 Use Read the Docs theme
+ clean up some default unnecessary options from sphinx conf.py

Refs #8
2017-10-08 01:50:20 +02:00
Piotr Lizonczyk
ae894c6be9 Docs generation setup
First shot at documentation. Just to check if they work with
ReadTheDocs.

Also, added dev_requirements.txt with packages required for development
of package.

Refs #8
2017-10-08 01:35:41 +02:00
Piotr Lizonczyk
7e51c3a6f7 Switched from lists to tuples for const data type
Closes #2
2017-10-08 00:54:54 +02:00
Piotr Lizonczyk
d4c4d2e1bd Using pow(x, y, modp) where applicable
Additionally minor reformatting.

Closes #1
2017-10-08 00:36:18 +02:00
Piotr Lizonczyk
ed4a452cc5 Improvements in NoiseBuilder
Added check for handshake_finished == True in encrypt/decrypt.
2017-09-12 23:21:27 +02:00
Piotr Lizonczyk
09392fda82 Add pypi badge 2017-09-12 22:42:34 +02:00
Piotr Lizonczyk
35dcd1c83b Add travis build status badge 2017-09-12 22:25:44 +02:00
Piotr Lizonczyk
b5e9542fb1 Update setup.py for PyPI. Version bump 2017-09-12 22:09:47 +02:00
Piotr Lizonczyk
3a8439894a Prepare for public release
- Added readme
- Updated setup.py
- Removed pytest from requirements, added version of cryptography
package
- Small improvements in code:

noise/noise_protocol.py:
* removed unused one_way variable

noise/patterns.py
* fixed has_pre_messages - no longer a variable, but method - and now
works properly

noise/state.py
* SymmetricState now holds reference to CipherState.
2017-09-12 21:59:47 +02:00
Piotr Lizończyk
fd8de56f8f Create LICENSE 2017-09-12 21:07:14 +02:00
Piotr Lizonczyk
2fa2f03d90 Various small fixes and cleanups
tests/vectors/*:
- removed noise-c-basic.txt test vectors

tests/test_vectors.py:
- removed workarounds related to noise-c test vectors

noise/builder.py:
- added some more type hinting

noise/state.py:
- CipherState is now consistent in raising NoiseMaxNonceError
and using MAX_NONCE constant for encrypt and decrypt methods

noise/functions.py:
- Keypair constructors now guarded from invalid length of given
public/private bytes
- _25519_generate_keypair now returns proper class instance

requirements.txt:
- specified versions of packages that are compatible with currently used source code
2017-09-12 00:49:24 +02:00
Piotr Lizonczyk
a60def7614 Added snow-multipsk test-vectors 2017-09-11 01:00:03 +02:00
Piotr Lizonczyk
ac7e3506a9 Turning off 3.7-dev testing
Cryptography ships with OpenSSL 1.0.2g when it's installed against
python3.7. Old OpenSSL is largely incompatible with this package.
Testing (and any required development for ensuring compatibility) will
be turned on again when Cryptography wheel for python3.7 will ship with
new OpenSSL
2017-09-03 22:52:28 +02:00
Piotr Lizończyk
48ab143bd9 Test against 3.7-dev - first alpha release is here 2017-09-03 21:56:59 +02:00
Piotr Lizonczyk
d0899c6871 Removing old echo example 2017-09-03 19:42:14 +02:00
Piotr Lizonczyk
57a64fc05e Fixing little bug with warnings 2017-09-03 19:40:09 +02:00
Piotr Lizonczyk
368d401701 Improved validation, various additions
noise/builder.py:
- Added guard for data length in decrypt
- Handling InvalidTag exception when AEAD fails
- New NoiseInvalidMessage exception class

noise/exceptions.py
- Three new exception classes

noise/noise_protocol.py
- Implemented rest of validation, now checks for required keypairs, setting initiator/responder role, warns if ephemeral keypairs are set.

noise/patterns.py:
- added name field to every Pattern with pattern name
- added get_required_keypairs method that returns list of keypairs required for given handshake pattern

noise/state.py
- new NoiseMaxNonceError exception

Overall: some TODOs resolved
2017-09-03 13:33:15 +02:00
Piotr Lizonczyk
eaecac6af4 Wireguard interoperability test script
This commit introduces an example of interoperability of this library
with Wireguard. The script is responsible for performing a Noise
handshake between localhost and Wireguard test server. Then, ICMP echo
request is sent and ICMP echo reply is retrieved. Lastly, Wireguard
keepalive packet is sent.

Example utilises Noise messages wrapped in Wireguard's packet
format.
2017-09-03 01:03:41 +02:00
Piotr Lizonczyk
8a5ff74cac Moved ed448 warning inside functions.py 2017-09-03 01:02:59 +02:00
Piotr Lizonczyk
865bbfe5ba Implemented cipher rekeying
noise/builder.py
- Added methods for rekeying cipherstates
- Added method for getting handshake hash (for channel binding)

noise/functions.py
- Added default rekey behavior and set it for AESGCM and ChaCha20

noise/constants.py
- Added MAX_NONCE

noise/state.py
- Added rekey method to CipherState
- Removed writing to noise_protocol instance in SymmetricState.
NoiseProtocol fills the appropriate field by taking the data from
HandshakeState now.
2017-09-02 17:38:02 +02:00
Piotr Lizończyk
46825bb075 Added NoiseBuilder class as final interface. (#1)
noise/__init__.py
- __all__ containing builder module

noise/builder.py
- NoiseBuilder class providing interface for use with other apps. Allows
for setting up all required data for Noise protocol, using appropriate
methods. Enforces proper path of handshake execution

noise/constants.py
- Added maximum Noise message length constant

noise/exceptions.py
- A few exceptions created for proper signaling of errors

noise/noise_protocol.py
- handshake_done does proper cleanup now
- new validation method that should be ran before starting handshake
(checks presence of prerequisites for current settings)
- new HandshakeState initialization method

noise/state.py
- Modified read_message and write_message methods of HandshakeState to
operate on bytes/bytearray as message/payload and bytearray as
message_buffer/payload_buffer. It is application's responsibility to
provide data in this form, underlying Noise code doesn't do buffer
reading/writing anymore.

tests/test_vectors.py
- Changed tests to comply with new code
2017-09-02 16:09:49 +02:00
Piotr Lizonczyk
96f7ba9b6b Added own insecure implementation of ed448 2017-08-27 17:03:50 +02:00
Piotr Lizonczyk
52fd5058bc Enabling PSK support. Core functionality ready!
noise/noise_protocol.py
* PSKs should be now delivered to NoiseProtocol while initialising
* New field `is_psk_handshake` in NoiseProtocol

noise/patterns.py
* Fixed erronenous super call in OneWayPattern
* Changed class variables to instance variables in Patterns, fixes
things.

noise/state.py
* Added missing mix_key_and_hash to SymmetricState
* Added required calls when in PSK handshake (TOKEN_E and TOKEN_PSK),
both in write_message and read_message of HandshakeState

tests/test_vectors.py
* Enabled PSK tests, some minor fixes to make them work
2017-08-19 01:27:59 +02:00