Skip to content

Commit

Permalink
Ensure private_key is a bytes object if str passed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Walker committed Feb 23, 2016
1 parent b627400 commit ecf6063
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions requests_chef/mixlib_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ def load_pem(cls, private_key, password=None):
if os.path.isfile(maybe_path):
with open(maybe_path, 'rb') as pkf:
private_key = pkf.read()
if not isinstance(private_key, six.binary_type):
private_key = private_key.encode('utf-8')

pkey = serialization.load_pem_private_key(
private_key,
password=password,
Expand Down

0 comments on commit ecf6063

Please sign in to comment.