@@ -3316,26 +3316,28 @@ msgstr "一个表明内存 BIO 目前是否位于文件末尾的布尔值。"
33163316msgid ""
33173317"Read up to *n* bytes from the memory buffer. If *n* is not specified or "
33183318"negative, all bytes are returned."
3319- msgstr ""
3319+ msgstr "从内存缓冲区读取至多 *n* 个字节。 如果 *n* 未指定或为负值,则返回全部字节数据。 "
33203320
33213321#: ../../library/ssl.rst:2563
33223322msgid ""
33233323"Write the bytes from *buf* to the memory BIO. The *buf* argument must be an "
33243324"object supporting the buffer protocol."
3325- msgstr ""
3325+ msgstr "将字节数据从 *buf* 写入到内存 BIO。 *buf* 参数必须为支持缓冲区协议的对象。 "
33263326
33273327#: ../../library/ssl.rst:2566
33283328msgid ""
33293329"The return value is the number of bytes written, which is always equal to "
33303330"the length of *buf*."
3331- msgstr ""
3331+ msgstr "返回值为写入的字节数,它总是与 *buf* 的长度相等。 "
33323332
33333333#: ../../library/ssl.rst:2571
33343334msgid ""
33353335"Write an EOF marker to the memory BIO. After this method has been called, it"
33363336" is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will"
33373337" become true after all data currently in the buffer has been read."
33383338msgstr ""
3339+ "将一个 EOF 标记写入到内存 BIO。 在此方法被调用以后,再调用 :meth:`~MemoryBIO.write` 将是非法的。 属性 "
3340+ ":attr:`eof` will 在缓冲区当前的所有数据都被读取之后将变为真值。"
33393341
33403342#: ../../library/ssl.rst:2577
33413343msgid "SSL session"
@@ -3362,18 +3364,20 @@ msgid ""
33623364" hostname checking, and try to choose reasonably secure protocol and cipher "
33633365"settings."
33643366msgstr ""
3367+ "针对 **客户端使用**,如果你对于安全策略没有任何特殊要求,则强烈推荐你使用 :func:`create_default_context` "
3368+ "函数来创建你的 SSL 上下文。 它将加载系统的受信任 CA 证书,启用证书验证和主机名检查,并尝试合理地选择安全的协议和密码设置。"
33653369
33663370#: ../../library/ssl.rst:2607
33673371msgid ""
33683372"For example, here is how you would use the :class:`smtplib.SMTP` class to "
33693373"create a trusted, secure connection to a SMTP server::"
3370- msgstr ""
3374+ msgstr "例如,以下演示了你应当如何使用 :class:`smtplib.SMTP` 类来创建指向一个 SMTP 服务器的受信任且安全的连接:: "
33713375
33723376#: ../../library/ssl.rst:2616
33733377msgid ""
33743378"If a client certificate is needed for the connection, it can be added with "
33753379":meth:`SSLContext.load_cert_chain`."
3376- msgstr ""
3380+ msgstr "如果连接需要客户端证书,可使用 :meth:`SSLContext.load_cert_chain` 来添加。 "
33773381
33783382#: ../../library/ssl.rst:2619
33793383msgid ""
@@ -3382,6 +3386,8 @@ msgid ""
33823386"validation nor hostname checking enabled by default. If you do so, please "
33833387"read the paragraphs below to achieve a good security level."
33843388msgstr ""
3389+ "作为对比,如果你通过自行调用 :class:`SSLContext` 构造器来创建 SSL 上下文,它默认将不会启用证书验证和主机名检查。 "
3390+ "如果你这样做,请阅读下面的段落以达到良好的安全级别。"
33853391
33863392#: ../../library/ssl.rst:2625
33873393msgid "Manual settings"
@@ -3406,12 +3412,18 @@ msgid ""
34063412"check is automatically performed when :attr:`SSLContext.check_hostname` is "
34073413"enabled."
34083414msgstr ""
3415+ "当直接调用 :class:`SSLContext` 构造器时,默认会使用 :const:`CERT_NONE`。 "
3416+ "由于它不会验证对等方的身份真实性,因此是不安全的,特别是在客户端模式下,大多数时候你都希望能保证你所连接的服务器的身份真实性。 "
3417+ "因此,当处于客户端模式时,强烈推荐使用 :const:`CERT_REQUIRED`。 但是,光这样还不够;你还必须检查服务器证书,这可以通过调用 "
3418+ ":meth:`SSLSocket.getpeercert` 来获取并匹配目标服务。 对于许多协议和应用来说,服务可通过主机名来标识;在此情况下,可以使用"
3419+ " :func:`match_hostname` 函数。 这种通用检测会在 :attr:`SSLContext.check_hostname` "
3420+ "被启用时自动执行。"
34093421
34103422#: ../../library/ssl.rst:2643
34113423msgid ""
34123424"Hostname matchings is now performed by OpenSSL. Python no longer uses "
34133425":func:`match_hostname`."
3414- msgstr ""
3426+ msgstr "主机名匹配现在是由 OpenSSL 来执行的。 Python 不会再使用 :func:`match_hostname`。 "
34153427
34163428#: ../../library/ssl.rst:2647
34173429msgid ""
0 commit comments