未为TLS v1.2选择OpenSSL 1.1.1e RC4-MD5密码

问题描述 投票:0回答:1

我一直面临无法在客户端hello tls协议层中发送RC4-MD5密码的问题。我当前的代码使用curl SSL CTX CALLBACK。

您可以在下面看到我的代码。...在这里没什么花哨的,但是最后一个密码没有在客户端中问好我的tls协议是http1.0,tlsv1.2,我使用弱密码选项编译了openssl(并且适用于DES密码)

 CURLcode sslctxfun(CURL *curl, void *sslctx, void *parm)
{
  sslctxparm *p = (sslctxparm *) parm;
  SSL_CTX *ctx = (SSL_CTX *) sslctx;

  int ret;
  SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION);
  SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION);
  ret=SSL_CTX_set_cipher_list(ctx, "AES256-SHA256,AES128-SHA256,AES256-SHA,AES128-SHA,DES-CBC3-SHA,RC4-SHA,RC4-MD5");
.....
  SSL_CTX_set_options(ctx, SSL_OP_ALL);
  SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET);
  SSL_CTX_set_options(ctx, SSL_OP_NO_ENCRYPT_THEN_MAC);
  SSL_CTX_set_options(ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
  SSL_CTX_set_options(ctx,SSL_OP_NO_RENEGOTIATION);
  SSL_CTX_set_options(ctx, SSL_OP_TLS_ROLLBACK_BUG );
  SSL_CTX_set_options(ctx, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS );
  SSL_CTX_set_options(ctx, SSL_OP_NO_COMPRESSION );
  SSL_CTX_set_options(ctx, SSL_OP_LEGACY_SERVER_CONNECT );
  SSL_CONF_CTX *cctx;
  cctx = SSL_CONF_CTX_new();
  SSL_CONF_CTX_set_flags(cctx, SSL_CONF_FLAG_FILE);
  SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
  ret=SSL_CONF_cmd(cctx, "SignatureAlgorithms", "RSA+SHA256:RSA+SHA512:RSA+SHA384:RSA+SHA1");
....
}
c openssl libcurl libssl
1个回答
0
投票

该密码套件在默认的OpenSSL安全级别(级别1)中不可用。您需要指示它使用安全级别0。一种方法是将,@SECLEVEL=0添加到密码套件列表的末尾:

ret=SSL_CTX_set_cipher_list(ctx, "AES256-SHA256,AES128-SHA256,AES256-SHA,AES128-SHA,DES-CBC3-SHA,RC4-SHA,RC4-MD5,@SECLEVEL=0");

或者,您也可以使用SSL_CTX_set_security_level()进行设置。请参见手册页以获取有关级别的描述:

https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_security_level.html

© www.soinside.com 2019 - 2024. All rights reserved.