Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有client exchange数据包 #4

Open
ygm521 opened this issue May 21, 2019 · 19 comments
Open

没有client exchange数据包 #4

ygm521 opened this issue May 21, 2019 · 19 comments

Comments

@ygm521
Copy link

ygm521 commented May 21, 2019

使用 nginx-1.13.12.tar.gz 结合openssl-1.1.1b。
stream {
upstream http_up {
server 127.0.0.1:80;
}

server {
	listen 443;
	proxy_pass   http_up;
	a_tls_certificate ../conf/mycert.pem;
	a_tls_certificate_key ../conf/mykey.pem;
	a_tls_sign_certificate ../conf/mycert_enc.pem;
	a_tls_sign_certificate_key ../conf/mykey_enc.pem;
}

}
没有client exchange数据包。谢谢!是openssl版本问题?

@mrpre
Copy link
Owner

mrpre commented May 21, 2019

可能是你证书有问题

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

@mrpre 方便加下qq? 464713256, 你知道有什么测试的cfca证书?我的证书是公司官网的,也是ecc_sm4_sm3加密套件。

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

我觉得应该是server key exchange数据包问题,我看正常的长度分别是77,73,使用gmssl库数据长度是78,74,使用你写的这个返回是4好像。

@mrpre
Copy link
Owner

mrpre commented May 21, 2019

你看看是不是搞反了签名证书和加密证书

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

stream {
upstream http_up {
server 127.0.0.1:80;
}

server {
	listen 443;
	proxy_pass   http_up;
	a_tls_sign_certificate ../conf/mycert.pem;
	a_tls_sign_certificate_key ../conf/mykey.pem;
	a_tls_certificate  ../conf/mycert_enc.pem;
	a_tls_certificate_key ../conf/mykey_enc.pem;
}

}
这样也不行! 使用你写的这个server key exchange返回数据长度是6, 2。最后报错:Decrypt error(51)

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

使用你的cert/下面的sm2证书,系统时间以及服务器的时间设置为17年11月也不行。没有client exchange数据包。
stream {
upstream http_up {
server 127.0.0.1:80;
}

    server {
            listen 443;
            proxy_pass   http_up;
		a_tls_certificate ../conf/sm2.pem;
		a_tls_certificate_key ../conf/sm2.key;
		a_tls_sign_certificate ../conf/sm2.pem;
		a_tls_sign_certificate_key ../conf/sm2.key;
    }

}

@mrpre
Copy link
Owner

mrpre commented May 21, 2019

是openssl版本的问题,1.1.1b对接口做了修改,需要适配一下

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

@mrpre 你之前是使用的 OpenSSL-1.1.1-pre3 版本?我和你保持一致试试,看看是不是证书的问题。

@mrpre
Copy link
Owner

mrpre commented May 21, 2019

适配好了,你重新下载源码试试。
记得编译 nginx 时带上 --with-openssl=/xxxx/

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

不错,谢谢

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

有个开源的 https://github.com/guanzhi/GmSSL 他使用的GmSSL 2.5.0 在OpenSSL 1.1.0d基础上修改的,你可以使用如下配置,也是遇到client exchange最后报错:Decrypt error(51),您有时间可以调调。下面是直接http{}配置中的。我对比OpenSSL 1.1.0d和openssl-1.1.1b,修改挺多的。
server {
listen 443 ssl;
#server_name localhost;

ssl on;
ssl_certificate      ../conf/mycert.pem;
ssl_certificate_key   ../conf/mykey.pem;
ssl_certificate     ../conf/mycert_enc.pem;
ssl_certificate_key   ../conf/mykey_enc.pem;

ssl_prefer_server_ciphers  on;   
ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         SM2-WITH-SMS4-SM3;

    location / {
        root   html;
        proxy_pass   http://192.168.66.10;
    }

}

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

@mrpre 你的atls实现参考哪些文档,可以推荐下?我目的想把你的这个移植到nginx的http{}处理中,谢谢

@mrpre
Copy link
Owner

mrpre commented May 21, 2019

@ygm521 没有文档。Nginx + GMSSL 不可能跑通。后续 Tengine 上会支持GMSSL。

@ygm521
Copy link
Author

ygm521 commented May 21, 2019

@mrpre Tengine有个开源的钉钉群 你在里面?叫什么?

@mrpre
Copy link
Owner

mrpre commented May 22, 2019

使用360浏览器也访问不了使用 GMSSL起的server,所以现在也没必要支持。等GMSSL完整的支持GMSSL1.1 后再考虑。

@ygm521
Copy link
Author

ygm521 commented Aug 9, 2019

@mrpre 我看 https://github.com/guanzhi/GmSSL 现在支持挺全的, 你看如何才能使用新版nginx和GmSSL整合 支持360安全浏览器访问?我可以配合你一起搞,主要我对国密不熟。

@wwwlkk
Copy link

wwwlkk commented Sep 16, 2019

我是使用tassl,nginx只要加几行代码就可以支持国密tls

@ygm521
Copy link
Author

ygm521 commented Sep 16, 2019

@wwwlkk 我在gmssl新版支持了

@wwwlkk
Copy link

wwwlkk commented Sep 17, 2019

gmssl里面有cntls的例子代码吗?我怎么没看到?双证书是怎么加载的?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants