[Twisted-Python] conch problem with ecdsa-sha2-nistp256 host key?

Craig Rodrigues rodrigc at crodrigues.org
Fri Dec 2 13:49:50 MST 2016


On Fri, Dec 2, 2016 at 9:18 AM, Craig Rodrigues <rodrigc at crodrigues.org>
wrote:

>
> Traceback (most recent call last):
>
>
>   File "<pudb command line>", line 1, in <module>
>   File "/Users/crodrigues/twisted8/src/twisted/conch/ssh/keys.py", line
> 787, in __repr__
>     self._keyObject.key_size)]
>
> AttributeError: '_EllipticCurvePublicKey' object has no attribute
> 'key_size'
>
>
This seems to be the problem.

On this line:
https://github.com/twisted/twisted/blob/trunk/src/twisted/conch/ssh/keys.py#L782
the __repr__() function wants to call the key_size() method.

This seems to exist for DSA and RSA keys:
https://github.com/pyca/cryptography/blob/master/src/cryptography/hazmat/backends/openssl/dsa.py#L232
https://github.com/pyca/cryptography/blob/master/src/cryptography/hazmat/backends/openssl/rsa.py#L482

However for EC keys, I do not see a 'key_size' attribute:
https://github.com/pyca/cryptography/blob/master/src/cryptography/hazmat/backends/openssl/ec.py#L256

When trying to compare the known host key, the code tries to do a
__repr__() and it fails,
so this doesn't seem to work with EC keys.

--
Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20161202/c4acb5a7/attachment-0002.html>


More information about the Twisted-Python mailing list