我已经过去了,让我的一个朋友看看它。在这一点上,我们都很难过,并希望得到一些帮助。
import os
import socket
import ssl
HSM = raw_input('Please enter the IP address of the machine you are connecting to.')
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sslSocket = ssl.wrap_socket(sock,
keyfile="AKMClientPrivateKey.pem",
certfile="AKMClientSignedCert.pem",
ca_certs="TCASelfSignedCert.pem",
cert_reqs=ssl.CERT_REQUIRED)
sslSocket.connect(('192.168.160.128', 6000))
print "Connection is successful!"
我将所有的密钥和证书都引用到与我的python文件相同的文件夹中 我已经仔细检查了IP地址和端口。
Traceback (most recent call last):
File "connect.py", line 12, in <module>
sslSocket.connect(['192.168.160.128', 6000])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 333, in connect
self._real_connect(addr, False)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 314, in _real_connect
self.ca_certs, self.ciphers)
ssl.SSLError: [Errno 336265218] _ssl.c:351: error:140B0002:SSL
例程:SSL_CTX_use_PrivateKey_file:system lib