from OpenSSL import SSL
import sys, os, select, socket
cudp = SSL.Context(SSL.DTLSv1_METHOD)
错误:属性错误: '模块' 对象有没有属性 'DTLSv1_METHOD'
Attribute Error: 'module' object has no attribute 'DTLSv1_METHOD'
的Python 2.7.6
OpenSSL的1.1.0e
from OpenSSL import SSL
import sys, os, select, socket
cudp = SSL.Context(SSL.DTLSv1_METHOD)
错误:属性错误: '模块' 对象有没有属性 'DTLSv1_METHOD'
Attribute Error: 'module' object has no attribute 'DTLSv1_METHOD'
的Python 2.7.6
OpenSSL的1.1.0e
Attribute Error: 'module' object has no attribute 'DTLSv1_METHOD'
我不知道Python提供了什么,但让我告诉你OpenSSL正在做什么。从下面,也许你可以试试DTLS_method
,DTLS_server_method
或DTLS_client_method
。
OpenSSL的GitHub上:
$ git clone https://github.com/openssl/openssl.git
$ cd openssl
OpenSSL的1.1.0(主尖):
$ git checkout master -f
$ grep -IR DTLS * | grep METHOD | grep ssl.h
...
include/openssl/ssl.h:# ifndef OPENSSL_NO_DTLS1_METHOD
include/openssl/ssl.h:# ifndef OPENSSL_NO_DTLS1_METHOD
include/openssl/ssl.h:DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_method(void)) /* DTLSv1.0 */
include/openssl/ssl.h:DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_server_method(void)) /* DTLSv1.0 */
include/openssl/ssl.h:DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_client_method(void)) /* DTLSv1.0 */
include/openssl/ssl.h:# ifndef OPENSSL_NO_DTLS1_2_METHOD
include/openssl/ssl.h:DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_method(void)) /* DTLSv1.2 */
include/openssl/ssl.h:DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_server_method(void)) /* DTLSv1.2 */
include/openssl/ssl.h:DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *DTLSv1_2_client_method(void)) /* DTLSv1.2 */
include/openssl/ssl.h:__owur const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */
include/openssl/ssl.h:__owur const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */
include/openssl/ssl.h:__owur const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */
和OpenSSL 1.0.2:
$ git checkout OpenSSL_1_0_2-stable
$ grep -IR DTLS * | grep METHOD | grep ssl.h
ssl/ssl.h:const SSL_METHOD *DTLSv1_method(void); /* DTLSv1.0 */
ssl/ssl.h:const SSL_METHOD *DTLSv1_server_method(void); /* DTLSv1.0 */
ssl/ssl.h:const SSL_METHOD *DTLSv1_client_method(void); /* DTLSv1.0 */
ssl/ssl.h:const SSL_METHOD *DTLSv1_2_method(void); /* DTLSv1.2 */
ssl/ssl.h:const SSL_METHOD *DTLSv1_2_server_method(void); /* DTLSv1.2 */
ssl/ssl.h:const SSL_METHOD *DTLSv1_2_client_method(void); /* DTLSv1.2 */
ssl/ssl.h:const SSL_METHOD *DTLS_method(void); /* DTLS 1.0 and 1.2 */
ssl/ssl.h:const SSL_METHOD *DTLS_server_method(void); /* DTLS 1.0 and 1.2 */
ssl/ssl.h:const SSL_METHOD *DTLS_client_method(void); /* DTLS 1.0 and 1.2 */
您可以找到OpenSSL手册网页。
嗨..没有仍然没有工作,我试过DTLS_method,DTLS_server_method或DTLS_client_method仍然是相同的 – mwweb
你为什么认为'SSL.DTLSv1_METHOD'是一件事情? – user2357112
@ user2357112 https://gist.github.com/manuels/8852953 – mwweb
它看起来不像代码实际工作。第一个评论是一些人说他们很确定它不起作用。 [docs](http://www.pyopenssl.org/en/stable/api/ssl.html)或[pyopenssl的GitHub存储库](https://github.com/pyca/pyopenssl/)中不会出现此类内容搜索?UTF8 =%E2%9C%93&q = DTLSv1_METHOD)。 – user2357112