summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--OpenSSL/SSL.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py
index 990a370..3570ffb 100644
--- a/OpenSSL/SSL.py
+++ b/OpenSSL/SSL.py
@@ -441,6 +441,10 @@ class Context(object):
:param filetype: (optional) The encoding of the file, default is PEM
:return: None
"""
+ if isinstance(keyfile, _text_type):
+ # Perhaps sys.getfilesystemencoding() could be better?
+ keyfile = keyfile.encode("utf-8")
+
if not isinstance(keyfile, bytes):
raise TypeError("keyfile must be a byte string")