Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Fix RSA keyfile open mode (rb) for python3 (#141) #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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