cryptosign: reading private ssh key is broken
See original GitHub issueUsing this example but replacing a call to cryptosign.SigningKey.from_raw_key
with cryptosign.SigningKey.from_ssh_key
(as I had my private ssh key as a text file) fails, as there is an apparent bug out there, I narrowed it down to a simple test case below.
>>> from autobahn.wamp.cryptosign import SigningKey
>>> SigningKey.from_ssh_key('/home/om26er/.ssh/id_ed25519')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/autobahn/wamp/cryptosign.py", line 561, in from_ssh_key
keydata, comment = _read_ssh_ed25519_privkey(keydata)
File "/usr/local/lib/python3.5/dist-packages/autobahn/wamp/cryptosign.py", line 244, in _read_ssh_ed25519_privkey
raise Exception('invalid OpenSSH private key (padlen={}, actual_pad={}, expected_pad={})'.format(len(pad), pad, _makepad(len(pad))))
Exception: invalid OpenSSH private key (padlen=7, actual_pad=b'\x01\x02\x03\x04\x05\x06\x07', expected_pad=)
The hack was to comment out this condition. I believe we are making some assumptions there that may not be always correct.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How to Troubleshoot SSH Authentication Issues
This walkthrough covers the two most common: password and private/public key pair. Prerequisites to Troubleshooting SSH Issues.
Read more >Troubleshooting SSH Key Authentication | Linode
Learn the basics of SSH keys and how to troubleshoot the most common SSH permission issues in this short guide.
Read more >Is my private SSH key compromised if someone hacks my Wi-Fi?
Getting your private key would require that someone has the ability to read data off of your computer. If they're on your wifi...
Read more >Ubuntu 22.04 SSH the RSA key isn't working since upgrading ...
It seems this has happened for the ssh client in Ubuntu 22.04. The RSA public-private key pair is considered not safe any more....
Read more >wow classic item restore
If you are facing WOW Item Restoration Not Working then with this guide ... 5 changes to Legacy dungeons and raids, by swapping...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
autobahn.wamp.cryptosign._makepad
function doesn’t work properly in Python 3._makepad(6)
returns'\x01\x02\x03\x04\x05\x06'
(a str) rather thanb'\x01\x02\x03\x04\x05\x06'
(bytes). The str/bytes type difference causes thepad != _makepad(len(pad))
the statement to fail.My workaround is to monkey patch it:
This solution unfortunately does not work in Python2. To make it compatible with both, you’d need to do something like this:
(I would hope there is a cleaner-looking solution, but that seems to work.)
fixed via https://github.com/crossbario/autobahn-python/pull/1543
test: