• <i id='gLt4d'><tr id='gLt4d'><dt id='gLt4d'><q id='gLt4d'><span id='gLt4d'><b id='gLt4d'><form id='gLt4d'><ins id='gLt4d'></ins><ul id='gLt4d'></ul><sub id='gLt4d'></sub></form><legend id='gLt4d'></legend><bdo id='gLt4d'><pre id='gLt4d'><center id='gLt4d'></center></pre></bdo></b><th id='gLt4d'></th></span></q></dt></tr></i><div id='gLt4d'><tfoot id='gLt4d'></tfoot><dl id='gLt4d'><fieldset id='gLt4d'></fieldset></dl></div>

        <small id='gLt4d'></small><noframes id='gLt4d'>

      1. <legend id='gLt4d'><style id='gLt4d'><dir id='gLt4d'><q id='gLt4d'></q></dir></style></legend>
          <bdo id='gLt4d'></bdo><ul id='gLt4d'></ul>

      2. <tfoot id='gLt4d'></tfoot>

        ssl.get_server_certificate 用于具有 SNI(服务器名称指示)的站点

        时间:2023-11-07
            <bdo id='lScCh'></bdo><ul id='lScCh'></ul>
            1. <i id='lScCh'><tr id='lScCh'><dt id='lScCh'><q id='lScCh'><span id='lScCh'><b id='lScCh'><form id='lScCh'><ins id='lScCh'></ins><ul id='lScCh'></ul><sub id='lScCh'></sub></form><legend id='lScCh'></legend><bdo id='lScCh'><pre id='lScCh'><center id='lScCh'></center></pre></bdo></b><th id='lScCh'></th></span></q></dt></tr></i><div id='lScCh'><tfoot id='lScCh'></tfoot><dl id='lScCh'><fieldset id='lScCh'></fieldset></dl></div>

                <tbody id='lScCh'></tbody>

                <tfoot id='lScCh'></tfoot>

                <small id='lScCh'></small><noframes id='lScCh'>

                  <legend id='lScCh'><style id='lScCh'><dir id='lScCh'><q id='lScCh'></q></dir></style></legend>
                  本文介绍了ssl.get_server_certificate 用于具有 SNI(服务器名称指示)的站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试获取 badssl.com 子域的服务器证书(例如 https://expired.badssl.com).

                  I am trying to get the server certificate of badssl.com subdomains (ex. https://expired.badssl.com).

                  import ssl
                  ssl.get_server_certificate(('expired.badssl.com', 443))
                  

                  但是在检查上面生成的证书时,我看到证书有

                  But when examining the above generated certificate I see that the certificate has

                  身份:badssl-fallback-unknown-subdomain-or-no-sni

                  Identity: badssl-fallback-unknown-subdomain-or-no-sni

                  这意味着 SNI 失败.如何获取 badssl.com 不同子域的服务器证书?(我使用的是python 2.7.12)

                  which means SNI is failing. How can I get the server certificate of different subdomains of badssl.com? (I am using python 2.7.12)

                  推荐答案

                  找到答案了.

                  import ssl
                  hostname = "expired.badssl.com"
                  port = 443
                  conn = ssl.create_connection((hostname, port))
                  context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
                  sock = context.wrap_socket(conn, server_hostname=hostname)
                  certificate = ssl.DER_cert_to_PEM_cert(sock.getpeercert(True))
                  

                  这篇关于ssl.get_server_certificate 用于具有 SNI(服务器名称指示)的站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:NLTK 下载 SSL:证书验证失败 下一篇:请求:cert 和 verify 有什么区别?

                  相关文章

                • <small id='tqzXj'></small><noframes id='tqzXj'>

                  1. <legend id='tqzXj'><style id='tqzXj'><dir id='tqzXj'><q id='tqzXj'></q></dir></style></legend>

                      <bdo id='tqzXj'></bdo><ul id='tqzXj'></ul>
                  2. <i id='tqzXj'><tr id='tqzXj'><dt id='tqzXj'><q id='tqzXj'><span id='tqzXj'><b id='tqzXj'><form id='tqzXj'><ins id='tqzXj'></ins><ul id='tqzXj'></ul><sub id='tqzXj'></sub></form><legend id='tqzXj'></legend><bdo id='tqzXj'><pre id='tqzXj'><center id='tqzXj'></center></pre></bdo></b><th id='tqzXj'></th></span></q></dt></tr></i><div id='tqzXj'><tfoot id='tqzXj'></tfoot><dl id='tqzXj'><fieldset id='tqzXj'></fieldset></dl></div>
                      <tfoot id='tqzXj'></tfoot>