我已经使用 Jetty 和 SSL 设置了服务器。我对客户端和服务器使用自签名服务器证书。当我尝试使用 wget 访问它时,一切都正常。当我尝试使用 curl 访问它时,问题出现了:
$ curl -k --cert ./mycert-001.pem --key ./mykey-001.pem https://****:9994/rest/list --verbose
* About to connect() to server port 9994 (#0)
* Trying ****...
* Connected to server(****) port 9994 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* NSS: client certificate from file
* subject: CN=foo,OU=bar,O=baz,L=Default City,C=US
* start date: Nov 29 18:50:58 2016 GMT
* expire date: Nov 29 18:50:58 2019 GMT
* common name: foo
* issuer: CN=foo,OU=bar,O=baz,L=Default City,C=US
Segmentation fault
然后当我尝试使用 wget 时:
$ wget --certificate=mycert-001.pem --private-key=mykey-001.pem --no-check-certificate --auth-no-challenge https://****:9994/rest/list
--2017-04-14 15:50:20-- https://****:9994/rest/list
Resolving **** (****)... *****
Connecting to ***** (****)|****|:9994... connected.
WARNING: cannot verify ****'s certificate, issued by ‘/C=US/ST=FOO/L=Default/O=FOO/OU=FOO/CN=FOO’:
Self-signed certificate encountered.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: ‘list.5’
[ <=> ] 58 --.-K/s in 0s
2017-04-14 15:50:20 (3.47 MB/s) - ‘list.5’ saved [58]
我是否缺少 curl 上的一个选项来让它工作?