Vì vậy, tôi đang cố gắng thêm SSL vào máy chủ web của mình đang chạy trên pi B + (sử dụng cherrypy)
Tôi chắc chắn rằng OpenSSL đã được cài đặt với:
sudo apt-get install openssl
Sau đó, tôi đã cài đặt pyOpenSSL với:
sudo apt-get install python-openssl
Trong cả hai trường hợp, nó nói:
openssl is already the newest version.
python-openssl is already the newest version.
Bởi vì tôi đã chạy lệnh nhiều lần. Vì vậy, điều này có vẻ tốt.
Đến lúc đó trong python khi tôi làm:
import OpenSSL
Tôi nhận được lỗi. Đặc biệt:
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenSSL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 3, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
ImportError: No module named cryptography.hazmat.bindings.openssl.binding
Tôi có một vấn đề tương thích ở đây? Có phải hai phiên bản mới nhất không tương thích với nhau? Có ai nhìn thấy điều này trước đây?
Thông tin phiên bản tôi có:
% openssl version
OpenSSL 1.0.1e 11 Feb 2013
Và đối với python-openssl tôi có:
% dpkg -s python-openssl
Package: python-openssl
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 532
Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
Architecture: armhf
Source: pyopenssl
Version: 0.13-2+rpi1+deb7u1
Depends: python (<< 2.8), python (>= 2.6), python-support (>= 0.90.0), libc6 (>= 2.13-28), libssl1.0.0 (>= 1.0.0)
Suggests: python-openssl-doc, python-openssl-dbg
Description: Python 2 wrapper around the OpenSSL library
High-level wrapper around a subset of the OpenSSL library, includes
.
* SSL.Connection objects, wrapping the methods of Python's portable
sockets
* Callbacks written in Python
* Extensive error-handling mechanism, mirroring OpenSSL's error
codes
.
A lot of the object methods do nothing more than calling a
corresponding function in the OpenSSL library.
Homepage: http://launchpad.net/pyopenssl
Khi sử dụng cờ -v trên python tôi nhận được:
>>> import OpenSSL
import OpenSSL # directory /usr/local/lib/python2.7/dist-packages/OpenSSL
# /usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.pyc matches /usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py
import OpenSSL # precompiled from /usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.pyc
# /usr/local/lib/python2.7/dist-packages/OpenSSL/rand.pyc matches /usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py
import OpenSSL.rand # precompiled from /usr/local/lib/python2.7/dist-packages/OpenSSL/rand.pyc
# /usr/lib/python2.7/functools.pyc matches /usr/lib/python2.7/functools.py
import functools # precompiled from /usr/lib/python2.7/functools.pyc
import _functools # builtin
# /usr/local/lib/python2.7/dist-packages/six.pyc matches /usr/local/lib/python2.7/dist-packages/six.py
import six # precompiled from /usr/local/lib/python2.7/dist-packages/six.pyc
# /usr/lib/python2.7/__future__.pyc matches /usr/lib/python2.7/__future__.py
import __future__ # precompiled from /usr/lib/python2.7/__future__.pyc
import itertools # builtin
import operator # builtin
# /usr/lib/python2.7/StringIO.pyc matches /usr/lib/python2.7/StringIO.py
import StringIO # precompiled from /usr/lib/python2.7/StringIO.pyc
# /usr/local/lib/python2.7/dist-packages/OpenSSL/_util.pyc matches /usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py
import OpenSSL._util # precompiled from /usr/local/lib/python2.7/dist-packages/OpenSSL/_util.pyc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import (
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 3, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
ImportError: No module named cryptography.hazmat.bindings.openssl.binding