aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends/test_openssl.py
Commit message (Collapse)AuthorAgeFilesLines
* reverts a change to our exceptions (#3429)Paul Kehrer2017-03-091-5/+3
| | | | | Trying to be too specific about why key loading fails is very difficult when you're using the same logic across DH, EC, RSA, and DSA. This makes it less fancy.
* DH subgroup order (q) (#3369)Aviv Palivoda2017-03-051-3/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support DH q (subgroup order) * Change RFC5114.txt to NIST format * Add tests for DH q * Update docs for DH q * Fix pep8 * Improve test covergae for DH q * Create _dh_params_dup that copy q if DHparams_dup don't On OpenSSL < 1.0.2 DHparams_dup don't copy q. _dh_params_dup call DHparams_dup and if the version is smaller than 1.0.2 copy q manually * Copy q manually on libressl * Add to test vectors serialized RFC5114 2048 bit DH parameters with 224 bit subgroup * Support serialization of DH with q * Add tests for serialization of DH with q * Support DH serialization with q only if Cryptography_HAS_EVP_PKEY_DHX is true * Raise exception when trying to serialize DH X9.42 when not supported * raise unsupported key type when deserilizing DH X9.42 if not supported * pep8 fixes * Fix test_serialization * Add dhx_serialization_supported method to DHBacked * document q in dh_parameters_supported * Rename dhx_serialization_supported to dh_x942_serialization_supported
* switch the PEM password callback to a C implementation (#3382)Paul Kehrer2017-02-131-15/+24
| | | | | | | | | | | | | | | * switch the PEM password callback to a C implementation Calling from C to Python is fraught with edge cases, especially in subinterpreter land. This commit moves the PEM password callback logic into a small C function and then removes all the infrastructure for the cffi callbacks (as we no longer have any) * review feedback and update tests * rename the struct * aaand one more fix
* enforce password must be bytes when loading PEM/DER asymmetric keys (#3383)Paul Kehrer2017-02-081-1/+1
| | | | | | | | | | * enforce password must be bytes when loading PEM/DER asymmetric keys Previously we were using an ffi.buffer on the Python string, which was allowing text implicitly, but our documentation explicitly requires bytes. * add changelog entry
* add openssl_version_number & doc openssl_version_text (#3329)Paul Kehrer2016-12-211-0/+3
| | | | | | | | | | * add openssl_version_number & doc openssl_version_text fixes #3315 * more docs + actually assert on the test... * text
* Drop 1.0.0 (#3312)Alex Gaynor2016-12-131-151/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * delete the 1.0.0 support * drop the version check * drop the AES-CTR stuff * Update the example * openssl truncates for us now * delete unused test * unused imports * Remove a bunch of conditional bindings for NPN * no more 1.0.0 builders * libressl fix * update the docs * remove dead branches * oops * this is a word, damnit * spelling * try removing this * this test is not needed * unused import
* New osrandom_engine in C (#3229)Christian Heimes2016-12-091-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * New osrandom_engine in C Inspired by Python/random.c and the old implementation. Signed-off-by: Christian Heimes <christian@python.org> * osrandom_engine * Fix naming bug caused by search 'n replace mistake * Make it easier to override osrandom auto-detection * Add engine ctrl and backend API to get implementation from ENGINE Signed-off-by: Christian Heimes <christian@python.org> * Better test coverage, documentation, LICENSE Signed-off-by: Christian Heimes <christian@python.org> * Coverage is hard. Signed-off-by: Christian Heimes <christian@python.org> * * enable win32 check * read() returns size_t Signed-off-by: Christian Heimes <christian@python.org> * Add macOS to spelling list. Remove dead code from header file. Signed-off-by: Christian Heimes <christian@python.org> * remove CCRandomGenerateBytes path and update getentropy to work on macOS This change allows us to test all the engines in our CI: * getentropy (tested by macOS sierra) * getrandom (tested on several linux builders) * /dev/urandom (tested on FreeBSD, OS X 10.11 and below, & older linux) * CryptGenRandom (tested on windows builders) I also fixed bugs preventing compilation in the getentropy code * getentropy() returns int and is restricted to 256 bytes on macOS, too. Signed-off-by: Christian Heimes <christian@python.org> * add versionadded * Re-add import of os module * Fixes related to Alex's recent review. Signed-off-by: Christian Heimes <christian@python.org> * Add error reporting and fail for EAGAIN Add error reporting strings for various error cases. This gives us much nicer and understandable error messages. SYS_getrandom() EAGAIN is now an error. Cryptography refuses to initialize its osrandom engine when the Kernel's CPRNG hasn't been seeded yet. Signed-off-by: Christian Heimes <christian@python.org>
* 1.0.2i changed the way COMP_METHOD is exported if NO_COMP is set (#3162)Paul Kehrer2016-09-221-1/+1
| | | | | | | | | | * 1.0.2i changed the way COMP_METHOD is exported if NO_COMP is set * add a comment explaining why we changed this * 1.0.2i handles NUMERICSTRING properly now so need only test < 1.0.2i * needs to be visible
* fix warnings in cffi 1.8.3 due to wrong buffer types (#3155)Paul Kehrer2016-09-211-2/+2
|
* OpenSSL 1.1.0 support (#2826)Paul Kehrer2016-08-261-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * make pre5 work * add a blank line to make the diff happier * 1.1.0-pre6 working * support the changes since 1.1.0-pre6 * fixes * add 1.1.0 to travis * expose the symbol * better testing for numericstring * handle libre... * actually use the 1.1.0 we compile * cache the ossl-110 dir on travis * add some newlines * changelog entry for 1.1.0 support * note that we test on 1.1.0 * proper skip on this test * reorder
* Use a series of constants for OpenSSL version checks (#3037)Alex Gaynor2016-07-111-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | * Use a series of constants for OpenSSL version checks. N.B. I removed several qualifiers that were being used to express beta vs. release in OpenSSL version numbers. Reviewers please look closely! * Convert some python as well, also add the file * flake8 * Simplify code, remove functionality that can be expressed more simply * clean up the tests as well * more constants * wrap long lines * reflect feedback * unused * add this back?
* Complete the removal of the string '0.9.8' (#3005)Alex Gaynor2016-06-201-1/+1
| | | We have always been at war with OpenSSL 0.9.8
* Remove a binding and comments that reference 0.9.8 (#2984)Alex Gaynor2016-06-181-1/+1
|
* Drop OpenSSL 0.9.8 (#2978)Alex Gaynor2016-06-181-25/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Drop OpenSSL 0.9.8 * Drop this test, it's not relevant any longer * unused import * Remove CRYPTOGRAPHY_ALLOW_OPENSSL_098=1 from our tox * removed unused code for Cryptography_HAS_PKEY_CTX * return unused code for _AESCTRCipherContext * syntax :-( * remove some unused tests and skips * remove unused code for Cryptography_HAS_PBKDF2_HMAC * Revert "return unused code for _AESCTRCipherContext" This reverts commit 7d149729205aa4c9735eb322414b167a75b302df. * Remove unused RSA code * Remove unused test code for conditional bindings * Remove unused dsa code * unused import * Remove unused x509 extension code * Remove unused EC code * Attempt to remove unused DER key loading code * document this * grammar * Added back this paragraph * Update docs
* RSA OAEP SHA2 Support (#2956)Paul Kehrer2016-06-041-2/+74
| | | | | | | | | | | | | | | | | | | | * some rsa oaep sha2 support * various improvements * fix a thing * simplify * update the test * styyyyyle * more styyyyle * fix libre, remove a skip that should never be hit * OAEP version check fixes
* Use teardown since we ignore the method arg anyways (#2928)Alex Gaynor2016-05-301-2/+1
|
* Replacing test_osrandom_engine_is_default. (#2905)Andreas Moser2016-05-291-0/+12
| | | | | | | | | | | | | | | | | | | * Removing test_osrandom_engine_is_default. test_osrandom_engine_is_default depends on having a valid sys.executable. This attribute is not always set (see https://docs.python.org/2/library/sys.html#sys.executable ) so, in some environments, this test fails. I moved the functionality of the test into the setup and teardown methods so the correct behavior is still tested. * Fixing some style issues. * Removing an unnecessary newline. * Putting back the test. * Moving the assert from teardown to setup.
* py3 is a thingPaul Kehrer2016-03-121-1/+1
|
* move NUMERICSTRING certificate test to test_openssl & make it more specificPaul Kehrer2016-03-121-0/+21
|
* Un-double the test doublesAlex Gaynor2016-03-051-40/+13
|
* Send stderr someplaceAlex Gaynor2016-02-271-1/+2
| | | | Otherwise there's noise in the test output on python 2.6
* Actually allocate a buffer that is the correct size.Tristan Seligmann2016-02-081-2/+3
|
* give a real EVP_PKEY with an invalid default key type to the testPaul Kehrer2016-01-071-2/+0
|
* opaque EVP_PKEY since EVP_PKEY_id existsPaul Kehrer2016-01-071-1/+1
|
* Support EC and DSA signing of CRLs in the OpenSSL backendPaul Kehrer2015-12-271-0/+37
|
* move two tests to the openssl backend tests where they belongPaul Kehrer2015-12-261-1/+51
|
* RevokedCertificateBuilderPaul Kehrer2015-12-251-2/+2
|
* add create_x509_revoked_certificate to x509backend interfacePaul Kehrer2015-12-251-0/+6
|
* Merge pull request #2567 from alex/this-is-americaPaul Kehrer2015-12-241-1/+1
|\ | | | | Spell serialization consistently
| * Spell serialization consistentlyAlex Gaynor2015-12-241-1/+1
| |
* | CertificateRevocationListBuilderPaul Kehrer2015-12-241-3/+6
|/ | | | | RSA keys only. Currently does not support CRL extensions or CRLEntry extensions.
* coveragePaul Kehrer2015-12-241-0/+5
|
* Change password callback to use userdata pointerChristian Heimes2015-12-201-2/+15
| | | | | | | | | Instead of a closure the pem_password_cb now uses the void *userdata argument to exchange data with the callback function. It's a necessary step to port all callbacks to new static callbacks. See: #2477 Signed-off-by: Christian Heimes <christian@python.org>
* better place for this testAlex Gaynor2015-10-191-7/+0
|
* another testAlex Gaynor2015-10-191-0/+7
|
* a refactor to the APIAlex Gaynor2015-10-171-11/+3
|
* Add an Elliptic Curve Key Exchange Algorithm(ECDH)Simo Sorce2015-10-171-0/+14
| | | | | | | | | The ECDH Key Exchange algorithm as standardized in NIST publication 800-56A Revision 2 Includes tests with vectors from NIST. Signed-off-by: Simo Sorce <simo@redhat.com>
* Use InternalError for stuffAlex Gaynor2015-09-261-19/+1
|
* fix the testsAlex Gaynor2015-09-261-1/+2
|
* add test for openssl_assertPaul Kehrer2015-09-251-1/+6
|
* pep8 fixPaul Kehrer2015-08-091-2/+0
|
* move a testPaul Kehrer2015-08-091-26/+0
|
* support issuer alternative name encodingPaul Kehrer2015-08-091-1/+6
|
* fix unsupported testPaul Kehrer2015-08-081-1/+1
|
* rename sign_x509_certificate backend method to create_x509_certificatePaul Kehrer2015-08-061-1/+1
|
* fix a few tests that were missedPaul Kehrer2015-08-051-0/+2
|
* missed onePaul Kehrer2015-08-031-1/+1
|
* Merge remote-tracking branch 'upstream/master' into cert-builderIan Cordasco2015-08-031-0/+27
|\
| * this is gonna be unicode nowPaul Kehrer2015-08-011-3/+3
| |
| * move urandom engine testPaul Kehrer2015-08-011-0/+27
| | | | | | | | | | | | | | | | | | | | This test was in the bindings dir, which is incorrect. We do not set the urandom engine to default unless the openssl backend is loaded. The reason the test wasn't failing (even in the random test case) is that the backends are loaded during pytest_generate_tests by a call to _available_backends. So no matter what order it occurred in the engine was already set to default. I discovered this when I tried to run the test_openssl.py bindings tests directly via pytest. Hooray global state.