from OpenSSL import SSL
import sys, os, select, socket
cudp = SSL.Context(SSL.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 */
您可以在 docs/manpages.html 找到 OpenSSL 手册页。 .
关于python - 属性错误 : 'module' object has no attribute 'DTLSv1_METHOD' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42352810/