New submission from INADA Naoki <songofaca...@gmail.com>:

Current DER_cert_to_PEM_cert() uses textwrap like this:

    def DER_cert_to_PEM_cert(der_cert_bytes):
        """Takes a certificate in binary DER format and returns the
        PEM version of it as a string."""

        f = str(base64.standard_b64encode(der_cert_bytes), 'ASCII', 'strict')
        return (PEM_HEADER + '\n' +
                textwrap.fill(f, 64) + '\n' +
                PEM_FOOTER + '\n')

But textwrap is designed to break lines at word boundary.
So textwrap.fill for base64 text may be slow.

And `import textwrap` is little slow too.

We can use simple slicing instead of textwrap.

----------
messages: 303505
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: ssl module should not use textwrap for wrapping PEM format.

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31659>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to