summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHynek Schlawack <hs@ox.cx>2016-01-31 14:18:54 +0100
committerHynek Schlawack <hs@ox.cx>2016-01-31 15:12:01 +0100
commit2a91ba31326eb0ad2e36b9aaa33c826899197ad2 (patch)
tree63ef357bc4e7d9dcb3c21daeba3fea3dccf1bc29
parent85bc15c101a23f5dd0b85b2a6cacabc614b6b3cf (diff)
downloadpyopenssl-git-2a91ba31326eb0ad2e36b9aaa33c826899197ad2.tar.gz
Make pyOpenSSL future-proof
Notably stop breaking cryptography 1.3.
-rw-r--r--.travis.yml15
-rw-r--r--setup.cfg2
-rw-r--r--src/OpenSSL/crypto.py9
-rw-r--r--tox.ini5
4 files changed, 26 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml
index 00902b8..0b9f8d5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -45,6 +45,21 @@ matrix:
- python: "pypy"
env: TOXENV=pypy-cryptographyMaster
+ # And older cryptography versions.
+ - python: "2.6"
+ env: TOXENV=py26-cryptographyLegacy
+ - python: "2.7"
+ env: TOXENV=py27-cryptographyLegacy
+ - python: "3.3"
+ env: TOXENV=py33-cryptographyLegacy
+ - python: "3.4"
+ env: TOXENV=py34-cryptographyLegacy
+ - python: "3.5"
+ env: TOXENV=py35-cryptographyLegacy
+ - python: "pypy"
+ env: TOXENV=pypy-cryptographyLegacy
+
+
# Make sure we don't break Twisted
- python: "2.7"
env: TOXENV=py27-twistedMaster
diff --git a/setup.cfg b/setup.cfg
index e68206f..8a1dc84 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[pytest]
-minversion = 2.8.2
+minversion = 2.8.5
strict = true
testpaths = tests
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py
index a00b5c0..6d78bd7 100644
--- a/src/OpenSSL/crypto.py
+++ b/src/OpenSSL/crypto.py
@@ -247,7 +247,7 @@ class PKey(object):
if self._only_public:
raise TypeError("public key only")
- if _lib.EVP_PKEY_type(self._pkey.type) != _lib.EVP_PKEY_RSA:
+ if _lib.EVP_PKEY_type(self.type()) != _lib.EVP_PKEY_RSA:
raise TypeError("key type unsupported")
rsa = _lib.EVP_PKEY_get1_RSA(self._pkey)
@@ -263,7 +263,12 @@ class PKey(object):
:return: The type of the key.
"""
- return self._pkey.type
+ try:
+ # cryptography 1.2+
+ return _lib.Cryptography_EVP_PKEY_id(self._pkey)
+ except AttributeError:
+ # Older releases of cryptography.
+ return self._pkey.type
def bits(self):
"""
diff --git a/tox.ini b/tox.ini
index 73f6018..44ee420 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = coverage-clean,{pypy,py26,py27,py33,py34,py35}{,-cryptographyMaster},py27-twistedMaster,pypi-readme,check-manifest,flake8,docs,coverage-report
+envlist = coverage-clean,{pypy,py26,py27,py33,py34,py35}{,-cryptographyMaster,-cryptographyLegacy},py27-twistedMaster,pypi-readme,check-manifest,flake8,docs,coverage-report
[testenv]
whitelist_externals =
@@ -7,8 +7,9 @@ whitelist_externals =
passenv = ARCHFLAGS CFLAGS LC_ALL LDFLAGS PATH LD_LIBRARY_PATH TERM
deps =
coverage
- pytest>=2.8.2,!=2.8.4
+ pytest>=2.8.5
cryptographyMaster: git+https://github.com/pyca/cryptography.git
+ cryptographyLegacy: cryptography<1.2
setenv =
# Do not allow the executing environment to pollute the test environment
# with extra packages.