• <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(服务器名称指示)的站点

        ssl.get_server_certificate for sites with SNI (Server Name Indication)(ssl.get_server_certificate 用于具有 SNI(服务器名称指示)的站点)
            <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(服务器名称指示)的站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)

                • <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>
                            <tbody id='tqzXj'></tbody>
                        • <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>