aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_asym_utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove asn1crypto dependency (#4941)David Benjamin2019-07-281-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove non-test dependencies on asn1crypto. cryptography.io actually contains two OpenSSL bindings right now, the expected cffi one, and an optional one hidden in asn1crypto. asn1crypto contains a lot of things that cryptography.io doesn't use, including a BER parser and a hand-rolled and not constant-time EC implementation. Instead, check in a much small DER-only parser in cryptography/hazmat. A quick benchmark suggests this parser is also faster than asn1crypto: from __future__ import absolute_import, division, print_function import timeit print(timeit.timeit( "decode_dss_signature(sig)", setup=r""" from cryptography.hazmat.primitives.asymmetric.utils import decode_dss_signature sig=b"\x30\x2d\x02\x15\x00\xb5\xaf\x30\x78\x67\xfb\x8b\x54\x39\x00\x13\xcc\x67\x02\x0d\xdf\x1f\x2c\x0b\x81\x02\x14\x62\x0d\x3b\x22\xab\x50\x31\x44\x0c\x3e\x35\xea\xb6\xf4\x81\x29\x8f\x9e\x9f\x08" """, number=10000)) Python 2.7: asn1crypto: 0.25 _der.py: 0.098 Python 3.5: asn1crypto: 0.17 _der.py: 0.10 * Remove test dependencies on asn1crypto. The remaining use of asn1crypto was some sanity-checking of Certificates. Add a minimal X.509 parser to extract the relevant fields. * Add a read_single_element helper function. The outermost read is a little tedious. * Address flake8 warnings * Fix test for long-form vs short-form lengths. Testing a zero length trips both this check and the non-minimal long form check. Use a one-byte length to cover the missing branch. * Remove support for negative integers. These never come up in valid signatures. Note, however, this does change public API. * Update src/cryptography/hazmat/primitives/asymmetric/utils.py Co-Authored-By: Alex Gaynor <alex.gaynor@gmail.com> * Review comments * Avoid hardcoding the serialization of NULL in decode_asn1.py too.
* Fixes #4734 -- Deal with deprecated things (#4736)Alex Gaynor2019-01-231-12/+1
| | | | | | | | | | * Fixes #4734 -- Deal with deprecated things - Make year based aliases of PersistentlyDeprecated so we can easily assess age - Removed encode/decode rfc6979 signature - Removed Certificate.serial * Unused import
* Use a different warning class so users get warnings (#4014)Alex Gaynor2017-11-111-2/+5
| | | | | | | | | | | | * Use a different warning class so users get warnings * fixed tests * do our own warning class * typo * flake8
* replace pyasn1 with asn1crypto (#3361)Ofek Lev2017-02-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * replace pyasn1 with asn1crypto * allow trailing bytes * fix x509 test * update CHANGELOG.rst * fix assert * make asn1crypto code more idiomatic * find tag * final clean-up * leave trailing byte logic unchanged * document dependency change * spelling * fix spelling
* support prehashing in RSA sign (#3238)Paul Kehrer2016-11-201-2/+7
| | | | | | | | * support prehashing in RSA sign * check to make sure digest size matches prehashed data provided * move doctest for prehashed
* resolve incorrect docs/naming around DSA (r, s) tuple encode/decodePaul Kehrer2015-08-101-21/+29
|
* Remove our workarounds for pyasn.1 bugs, a new pyasn.1 is out!Alex Gaynor2015-06-221-2/+2
|
* Work around pyasn1's willingness to return endOfOctets in DER parsingGeoffrey Thomas2015-04-131-0/+5
| | | | See #1838 for discussion.
* Stupid mistake number one billion.Paul Kehrer2014-12-071-0/+8
|
* directly test r, s for integer-nessPaul Kehrer2014-12-071-0/+1
|
* catch PyAsn1Error for encoding signature as wellPaul Kehrer2014-12-071-0/+8
|
* add comment describing how the ASN.1 sequence in a test is invalidPaul Kehrer2014-12-071-0/+2
|
* catch PyAsn1Error when decoding rfc6979 signaturePaul Kehrer2014-12-061-0/+5
|
* error if signature has trailing bytesPaul Kehrer2014-11-301-0/+7
|
* add encode_rfc6979_signature and refactor tests to use itPaul Kehrer2014-11-271-0/+34