_fromString_PRIVATE_OPENSSH fails with "ValueError: IV must be 8 bytes long"
|Reported by:||amtota||Owned by:||z3p|
branch-diff, diff-cov, branch-cov, buildbot
Here is the simplest test case I can come up with (after running ssh-keygen to get a new key):
python -c 'from twisted.conch.ssh import keys;keys.Key.fromFile("id_rsa", passphrase="yourpassphrase")'
Here is the stacktrace I get:
Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib64/python2.7/site-packages/twisted/conch/ssh/keys.py", line 62, in fromFile return Class.fromString(file(filename, 'rb').read(), type, passphrase) File "/usr/lib64/python2.7/site-packages/twisted/conch/ssh/keys.py", line 90, in fromString return method(data, passphrase) File "/usr/lib64/python2.7/site-packages/twisted/conch/ssh/keys.py", line 216, in _fromString_PRIVATE_OPENSSH keyData = DES3.new(decKey, DES3.MODE_CBC, iv).decrypt(b64Data) ValueError: IV must be 8 bytes long
I have confirmed this bug on Fedora 16, Windows with Twisted versions 11.x and 12.0. I believe this is a regression but it may not be (I haven't downgraded Twisted to verify), I haven't noticed until now because I was using the ssh-agent.. which takes care of providing the decrypted key.
Just in case it needs a special type of key file to trigger it, I will attach the one I have just generated.