summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix hashlib mypy types for Python 3.xSaif Hakim2021-03-243-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As captured in https://github.com/python/typeshed/pull/1663, the types for SHA-1 and SHA-2 family of functions are callables that return a Hash instance, whilst the SHA-3 family of functions are Hash `type`s (at least in Python 3.6). Mixing the two kinds of functions together in a dictionary confuses mypy's type inference as noted in #153, so we instead add an annotation as a hint. Also, update test_my.py to match the python version set by tox.ini in CI instead of always targeting Python 3.7 (as configured in setup.cfg) to validate the types in all supported Python 3.x versions. This fix also avoids the issue with the older mypy releases for Python 3.6 / Python 3.7 found in distro repos... ... for Ubuntu: ``` docker run \ -v $(pwd):/tmp/rsa \ -w /tmp/rsa ubuntu:18.04 \ /bin/bash -c 'apt-get update -qqy \ && apt-get install -qqy python3-pyasn1 python3-setuptools python3-mypy \ && python3 setup.py test' ``` ... and for Fedora: ``` docker run \ -v $(pwd):/tmp/rsa \ -w /tmp/rsa docker.io/fedora \ /bin/bash -c 'dnf -y install wget python3-devel python3-pyasn1 python3-setuptools python3-mypy \ && python3 setup.py test' ``` Fixes #153
* Fix typo in CHANGELOG.mdSybren A. Stüvel2021-02-241-2/+3
|
* Add py.typed marker file for PEP 561 complianceAndrey Semakin2021-02-242-0/+4
|
* Clean up stdout when using unittest test runnerSaif Hakim2021-02-244-9/+9
| | | | | | | | While pytest is the preferred test runner via tox, it looks like some folks are still running tests via `python3 setup.py test` which uses unittest and does not have good support for capturing stdout. To make using unittest slightly more friendly, we further swallow stdout / stderr for cli tests, and ensure print statements start on a newline.
* Update usage.rstRichard Vodden2021-02-241-2/+2
|
* Correct return value of verify()Richard Vodden2021-02-241-2/+3
|
* Document chaining of exceptions in changelogSybren A. Stüvel2021-02-241-0/+2
| | | | Ref: 1a5b2d166fc95e5f3f07fdfec075acdf4d0eda921
* Fix exception causes all over the codebaseRam Rachum2021-02-243-9/+9
| | | | | | | | | | | | | | | | | | | | | | The mistake is this: In some parts of the code, an exception is being caught and replaced with a more user-friendly error. In these cases the syntax `raise new_error from old_error` needs to be used. Python's exception chaining means it shows not only the traceback of the current exception, but that of the original exception (and possibly more.) This is regardless of `raise from`. The usage of `raise from` tells Python to put a more accurate message between the tracebacks. Instead of this: During handling of the above exception, another exception occurred: You'll get this: The above exception was the direct cause of the following exception: The first is inaccurate, because it signifies a bug in the exception-handling code itself, which is a separate situation than wrapping an exception.
* Add switch to Poetry to CHANGELOG.mdSybren A. Stüvel2021-02-241-0/+4
|
* Document how to use PoetrySybren A. Stüvel2021-02-241-1/+14
| | | | | Document how to use Poetry for setting up a dev environment and for building & publishing a new release.
* .travis.yml: use Poetry instead of Pipenvtemp-poetrySybren A. Stüvel2021-02-241-4/+4
|
* .travis.yml: Remove Python 3.5Sybren A. Stüvel2021-02-241-10/+0
|
* Update `update_version.sh` to use PoetrySybren A. Stüvel2021-02-241-2/+2
|
* Manage dependencies with Poetry instead of PipenvSybren A. Stüvel2021-02-246-621/+1016
| | | | | Poetry is nicer to work with than Pipenv + setup.py. This drops Python 3.5 support; that's ok, since that version is EOL.
* Bumped version to 4.8-dev0Sybren A. Stüvel2021-02-242-2/+2
|
* README: change header styleSybren A. Stüvel2021-02-241-4/+3
| | | | | Change header style from RestructuredText style (dashes under header) to MarkDown style (pound signs in front of header).
* README: remove older changesSybren A. Stüvel2021-02-241-23/+0
| | | | The CHANGELOG.md can still be used to find what happened in which release.
* Bumped version to 4.7.2version-4.7.2Sybren A. Stüvel2021-02-243-4/+4
|
* Add pickling fix to CHANGELOGSybren A. Stüvel2021-02-241-0/+5
|
* Fix #173: unpickling doesn't restore full objectBu Sun Kim2021-02-242-0/+7
| | | | | When a `PrivateKey` or `PublicKey` is unpickled `AbstractKey.__init__()` should be called so `self.mutex` and `self.blindfac` are created.
* Mark version 4.7.1 as releasedversion-4.7.1Sybren A. Stüvel2021-02-151-1/+1
|
* Bumped version to 4.7.1Sybren A. Stüvel2021-02-152-3/+3
|
* Fix threading issue introduced in 4.7Sybren A. Stüvel2021-02-153-38/+55
| | | | | | | | | Computing the blinding factor and its inverse was done in a thread-unsafe manner. Locking the computation & update of the blinding factors, and passing these around in frame- and stack-bound data, solves this. This fixes part of the issues reported in sybrenstuvel/python-rsa#173, but there is more going on in that particular report.
* Fix link formatting in CHANGELOGmasterMax Smolens2021-02-141-1/+1
|
* Bumped version to 4.7.1-dev0Sybren A. Stüvel2021-02-142-3/+3
|
* Bumped version to 4.7version-4.7Sybren A. Stüvel2021-01-102-3/+3
|
* Marked version 4.7 as releasedSybren A. Stüvel2021-01-101-1/+1
|
* Fix #170: mistake in examples of documentationSybren A. Stüvel2021-01-101-4/+4
| | | | | Strings need to be encoded into bytes before the RSA module can operate on them.
* Declare support for and test Python 3.9Hugo van Kemenade2021-01-104-1/+4
|
* Fix #162: Blinding uses slow algorithmSybren A. Stüvel2020-11-153-24/+47
| | | | | | | | | Store blinding factor + its inverse, so that they can be reused & updated on every blinding operation. This avoids expensive computations. The reuse of the previous blinding factor is done via squaring (mod n), as per section 9 of 'A Timing Attack against RSA with the Chinese Remainder Theorem' by Werner Schindler, https://tls.mbed.org/public/WSchindler-RSA_Timing_Attack.pdf
* Directly raise `DecryptionError` when crypto length is badSybren A. Stüvel2020-11-151-2/+4
| | | | | Crypto length and blocksize are public info, so don't need side-channel free comparison.
* Use `bytes.find()` instead of `bytes.index()`Sybren A. Stüvel2020-11-151-4/+2
| | | | | Use `bytes.find()` instead of `bytes.index()`, as the former doesn't raise an exception when the to-be-found byte doesn't exist.
* Add link to changelogSybren A. Stüvel2020-11-151-2/+3
|
* Fix #164: Add padding length check as described by PKCS#1 v1.5Sybren A. Stüvel2020-11-153-1/+41
| | | | | According to PKCS#1 v1.5, the padding should be at least 8 bytes long. See https://tools.ietf.org/html/rfc8017#section-7.2.2 step 3 for more info.
* Fix #165: CVE-2020-25658 - Bleichenbacher-style timing oracleSybren A. Stüvel2020-11-152-4/+13
| | | | | | | | | | | | | Use as many constant-time comparisons as practical in the `rsa.pkcs1.decrypt` function. `cleartext.index(b'\x00', 2)` will still be non-constant-time. The alternative would be to iterate over all the data byte by byte in Python, which is several orders of magnitude slower. Given that a perfect constant-time implementation is very hard or even impossible to do in Python [1], I chose the more performant option here. [1]: https://securitypitfalls.wordpress.com/2018/08/03/constant-time-compare-in-python/
* Add URL with more info to timing security issuesSybren A. Stüvel2020-10-261-1/+1
|
* Added security note to README.mdSybren A. Stüvel2020-10-261-0/+6
|
* Adds mention of 4.5 version in the headers.tvalentyn2020-06-161-1/+1
|
* Don't build universal wheelsWyatt Anderson2020-06-151-3/+0
|
* Fix exception cause in common.pyRam Rachum2020-06-141-2/+2
|
* Bumped version to 4.7-dev0Sybren A. Stüvel2020-06-122-2/+2
|
* Updated documentation to use Pipenv instead of PoetrySybren A. Stüvel2020-06-121-3/+3
| | | | See commit d15a7f3 for the reason why.
* Retagged 4.4 as 4.6 and added bit of an explanation to CHANGELOG.mdversion-4.6Sybren A. Stüvel2020-06-123-14/+13
|
* Update CHANGELOG.mdSybren A. Stüvel2020-06-121-0/+6
|
* Bumped version to 4.4.1version-4.4.1Sybren A. Stüvel2020-06-122-2/+2
|
* Explicitly declare Python 3.8 as supportedSybren A. Stüvel2020-06-121-0/+2
|
* Bumped version to 4.4version-4.4Sybren A. Stüvel2020-06-122-3/+3
|
* Updated CHANGELOGSybren A. Stüvel2020-06-121-1/+24
| | | | | Note that version 4.3 will not appear on the master branch, but is available in the version-4.3-py27compatible branch only.
* Bumped version to 4.2version-4.2Sybren A. Stüvel2020-06-112-3/+3
|
* Limit SHA3 support to Python 3.6+Sybren A. Stüvel2020-06-115-41/+27
| | | | | | | The third-party library that adds support for this to Python 3.5 is a binary package, and thus breaks the pure-Python nature of Python-RSA. This should fix [#147](https://github.com/sybrenstuvel/python-rsa/issues/147).