trevp/tlslite

s is not a string, but .find() is applied to it several times

amsimms opened this issue · 2 comments

start = s.find("-----BEGIN ")

s is not a string, in order to be searched with find() it needs to be converted, e.g.:

ss = str(s,'utf-8')

and then various searches become ss.find, ss.startswith, etc.

Line 106 is potentially problematic even with this fix:

s = s[start:]

since start is effectively a character count.

it's the responsibility of the caller to provide str to the method, see tls.py L134-140

Unfortunately other code paths that end up calling this function insist on s being a byte oriented structure. But as you say, tlslite-ng works great and resolves this issue completely. Thanks for the response.