This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients methane
Date 2017-10-02.00:47:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1506905254.99.0.213398074469.issue31659@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-10-02 00:47:35methanesetrecipients: + methane
2017-10-02 00:47:34methanesetmessageid: <1506905254.99.0.213398074469.issue31659@psf.upfronthosting.co.za>
2017-10-02 00:47:34methanelinkissue31659 messages
2017-10-02 00:47:33methanecreate