aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/hazmat/backends/openssl/backend.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Drop 1.0.0 (#3312)Alex Gaynor2016-12-131-63/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-12/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* friendly error if you put a date too far in the future on windows (#3279)Paul Kehrer2016-12-051-2/+15
|
* OpenSSL DH backend implementation [Second attempt] (#2914)Aviv Palivoda2016-11-261-1/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start of OpenSSL DH backend implementation * Supporting DH in MultiBackend * DHBackend has dh_parameters_supported method * Removed DHParametersWithNumbers and DHPrivateKeyWithNumbers from documentation * Removed ExchangeContext. exchange is a method of DHPrivateKeyWithSerialization * PEP8 fixes * Fixed TestDH.test_bad_tls_exchange * Fixed generate_private_key reference in dh documentation * test DH multibackend support * testing DH coversion to serialized * Validating that we receive serialized class in test_generate_dh * Testing DH exchange symmetric key padding * struct DH is now opaqued * PEP8 fixes * Testing load_dh_private_numbers throws ValueError when DH_check fails * Using openssl_assert * Passing keywords arguments in DH key exchange example * test_dh::test_bad_tls_exchange now uses pre calculated parameters * TestDH - Add test that the computed secret is equivalent to the definition by comparing with secret computed in pure python * Add missing generator parameter to DHBackend interface docs. * Include parameter type in DHBackend abc docs. * Add docs for dh.generate_parameters function * Remove the dh Numbers section, and move the DHNumbers class docs to where they are first used. * Add note of big endian byte packing to DH exchange method. * DH documentation updates. Add single sentence overview with wikipedia link. Add paragraph on assembling using Numbers objects. Add link to backend interface docs. First section was all indented, I think by mistake. * Add exchange method to DHPrivateKey abstract base class. * Small tweaks to DH documentation - remove Provider. * Add endian to dictionary * Use utils.int_from_bytes in test_tls_exchange_algorithm * Removed duplicate line * Change dh.rst exchange algorithm from doctest to code-block The example in the Diffie-Hellman exhange algorithm is using 2048 bits key. Generating the parameters of 2048 takes long time. This caused the automated tests to fail. In order to pass the tests we change the example to code-block so it will not run in the doc tests. * Fix dh docs * Document the generator in DHBackend relevant methods * Fix dh tests * use DHparams_dup * Fix key type to unsigned char as expected by DH_compute_key * Validate that DH generator is 2 or 5 * test dh exchange using botan vectors * group all numbers classes * Simplify _DHPrivateKey * Rename test with serialized to numbers * Move bad exchange params to external vector file * update exchange versionadded to 1.7 * Make key_size bit accurate * Change botan link * Added CHANGELOG entry
* change derive_elliptic_curve_public_point to return EllipticCurvePubl… (#3243)Paul Kehrer2016-11-181-4/+9
| | | | | | | | | | | | | | * change derive_elliptic_curve_public_point to return EllipticCurvePublicKey * also rename the backend interface method * review feedback * Rename to derive_elliptic_curve_private_key * Returns EllipticCurvePrivateKey * Reuses the EC_POINT in the openssl impl * Rename "secret" arg to "private_value" which is consistent with our naming for the value in ECPrivateNumbers.
* Add a bytes method to get the DER ASN.1 encoding of an X509 name. (#3236)Paul Kehrer2016-11-131-0/+11
| | | | | | | | | | * Add a bytes method to get the DER ASN.1 encoding of an X509 name. This is useful for creating an OpenSSL style subject_name_hash (#3011) * add to backend interface and update multibackend * bytes -> public_bytes
* add ec.private_key_from_secret_and_curve (#3225)Ofek Lev2016-11-111-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * finish https://github.com/pyca/cryptography/pull/1973 * change API & add test Function will now return an instance of EllipticCurvePrivateKey, as that is the users' ultimate goal anyway. * fix test * improve coverage * complete coverage * final fix * centos fix * retry * cleanup asserts * use openssl_assert * skip unsupported platforms * change API name to derive_private_key * change version added * improve description of `secret` param * separate successful and failure test cases * simplify successful case * add docs for derive_elliptic_curve_public_point * add period
* Name: add support for multi-value RDNs (#3202)Fraser Tweedale2016-11-111-3/+3
| | | | | | | | Update the Name class to accept and internally store a list of RelativeDistinguishedName objects. Add the 'rdns' attribute to give access to the RDNs. Update ASN.1 routines to correctly decode and encode multi-value RDNs. Fixes: https://github.com/pyca/cryptography/issues/3199
* fix warnings in cffi 1.8.3 due to wrong buffer types (#3155)Paul Kehrer2016-09-211-1/+1
|
* Scrypt Implementation (#3117)Terry Chia2016-09-011-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | * Scrypt implementation. * Docs stuff. * Make example just an example and not a doctest. * Add changelog entry. * Docs cleanup. * Add more tests. * Add multibackend tests. * PEP8. * Add docs about Scrypt parameters. * Docs cleanup. * Add AlreadyFinalized.
* blake2b/blake2s support (#3116)Paul Kehrer2016-08-281-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | * blake2b/blake2s support Doesn't support keying, personalization, salting, or tree hashes so the API is pretty simple right now. * implement digest_size via utils.read_only_property * un-keyed for spelling's sake * test copying + digest_size checks * unkeyed is too a word * line wrap * reword the docs * use the evp algorithm name in the error This will make BLAKE2 alternate digest size errors a bit less confusing * add changelog entry and docs about supported digest_size
* OpenSSL 1.1.0 support (#2826)Paul Kehrer2016-08-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | * 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?
* use DSAparams_dup now that we no longer support 0.9.8 (#3006)Paul Kehrer2016-06-201-22/+3
|
* Rewrite a comment. (#3004)Alex Gaynor2016-06-201-4/+4
| | | d2i_AutoPrivateKey is less useful than we thought
* Simplify and remove some 0.9.8 code from the EVP bindings (#2996)Alex Gaynor2016-06-191-6/+4
| | | | | | | | * Simplify and remove some 0.9.8 code from the EVP bindings The Cryptography_ symbol remains because pyOpenSSL uses. There's still other 0.9.8isms in this file. * only eclare this once
* Remove a binding and comments that reference 0.9.8 (#2984)Alex Gaynor2016-06-181-4/+2
|
* Drop OpenSSL 0.9.8 (#2978)Alex Gaynor2016-06-181-113/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Small cleanup (#2979)Alex Gaynor2016-06-151-6/+1
|
* RSA OAEP SHA2 Support (#2956)Paul Kehrer2016-06-041-3/+20
| | | | | | | | | | | | | | | | | | | | * 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
* SSH serialization for public keys (#2957)Alex Gaynor2016-06-031-2/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * SSH serialization for public keys * name errors ahoy! * id, ego, superego * dsa support * EC support * Don't keyerror * Documentation OpenSSH * flake8 * fix * bytes bytes bytes * skip curve unsupported * bytes! * Move a function * reorganize code for coverage
* treat rsa struct as opaque (#2935)Paul Kehrer2016-05-311-11/+17
|
* treat the DSA struct as opaque (#2883)Paul Kehrer2016-05-281-19/+45
| | | | | | * initial DSA backend changes for opaque struct * don't use DSAparams_dup because centos5 0.9.8e is a mystery
* move the code aroundAlex Gaynor2016-03-141-54/+54
|
* delete software (flake8)Alex Gaynor2016-03-141-4/+3
|
* Fixed #2747 -- allow creating x509 exts with unknown extensionsAlex Gaynor2016-03-141-33/+51
|
* support openssl 0.9.8's nonsense hopefullyPaul Kehrer2016-03-131-1/+26
|
* also bytes.Paul Kehrer2016-03-131-1/+3
|
* simplify extension creation by using X509V3_EXT_i2dPaul Kehrer2016-03-131-9/+5
|
* modify how revocation date is set on X509_REVOKED in the openssl backendPaul Kehrer2016-03-101-3/+6
| | | | | | In OpenSSL 1.1.0 there isn't a pre-existing ASN1_TIME object so we have ASN1_TIME_set make us a new one. In older OpenSSLs this is still safe because ASN1_TIME_set checks and frees any current value in the object.
* SSLeay begonePaul Kehrer2016-03-091-1/+1
| | | | | | | In OpenSSL 1.1.0 SSLeay is no longer a thing. Farewell Except not really farewell because we define them all again because old versions of pyOpenSSL will choke otherwise
* move more functions out of the openssl backend classPaul Kehrer2016-01-101-50/+0
|
* move openssl asn1 encode functions to a new modulePaul Kehrer2016-01-101-587/+8
|
* Merge pull request #2646 from reaperhulk/static-callbacksAlex Gaynor2016-01-081-7/+15
|\ | | | | Static callbacks
| * Port callbacks to new static callbackChristian Heimes2016-01-071-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cffi 1.4.0 will introduce a new API to create static callbacks. Contrary to the old callback API, static callbacks no longer depend on libffi's dynamic code generation for closures. Static code has some benefits over dynamic generation. For example the code is faster. Also it doesn't need writeable and executable memory mappings, which makes it compatible with SELinux's deny execmem policy. The branch depends on PR #2488. https://bitbucket.org/cffi/cffi/issues/232/static-callbacks Closes: #2477 Signed-off-by: Christian Heimes <cheimes@redhat.com>
| * Change password callback to use userdata pointerChristian Heimes2016-01-071-0/+1
| | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #2647 from reaperhulk/opaque-evp-pkeyAlex Gaynor2016-01-081-9/+10
|\ \ | | | | | | opaque EVP_PKEY since EVP_PKEY_id exists
| * | add Cryptography_EVP_PKEY_idPaul Kehrer2016-01-071-4/+6
| | |
| * | opaque EVP_PKEY since EVP_PKEY_id existsPaul Kehrer2016-01-071-9/+8
| | |
* | | Merge pull request #2649 from reaperhulk/cleanup-namingAlex Gaynor2016-01-081-4/+4
|\ \ \ | |/ / |/| | rename _create_mem_bio to _create_mem_bio_gc for consistency
| * | rename _create_mem_bio to _create_mem_bio_gc for consistencyPaul Kehrer2016-01-071-4/+4
| |/
* / small cleanup to reduce code duplication for EVP_PKEY_new callsPaul Kehrer2016-01-071-7/+7
|/
* Support EC and DSA signing of CRLs in the OpenSSL backendPaul Kehrer2015-12-271-10/+11
|
* fix a ptr liveness bugAlex Gaynor2015-12-271-2/+2
|
* Reduce duplication, write a functionAlex Gaynor2015-12-271-85/+39
|
* _encode_alt_name already does thisPaul Kehrer2015-12-271-15/+1
|
* move around a dictPaul Kehrer2015-12-271-17/+4
|
* support CRL entry extension encoding in the RevokedCertificateBuilderPaul Kehrer2015-12-271-3/+77
|
* Simplify code slightly by adding a new bindingAlex Gaynor2015-12-261-4/+1
|
* A handful of small cleanups and simplificationsAlex Gaynor2015-12-261-0/+3
|