Skip to content

fixing starting point of key for PKey._read_private_key_pem - #1615

Closed
htol wants to merge 1 commit into
paramiko:masterfrom
htol:pem_parsing
Closed

htol wants to merge 1 commit into
paramiko:masterfrom
htol:pem_parsing

Conversation

@htol

@htol htol commented Feb 4, 2020

Copy link
Copy Markdown

Hi!
When file key or variable with key not started directly from beginning of file we will get base64 padding error because we will not strip begging of key. Here is an example:
Context which comes to
[u'\n', u'-----BEGIN RSA PRIVATE KEY-----\n', u'<skipped key lines>\n', u'-----END RSA PRIVATE KEY-----\n']

As you can see there is empty line at beginning. Without fix there will be an error about base64 padding and data which was provided to data = decodebytes(b("".join(lines[start:end]))) at _read_private_key_pem() will be lokked like this.
[u'-----BEGIN RSA PRIVATE KEY-----\n', u'<skipped key lines>\n',]
As you can see there is obviously an error.

@htol
htol requested a review from bitprophet February 4, 2020 17:32
@ploxiln

ploxiln commented Feb 9, 2020

Copy link
Copy Markdown
Contributor

see also #1604 #1601 #1580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants