Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor change to sshkey_paramiko.r2py. Replaced decode() with decode_next() #192

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 4 additions & 5 deletions sshkey_paramiko.r2py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class _sshkey_paramiko_BER(object):

<Example Use>
ber_obj _sshkey_paramiko_BER(data)
list = ber_obj.decode()
list = ber_obj.decode_next()

"""

Expand All @@ -94,9 +94,8 @@ class _sshkey_paramiko_BER(object):
def __init__(self, content=''):
self.content = content
self.idx = 0

def decode(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to add a comment to explain why you changed this. The reason is that at some point in the future, if we want to re-port the Paramiko library, we should know why this edit was done.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment. I added a simple explanation to where the decode function was. Is this okay?

return self.decode_next()

# Removed decode function, as it is not allowed by safe.py

def decode_next(self):
if self.idx >= len(self.content):
Expand Down Expand Up @@ -373,7 +372,7 @@ def _sshkey_paramiko_read_private_key(tag, openfile, password=None):
# private key file contains:
# keylist = { version = 0, n, e, d, p, q, d mod p-1, d mod q-1, q**-1 mod p }
try:
keylist = _sshkey_paramiko_BER(keydata).decode()
keylist = _sshkey_paramiko_BER(keydata).decode_next()
except sshkey_paramiko_BERException:
raise sshkey_paramiko_SSHException('Unable to parse key file')

Expand Down