我使用 M2Crypto,客户端和服务器都添加了 key 和证书,没有权限!!! 现在我发现该字段 Common Name 应该设置为 domain 或任何东西,只要它在两边是相同的。 如果 key 没有与其 ip 相同的 Common Name 字段,当 python 脚本是 sun 时,我会遇到问题,它将无法工作。 machine ip和Common Name字段之间有什么联系',因为我没有使用权限吗?
最佳答案
您可能对 this answer 感兴趣我给了一个类似的问题:
应如何进行主机名验证在 RFC 6125 中定义,这是最近的并将实践推广到所有协议(protocol),并取代了 RFC 2818 ,这是特定于 HTTPS 的。 (我什至不确定 Java 7 使用 RFC 6125,这可能太新了。)
If a subjectAltName extension of type dNSName is present, that MUST be used as the identity. Otherwise, the (most specific) Common Name field in the Subject field of the certificate MUST be used. Although the use of the Common Name is existing practice, it is deprecated and Certification Authorities are encouraged to use the dNSName instead.
[...]
In some cases, the URI is specified as an IP address rather than a hostname. In this case, the iPAddress subjectAltName must be present in the certificate and must exactly match the IP in the URI.
本质上(至少对于 HTTPS,但这也被推广到其他协议(protocol)),您并不打算将 IP 地址放在主题 DN 的通用名称中,它应该放在 IP 主题备用名称条目中。 (一些浏览器对此非常灵活。)
关于python - M2Crypto Common Name字段和ip关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9604935/