我正在尝试强制 python 2.7 与修改后的 openssl 库一起使用。我需要支持俄罗斯 GOST 密码。所以我像这样配置了OpenSSL
./config shared zlib enable-rfc3779 --prefix=/my/path/
并安装它(制作依赖,制作,制作测试,制作安装)。openssl.conf 包含
openssl_conf = openssl_def
[openssl_def]
engines = engine_section
[engine_section]
gost = gost_section
[gost_section]
engine_id = gost
default_algorithms = ALL
该命令/my/path/bin/openssl ciphers | tr ":" "\n" | grep GOST
返回后
GOST2001-GOST89-GOST89
GOST94-GOST89-GOST89
并openssl s_client -connect test.domain.ru:443
成功连接,我可以发送 GET 请求(标准 OpenSSL 不适用于此站点)。之后,我尝试使用该 openssl lib 编译 python:我取消注释并将 Modules/Setup.dist 中的 SSL 变量更改为/my/path
及其下的相关行,并且还更改了 setup.py 中ssl_incs
的ssl_libs
变量。我已将 python 安装到我的主文件夹并从该文件夹运行脚本。但是当我这样运行脚本时
import urllib2
print(urllib2.urlopen('https://test.domain.ru/').read())
我仍然有错误
urllib2.URLError: <urlopen error [Errno 1] _ssl.c:501: error:140920F8:SSL routines:SSL3_GET_SERVER_HELLO:unknown cipher returned>
我应该怎么做才能强制python使用新的OpenSSL(gost引擎),可能有什么简单的方法可以做到这一点?
操作系统:Linux Mint 17 x64