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

pkey: shared implementation of __hash__() and __str__() #114

Merged
merged 3 commits into from
Dec 9, 2021

Conversation

ploxiln
Copy link
Owner

@ploxiln ploxiln commented Dec 6, 2021

Just use asbytes() in __hash__() for simplicity.

For python3, __str__() would raise exceptions for most
key types, and was uselessly mangled for RSAKey. Make it
return a string with type and fingerprint.
(Keep old behavior for python2: public key bytes.)

fixes paramiko#853

Just use `asbytes()` in `__hash__()` for simplicity.

For python3, `__str__()` would raise exceptions for most
key types, and was uselessly mangled for RSAKey. Make it
return a string with type and fingerprint.
(Keep old behavior for python2: public key bytes.)

fixes paramiko#853
@ploxiln ploxiln force-pushed the pkey_hash_str branch 2 times, most recently from 2fe8989 to e2d4771 Compare December 8, 2021 05:42
... more similar to how all other pkey classes work
(but still not exactly the same).

Also always set verifying_key in __init__(), simplifies a bit.

Slightly refactor awkward _decode_key() data argument in the
other pkey subclasses too.
@ploxiln ploxiln merged commit a3d7f51 into master Dec 9, 2021
ploxiln added a commit that referenced this pull request Dec 9, 2021
Just use `asbytes()` in `__hash__()` for simplicity.

For python3, `__str__()` would raise exceptions for most
key types, and was uselessly mangled for RSAKey. Make it
return a string with type and fingerprint.
(Keep old behavior for python2: public key bytes.)

fixes paramiko#853

backport of 30a09ce from #114
(but using md5 fingerprint instead of sha256)
ploxiln added a commit that referenced this pull request Dec 9, 2021
For python3, `__str__()` would raise exceptions for most
key types, and was uselessly mangled for RSAKey. Make it
return a string with type and fingerprint.
(Keep old behavior for python2: public key bytes.)

Also give AgentKey a __hash__() implementation.

fixes paramiko#853

partial backport of 30a09ce from #114
(but need to inline sha256-base64 fingerprint style)
ploxiln added a commit that referenced this pull request Dec 9, 2021
For python3, `__str__()` would raise exceptions for most
key types, and was uselessly mangled for RSAKey. Make it
return a string with type and fingerprint.
(Keep old behavior for python2: public key bytes.)

Also give AgentKey a __hash__() implementation.

fixes paramiko#853

partial backport of 30a09ce from #114
(but need to inline sha256-base64 fingerprint style)
ploxiln added a commit that referenced this pull request Jan 4, 2022
bug introduced by #106 (79da092)
and fixed for python3 in #114 (30a09ce)
ploxiln added a commit that referenced this pull request Jan 4, 2022
bug introduced by #106 (79da092)
and fixed for python3 in #114 (30a09ce)
ploxiln added a commit that referenced this pull request Jan 6, 2022
bug introduced by #106 79da092
and fixed for python3 in #114 30a09ce
@ploxiln ploxiln deleted the pkey_hash_str branch July 27, 2022 06:36
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.

TypeError: __str__ returned non-string (type bytes)
1 participant