M2Crypto 的 set_client_CA_list_from_file() 和 load_verify_info() 之间有什么区别?什么时候使用它们?

2024-02-28

The M2加密库 http://chandlerproject.org/bin/view/Projects/MeTooCrypto其上有一些与CA相关的功能SSL.Context 对象 http://www.heikkitoivonen.net/m2crypto/api/M2Crypto.SSL.Context'.Context-class.html,但是文档非常不清楚何时使用某些功能以及为什么。事实上,几乎所有这些的文档都是“将 CA 证书加载到上下文中”,因此它们似乎都做了相同的事情。

several http://www.heikkitoivonen.net/blog/2008/10/14/ssl-in-python-26/ examples http://www.cs.technion.ac.il/~danken/SecureXMLRPCServer.py两者都使用set_client_CA_list_from_file() and load_verify_info(),但还有其他类似的功能,例如load_client_ca() and load_verify_locations().

我正在编写客户端和服务器部分。我应该使用哪些功能以及为什么?他们具体是做什么的?

Edit:

查看代码我看到:

# Deprecated.
load_client_CA = load_client_ca = set_client_CA_list_from_file

and

# Deprecated.
load_verify_info = load_verify_locations

所以这有一点帮助。这将我们归结为两个函数:set_client_CA_list_from_file() and load_verify_locations()。但我仍然不能完全区分两者之间的区别。


如果您的服务器要求客户端提供证书,它可以通过指定调用的颁发者来限制谁是客户端证书的有效颁发者set_client_CA_list_from_file http://www.heikkitoivonen.net/m2crypto/api/M2Crypto.SSL.Connection%27.Connection-class.html#set_client_CA_list_from_file。这实际上是非常罕见的。

客户端通过调用指定谁是有效的服务器证书颁发者加载验证位置 http://www.heikkitoivonen.net/m2crypto/api/M2Crypto.SSL.Context%27.Context-class.html#load_verify_locations。几乎所有客户都应该这样做。

客户端和服务端都可以调用加载证书 http://www.heikkitoivonen.net/m2crypto/api/M2Crypto.SSL.Context%27.Context-class.html#load_cert设置自己的证书。服务器几乎总是应该这样做。仅当服务器要求客户端提供证书时,客户端才应该执行此操作。

我建议你选择一个副本OpenSSL 的网络安全作者:John Viega、Matt Messier 和 Pravir Chandra,ISBN 059600270X,应该更详细地阐明这些问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

M2Crypto 的 set_client_CA_list_from_file() 和 load_verify_info() 之间有什么区别?什么时候使用它们? 的相关文章

随机推荐