summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Paul Calderone <exarkun@twistedmatrix.com>2014-01-18 10:31:19 -0500
committerJean-Paul Calderone <exarkun@twistedmatrix.com>2014-01-18 10:31:19 -0500
commit684baf568794aa8d0da5537a454f681334baf227 (patch)
tree847a2f7302edf1a1d0997abaf248562183cbec40
parentd86079859904fdbe70f1af496300b900d5458a6c (diff)
downloadpyopenssl-684baf568794aa8d0da5537a454f681334baf227.tar.gz
And use_certificate_file
-rw-r--r--OpenSSL/SSL.py5
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")