使用libcurl的SSL证书固定 [英] SSL certificate pinning with libcurl
问题描述
我想知道这个例子是否足以提供libcurl的证书固定:
http://curl.haxx.se/libcurl/c/cacertinmem.html
因为我发现curl也允许 http://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html p>
由于我将使用自签名证书,并且只信任它,我不知道是否真的需要pinn它。
resume:如果我只是将证书(自签名)添加到x509证书存储中,连接是否会被破坏?我需要添加额外的支票吗?我需要使用CURLOPT_PINNEDPUBLICKEY选项吗?
谢谢。
您可以在git 2.8(2016年3月)中实现新的curl选项的另一个示例:
请参阅 commit aeff8a6 (2016年2月15日)由 Christoph Egger ( siccegge
)。
(合并者为 gitster e79112d21024beb997951381db21a70b087d459drel =nofollow> commit e79112d ,2016年2月24日)
http
:implement public key pinning
添加
http.pinnedpubkey
公钥锁定。它允许libcurl
-base64(sha256(pubkey))
或
如果cURL不支持固定(太旧),则会向用户输出警告。
http.pinnedpubkey:
https服务的公开金钥。
它可以是PEM或DER编码的公钥文件的文件名,也可以是以'sha256 //
'开头的字符串,后跟base64编码的sha256公钥的散列。
另请参见 libcurl'CURLOPT_PINNEDPUBLICKEY'。
$ b $如果设置了此选项但cURL不支持git,则git将退出并显示错误。
I'd like to know if this example is enough to provide certificate pinning with libcurl: http://curl.haxx.se/libcurl/c/cacertinmem.html
because I have found that curl also allows http://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html
Since I'll be using a self-signed certificate and only trust on it I don't know if it's truly necessary to pinn it too.
resume: Can the connection be compromised if I only add my certificate (self-signed) to the x509 certificate store like the example? do I need to add extra checks? do I need to use the CURLOPT_PINNEDPUBLICKEY option?
Thanks.
You can find another example in the implementation of the new curl option in git 2.8 (March 2016):
See commit aeff8a6 (15 Feb 2016) by Christoph Egger (siccegge
).
(Merged by Junio C Hamano -- gitster
-- in commit e79112d, 24 Feb 2016)
http
: implement public key pinningAdd the
http.pinnedpubkey
configuration option for public key pinning. It allows any string supported bylibcurl
--base64(sha256(pubkey))
orfilename
of the full public key.If cURL does not support pinning (is too old) output a warning to the user.
The git config
man page mentions:
http.pinnedpubkey:
Public key of the https service.
It may either be the filename of a PEM or DER encoded public key file or a string starting with 'sha256//
' followed by the base64 encoded sha256 hash of the public key. See also libcurl 'CURLOPT_PINNEDPUBLICKEY'.
git will exit with an error if this option is set but not supported by cURL.
这篇关于使用libcurl的SSL证书固定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!