summaryrefslogtreecommitdiff
path: root/rsa
Commit message (Collapse)AuthorAgeFilesLines
* Fix #173: threading issue introduced in 4.7test-threading-fix-173Sybren A. Stüvel2021-02-141-30/+44
| | | | | | 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.
* Bumped version to 4.7.1-dev0Sybren A. Stüvel2021-02-141-2/+2
|
* Bumped version to 4.7version-4.7Sybren A. Stüvel2021-01-101-2/+2
|
* Fix #162: Blinding uses slow algorithmSybren A. Stüvel2020-11-151-20/+32
| | | | | | | | | 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.
* Fix #164: Add padding length check as described by PKCS#1 v1.5Sybren A. Stüvel2020-11-151-1/+6
| | | | | 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-151-4/+8
| | | | | | | | | | | | | 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/
* Fix exception cause in common.pyRam Rachum2020-06-141-2/+2
|
* Bumped version to 4.7-dev0Sybren A. Stüvel2020-06-121-1/+1
|
* Retagged 4.4 as 4.6 and added bit of an explanation to CHANGELOG.mdversion-4.6Sybren A. Stüvel2020-06-121-1/+1
|
* Bumped version to 4.4.1version-4.4.1Sybren A. Stüvel2020-06-121-1/+1
|
* Bumped version to 4.4version-4.4Sybren A. Stüvel2020-06-121-2/+2
|
* Bumped version to 4.2version-4.2Sybren A. Stüvel2020-06-111-2/+2
|
* Limit SHA3 support to Python 3.6+Sybren A. Stüvel2020-06-111-12/+15
| | | | | | | 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).
* Bumped version to 4.2-dev0Sybren A. Stüvel2020-06-101-1/+1
|
* Bumped version to 4.1version-4.1Sybren A. Stüvel2020-06-101-2/+2
|
* Fix CVE-2020-13757: detect cyphertext modifications by prepending zero bytesSybren A. Stüvel2020-06-031-0/+9
| | | | | | | | | | Reject cyphertexts that have been modified by prepending zero bytes, by checking the cyphertext length against the expected size (given the decryption key). This resolves CVE-2020-13757. The same approach is used when verifying a signature. Thanks Carnil for pointing this out on https://github.com/sybrenstuvel/python-rsa/issues/146
* Add more type hintsAndrey Semakin2020-06-039-26/+31
|
* Drop character encoding markers for Python 2.xAndrey Semakin2020-06-0315-30/+0
|
* Choose blinding factor relatively prime to NSybren A. Stüvel2020-04-141-2/+9
| | | | This is a requirement for RSA blinding, but wasn't implemented yet.
* Configured flask8 to use max_complexity=10Sybren A. Stüvel2019-08-041-23/+29
| | | | Also reorganised the only function that had a higher complexity.
* Added flake8 as development dependency and fixed reported issuesSybren A. Stüvel2019-08-046-14/+12
|
* Add support for SHA3 hashingSybren A. Stüvel2019-08-041-0/+14
| | | | | | | | | | This is based on https://github.com/sybrenstuvel/python-rsa/pull/96, with a few improvements: - The minimum of one use of SHA3 in a unit test, to at least touch it at some point. - Documented the support of SHA3. - Only install the third-party library required by Python 3.5 when we're running on Python 3.5. Newer Python versions support SHA3 natively.
* Added type annotations + some fixes to get them correctSybren A. Stüvel2019-08-0412-116/+129
| | | | | | One functional change: `CryptoOperation.read_infile()` now reads bytes from `sys.stdin` instead of text. This is necessary to be consistent with the rest of the code, which all deals with bytes.
* Added mypy for static type checkingSybren A. Stüvel2019-08-041-5/+5
|
* Removed compatibility code for Python 2.7 and 3.4Sybren A. Stüvel2019-08-0414-359/+20
|
* Bumped version to 4.1-dev0Sybren A. Stüvel2019-08-041-2/+2
|
* Mark 4.0 as releasedversion-4.0Sybren A. Stüvel2018-09-161-2/+2
|
* speedupyjqiang2018-09-166-6/+6
| | | "if A and B" if mostly A is True then we should judge B at first
* Moved `get_word_alignment()` from `_compat.py` to `machine_size.py`Sybren A. Stüvel2018-09-162-3/+77
| | | | | | In preparation of removal of Python 2.7 support, I only want to have compatibility code for Python 2.7 in `_compat.py`, and not other kinds of 'compatibility'.
* Add support for SHA224 for PKCS1 signaturesJoost Rijneveld2018-02-051-2/+4
|
* Remove duplicate hash method definitionJoost Rijneveld2018-02-051-10/+2
| | | | | | | There is no need to specify this list in PKCS1_v2 when it is already specified in PKCS1. This does rely on the digest_size attribute being available, but pkcs1.py already depends heavily on the specific API of hashlib.
* PKCS#1 2.0: Implementation of MGF1 (#89)Michael Manganiello2017-06-102-1/+112
| | | | Implementation of the Mask Generation Function `MGF1` used in the OAEP encoding step. For more information, the MGF1 specification is at https://tools.ietf.org/html/rfc2437#section-10.2.1
* Support signing a pre-calculated hash (#87)Justin Simon2017-05-072-18/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | * Split the hashing out of the sign method This code change adds support to split the hashing of a message and the actual signing of the message. * Updating unit test and documentation This commit updates the unit test and usage docs. In addition, This change removes a redundant error check inside rsa.sign(). * Refactore unit tests and code comments Removed the print statements from the unit test and refactored a few code comments to improve readability. * Rename hash function The new hash function had the same name as a function in the standard library. This commit changes the name to avoid conflicts. * Rename hash function to compute_hash() This commit renames the hash function to compute_hash().
* Ceiling division implementation (#88)Michael Manganiello2017-04-181-3/+25
| | | | Created as a new function as it will be needed by the new PKCS#1 2.0 implementation. Specifically, for the MGF1 function used in the OAEP encoding/decoding. This allows us not to have `math` dependencies
* Feature request #78: Expose function to find the hash method of a signatureSybren A. Stüvel2017-04-102-2/+22
| | | | | | I've not used the name "find_method_hash" suggested in #78, as it's a bit vague. It's ok-ish for a private function `_find_method_hash`, but I thought `find_signature_hash` would be more descriptive.
* Use iterative zip in Python 2 (#85)Michael Manganiello2017-01-173-1/+6
| | | Good catch, thanks!
* Implementation of bitwise XOR function for bytes object (#72)Michael Manganiello2017-01-161-0/+21
|
* Create PY2 constant to simplify compatibility decisions (#82)Michael Manganiello2017-01-152-20/+19
| | | It's about time to get this merged, thanks again!
* Remove custom PrivateKey exponents/coefficient (#71)Michael Manganiello2017-01-051-32/+25
| | | Thanks for the improvements!
* Fixes a typo in docstrings (#83)Alexandr2016-11-081-2/+2
|
* Drop byte_literal in favour of b''adamantike2016-05-085-61/+40
|
* Update security warning (#70)Michael Manganiello2016-05-081-3/+2
|
* xrange compatibility optimization for Python 2 (#69)Michael Manganiello2016-05-087-3/+15
|
* Remove sys.maxint fallback usageadamantike2016-04-231-5/+1
|
* Drop psyco usageSybren A. Stüvel2016-04-231-10/+0
|
* Trivial fix on primality testingadamantike2016-04-161-1/+1
|
* Set Miller-Rabin rounds based on bitsizeadamantike2016-04-151-8/+32
|
* Implemented __hash__ function for key objects.Sybren A. Stüvel2016-03-291-0/+6
| | | | | | Overriding __eq__ blocks inheritance of __hash__ in Python 3. Fixes issue #55