| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|\
| |
| | |
Polish up examples (somewhat)
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Mention them in the docs (arguably a bit hamfistedly).
- Make the README an RST.
- Make them pass flake8 and add flake8 to tox.ini
They should all be rewritten and made Python 3-friendly but that's out
of scope here.
|
|\ \
| | |
| | | |
Pluck more unrelated bits from #422
|
|/ / |
|
|\ \
| |/
|/| |
Deprecate Python 2.6
|
|/
|
|
| |
Bind actual drop to cryptography.
|
|\
| |
| | |
treat x509 extension objects as opaque pointers
|
| | |
|
| | |
|
| |
| |
| |
| |
| | |
so we'll use the second revoked because to cover this branch we need to
see a NID that's not NID_crl_reason
|
| | |
|
| | |
|
|\ \
| |/
|/| |
Fix set_cipher_list on modern OpenSSL
|
| | |
|
| | |
|
| | |
|
|/
|
|
| |
Also port forward a few changes from #422.
|
|\
| |
| | |
X509_REVOKED_dup is a thing cryptography can do for you
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
This also removes the use of M_ASN1_TIME_dup
|
|\ \
| |/
|/| |
switch to DSA_generate_parameters_ex
|
| | |
|
|/ |
|
|\
| |
| | |
add changelog entry for the fix in #428
|
|/ |
|
|\
| |
| | |
Fix signature buffer size for RSA keys
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using the pyOpenSSL crypto module to sign data using a large key,
e.g. 8192 bit, a memory allocation error occurs. A test case to show
this, which comes from OpenStack Glance, is:
```
$ openssl genrsa -out server.key 8192
$ ...
$ cat test.py
from OpenSSL import crypto
import uuid
key_file = 'server.key'
with open(key_file, 'r') as keyfile:
key_str = keyfile.read()
key = crypto.load_privatekey(crypto.FILETYPE_PEM, key_str)
data = str(uuid.uuid4())
digest = 'sha256'
crypto.sign(key, data, digest)
$ python test.py
*** Error in `python': free(): invalid next size (normal): 0x0000000002879050 ***
Aborted
```
Other errors that may appear to the user are:
```
Segmentation Fault
```
```
*** Error in `python': double free or corruption (!prev): 0x0000000001245300 ***
Aborted
```
```
*** Error in `python': munmap_chunk(): invalid pointer: 0x0000000001fde540 ***
Aborted
```
The reason this happens is that the sign function of the crypto module
hard-codes the size of the signature buffer to 512 bytes (4096 bits).
An RSA key generates a signature that can be up to the size of the
private key modulus, so for an 8192 bit key, a buffer for a 4096 bit
signature is too short and causes a memory allocation error.
Technically the maximum size key this code should be able to handle is
4096 bits, but due to memory allocation alignment the problem only
becomes apparent for keys of at least 4161 bits.
This patch does two things. First, it determines the correct size of
the signature buffer, in bytes, based on the real size of the private
key, and passes that the buffer allocation instead of the static number
512. Second, it no longer passes in a signature length. This is because
the OpenSSL EVP_SignFinal function uses this argument as an output and
completely ignores it as an input[1], so there is no need for us to set
it.
This is only a problem for RSA keys, and this patch only affects RSA
keys. For DSA keys, the key size is restricted to 1024 bits (128
bytes), and the signature a DSA key will generate will be about 46
bytes, so this buffer will still be big enough for DSA signatures.
[1] https://github.com/openssl/openssl/blob/349807608f31b20af01a342d0072bb92e0b036e2/crypto/evp/p_sign.c#L74
|
|\
| |
| | |
Explain that FILETYPE_ASN1 is DER.
|
| | |
|
| | |
|
| | |
|
|\ \
| | |
| | | |
use pypy4 in travis CI
|
| | | |
|
|/ / |
|
|\ \
| | |
| | | |
Make pyOpenSSL future-proof
|
| | | |
|
| | | |
|
|/ /
| |
| |
| | |
Notably stop breaking cryptography 1.3.
|
|\ \
| |/
|/| |
Greatly simplify test_state_string
|
|/
|
|
| |
It used to more or less a functional test. No wonder it was rather flaky.
|
|\
| |
| | |
compare datetimes directly for the expiry check
|
|/ |
|
|\
| |
| | |
2016 snook up on us
|
|/ |
|
|\
| |
| | |
Add changelog entry for #304
|
|/ |
|
|\
| |
| | |
Fixed AttributeError when calling get_app_data()
|