Skip to content

Commit

Permalink
Fix RSA keyfile open mode (rb) for python3 (google#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeleong committed Dec 11, 2018
1 parent d9b94b2 commit 3338e6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion adb/sign_m2crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class M2CryptoSigner(adb_protocol.AuthSigner):
"""AuthSigner using M2Crypto."""

def __init__(self, rsa_key_path):
with open(rsa_key_path + '.pub') as rsa_pub_file:
with open(rsa_key_path + '.pub', 'rb') as rsa_pub_file:
self.public_key = rsa_pub_file.read()

self.rsa_key = RSA.load_key(rsa_key_path)
Expand Down
4 changes: 2 additions & 2 deletions adb/sign_pythonrsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class PythonRSASigner(object):

@classmethod
def FromRSAKeyPath(cls, rsa_key_path):
with open(rsa_key_path + '.pub') as f:
with open(rsa_key_path + '.pub', 'rb') as f:
pub = f.read()
with open(rsa_key_path) as f:
with open(rsa_key_path, 'rb') as f:
priv = f.read()
return cls(pub, priv)

Expand Down

0 comments on commit 3338e6b

Please sign in to comment.