diff options
author | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2014-01-18 10:31:19 -0500 |
---|---|---|
committer | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2014-01-18 10:31:19 -0500 |
commit | 684baf568794aa8d0da5537a454f681334baf227 (patch) | |
tree | 847a2f7302edf1a1d0997abaf248562183cbec40 | |
parent | d86079859904fdbe70f1af496300b900d5458a6c (diff) | |
download | pyopenssl-684baf568794aa8d0da5537a454f681334baf227.tar.gz |
And use_certificate_file
-rw-r--r-- | OpenSSL/SSL.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py index fe13c4f..990a370 100644 --- a/OpenSSL/SSL.py +++ b/OpenSSL/SSL.py @@ -379,8 +379,11 @@ class Context(object): :param filetype: (optional) The encoding of the file, default is PEM :return: None """ + if isinstance(certfile, _text_type): + # Perhaps sys.getfilesystemencoding() could be better? + certfile = certfile.encode("utf-8") if not isinstance(certfile, bytes): - raise TypeError("certfile must be a byte string") + raise TypeError("certfile must be bytes or unicode") if not isinstance(filetype, int): raise TypeError("filetype must be an integer") |