fix bytes vs str issues in certificate.py