aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives
Commit message (Collapse)AuthorAgeFilesLines
* Dropped support for LibreSSL 2.7, 2.8, and 2.9.0 (2.9.1+ are still ↵Alex Gaynor2020-04-251-14/+0
| | | | supported) (#5231)
* Replace floating point arithmetic with integer arithmetic (#5181)Torin Carey2020-04-041-6/+5
|
* Drop support for OpenSSL 1.0.1 (#5178)Alex Gaynor2020-04-041-57/+15
|
* Fixes #5065 -- skip serialization tests which use RC2 if OpenSSL doesn't ↵Alex Gaynor2019-11-251-10/+26
| | | | | | | | have RC2 (#5072) * Refs #5065 -- have a CI job with OpenSSL built with no-rc2 * Fixes #5065 -- skip serialization tests which use RC2 if OpenSSL doesn't have RC2
* Deal with the 2.5 deprecations (#5048)Alex Gaynor2019-11-032-8/+2
| | | | | | | | | | | | * Deal with the 2.5 deprecations * pep8 + test fixes * docs typo * Why did I do this? * typo
* update our test to be more robust wrt some changes from upstream (#4993)Paul Kehrer2019-09-111-2/+9
|
* 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.
* add class methods for poly1305 sign verify operations (#4932)Jeff Yang2019-07-081-0/+27
|
* Fix some backend feature checks in tests (#4931)David Benjamin2019-07-086-16/+10
| | | | | | | | | | | | | | | * Remove irrelevant DHBackend test conditions DHBackend provides functions for plain finite-field Diffie-Hellman. X25519 and X448 are their own algorithms, and Ed25519 and Ed448 aren't even Diffie-Hellman primitives. * Add missing backend support checks. Some new AES and EC tests did not check for whether the corresponding mode or curve was supported by the backend. * Add a DummyMode for coverage
* use a random key for these tests (#4887)Paul Kehrer2019-05-181-1/+1
| | | | | | Using an all 0 key causes failures in OpenSSL master (and Fedora has cherry-picked the commit that causes it). The change requires that the key/tweak for XTS mode not be the same value, so let's just use a random key.
* add new branch for unsupported openssh serialization (#4813)Paul Kehrer2019-03-181-1/+10
| | | | | we don't support ed448 openssh keys so we'll use that to test this branch. if we ever do support ed448 keys we can always just call this private method directly to keep coverage.
* add OpenSSH serialization for ed25519 keys (#4808) (#4811)bernhl2019-03-171-0/+11
| | | | | | * add OpenSSH serialization for ed25519 keys (#4808) * address review comments
* poly1305 support (#4802)Paul Kehrer2019-03-091-0/+125
| | | | | | | | | | | | | | | | | | | | * poly1305 support * some more tests * have I mentioned how bad the spellchecker is? * doc improvements * EVP_PKEY_new_raw_private_key copies the key but that's not documented Let's assume that might change and be very defensive * review feedback * add a test that fails on a tag of the correct length but wrong value * docs improvements
* support ed25519 openssh public keys (#4785)Paul Kehrer2019-02-271-1/+37
| | | | | | * support ed25519 openssh public keys * don't need this check
* ed448 support (#4610)Paul Kehrer2019-02-272-0/+306
| | | | | | | | * ed448 support * move the changelog entry * flake8
* ed25519 support (#4114)Paul Kehrer2019-02-262-0/+293
| | | | | | * ed25519 support * review feedback
* add an EC OID to curve dictionary mapping (#4759)Paul Kehrer2019-02-201-1/+7
| | | | | | | | | | * add an EC OID to curve dictionary mapping * oid_to_curve function * changelog and docs fix * rename to get_curve_for_oid
* Simplify string formatting (#4757)Alex Gaynor2019-02-205-9/+9
|
* Fixes for the latest pep8-naming (#4744)Alex Gaynor2019-02-0211-59/+59
|
* 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
* deprecate encode_point and migrate all internal callers (#4720)Paul Kehrer2019-01-201-1/+2
|
* add support for encoding compressed points (#4638)Paul Kehrer2019-01-204-22/+107
| | | | | | * add support for encoding compressed points * review feedback
* shake128/256 support (#4611)Paul Kehrer2019-01-192-2/+96
| | | | | | | | | | | | | | * shake128/256 support * remove block_size * doc an exception * change how we detect XOF by adding _xof attribute * interface! * review feedback
* support byteslike in KBKDFHMAC (#4711)Paul Kehrer2019-01-171-0/+8
|
* support byteslike in ConcatKDF{HMAC,Hash}, Scrypt, and X963KDF (#4709)Paul Kehrer2019-01-173-0/+59
| | | | | | | | * byteslike concatkdf * byteslike scrypt * byteslike x963kdf
* support byteslike for OTP (#4710)Paul Kehrer2019-01-172-0/+11
|
* normalize KBKDF tests (#4708)Paul Kehrer2019-01-171-38/+37
|
* Support byteslike in HKDF and PBKDF2HMAC (#4707)Paul Kehrer2019-01-172-0/+33
| | | | | | | | * support byteslike in HKDF * support byteslike in PBKDF2HMAC * add missing docs
* support bytes-like for X25519PrivateKey.from_private_bytes (#4698)Paul Kehrer2019-01-171-0/+9
| | | yuck.
* x448 and x25519 should enforce key lengths in backend (#4703)Paul Kehrer2019-01-172-1/+21
| | | | | | | | | | | * x448 and x25519 should enforce key lengths in from_private_bytes they should also check if the algorithm is supported like the public bytes class methods do * oops * move the checks
* support byteslike in hmac update (#4705)Paul Kehrer2019-01-171-1/+1
| | | needed for some KDF keying material
* support byteslike in hash updates (#4702)Paul Kehrer2019-01-161-0/+12
| | | This is needed to handle keying material in some of the KDFs
* support bytes-like keys in CMAC and HMAC contexts (#4701)Paul Kehrer2019-01-162-0/+23
|
* add support for byteslike password/data to load_{pem,der}_private_key (#4693)Paul Kehrer2019-01-161-0/+49
| | | | | | * add support for byteslike password/data to load_{pem,der}_private_key * pypy 5.4 can't do memoryview from_buffer
* support byteslike in aead for key and nonce (#4695)Paul Kehrer2019-01-151-0/+45
|
* support byteslike in X448PrivateKey.from_private_bytes (#4694)Paul Kehrer2019-01-151-0/+12
|
* add support for byteslike on password and data for pkcs12 loading (#4690)Paul Kehrer2019-01-151-0/+13
| | | | | | | | | | | | * add support for byteslike on password and data for pkcs12 loading * use a contextmanager to yield a null terminated buffer we can zero * review feedback * updated text * one last change
* Serialization x25519 (#4688)Paul Kehrer2019-01-142-8/+178
| | | | | | | | | | | | | | | | | * modify x25519 serialization to match x448 supports raw and pkcs8 encoding on private_bytes supports raw and subjectpublickeyinfo on public_bytes deprecates zero argument call to public_bytes * add docs * this is public now * don't need that * review feedback
* support x448 public/private serialization both raw and pkcs8 (#4653)Paul Kehrer2019-01-136-8/+281
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * support x448 public/private serialization both raw and pkcs8 * add tests for all other asym key types to prevent Raw * more tests * better tests * fix a test * funny story, I'm actually illiterate. * pep8 * require PrivateFormat.Raw or PublicFormat.Raw with Encoding.Raw * missing docs * parametrize * docs fixes * remove dupe line * assert something
* handle empty byte string in from_encoded_point (#4649)Paul Kehrer2018-12-171-0/+6
| | | | | | * handle empty byte string in from_encoded_point * move the error
* deprecate old from_encoded_point (#4640)Paul Kehrer2018-12-111-12/+16
|
* Compressed point support (#4629)Paul Kehrer2018-12-111-1/+75
| | | | | | | | | | | | | | | | | | | | | | | | * compressed point support * refactor to use oct2point directly * small docs change * remove deprecation for the moment and a bit of review feedback * no backend arg, implicitly import it * missed a spot * double oops * remove superfluous call * use refactored method * use vector file * one last item
* allow bytes-like for key/iv/data for symmetric encryption (#4621)Paul Kehrer2018-12-092-0/+54
| | | | | | | | | | | | | | | | | | * allow bytearrays for key/iv for symmetric encryption * bump pypy/cffi requirements * update docs, fix some tests * old openssl is naught but pain * revert a typo * use trusty for old pypy * better error msg again * restore match
* Raise MemoryError when backend.derive_scrypt can't malloc enough (#4592)Tux2018-12-081-0/+14
| | | | | | | | | | | | * Raise MemoryError when backend.derive_scrypt can't malloc enough * Expose ERR_R_MALLOC_FAILURE and use the reason_match pattern to catch it * Add test_scrypt_malloc_failure in test_scrypt * let's see if this passes * add comment to filippo's blog post about scrypt's params
* PKCS12 Basic Parsing (#4553)Paul Kehrer2018-11-281-0/+110
| | | | | | | | | | | | | | | | | | * PKCS12 parsing support * running all the tests is so gauche * rename func * various significant fixes * dangerous idiot here * move pkcs12 * docs updates * a bit more prose
* X448 support (#4580)Paul Kehrer2018-11-221-0/+127
| | | | | | | | | | | | | | | | | | | | * x448 support This work was originally authored by derwolfe * update docs to have a more useful derived key length * error if key is not a valid length in from_public_bytes * one more * switch to using evp_pkey_keygen_gc for x448 keygen * review feedback * switch to using evp_pkey_derive * nit fix
* add sha3 support (#4573)Paul Kehrer2018-11-221-0/+68
| | | | | | | | * add sha3 support * missed versionadded * add prose, remove block_size
* error if the key length for x25519 isn't 32 bytes (#4584)Paul Kehrer2018-11-121-0/+7
| | | | | | * error if the key length for x25519 isn't 32 bytes * also test 33
* add SHA512/224 and SHA512/256 support (#4575)Paul Kehrer2018-11-121-0/+34
| | | | | | * add SHA512/224 and SHA512/256 support * add missing docs
* parametrize a bunch of tests (#4365)Paul Kehrer2018-11-041-281/+58
|