[Twisted-Python] Re: Possible bug on twisted.conch.ssh.keys?

Adriano Marques py.adriano at gmail.com
Tue Jul 29 05:30:36 EDT 2008


Hi Andrew,

On Mon, Jul 28, 2008 at 9:00 PM, Andrew Bennetts
<andrew-twisted at puzzling.org> wrote:
> Adriano Marques wrote:
> [...]
>> <debug>
>> >>> print m2[0] == M
>> False
>> >>> print m2[0]
>> 5486124068793688683255936251187209270074392635932332070112001988456197381759672947165175699536362793613284725337872111744958183862744647903224103718245670299614498700710006264535590197791934024641512541262359795191593456970905950167587431434979106624455856690274067852326335446193014962274187407641892263
>> >>> print M
>> 5486124068793688683255936251187209270074392635932332070112001988456197381759672947165175699536362793613284725337872111744958183862744647903224103718245670299614498700710006264535590197791934024641512541262359795191593456970905950167587431434979106624455857062955565129940502062033292313613058888050118445
>> >>> print type(m2[0]), type(M)
>> <type 'long'> <type 'long'>
>> </debug>
>
> Suspiciously, they only differ in the last 50 or so decimal digits.  That
> suggests a bug in the way they are being read, maybe?

Thanks for your response! Yes, I thought it was very strange that they
only differed in the last digits. It took me a while to figure that
out, mainly because in the debuger I couldn't see that last digits
properly.

Well, maybe the way I'm storing the keys? Is this the correct format?

<keys>
PUBKEY = "ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAAAgQD3n4sYqbdnlVyvy2SRUmQ5HJg2NDHyC0m4FIykDygXW2PTcSHU/Jany95D54qAEkUra0KHk94KvyGhNVYXqPmzPLu4onlr0Y/gQzEsIy15jDGjMWVCX/8+PQJxMYObSKs8U1o/h5fDNeKQs4bZbrm+35eT/Kvyerqa6ab5OsIEnQ=="

PRIVKEY = """-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQD3n4sYqbdnlVyvy2SRUmQ5HJg2NDHyC0m4FIykDygXW2PTcSHU
/Jany95D54qAEkUra0KHk94KvyGhNVYXqPmzPLu4onlr0Y/gQzEsIy15jDGjMWVC
X/8+PQJxMYObSKs8U1o/h5fDNeKQs4bZbrm+35eT/Kvyerqa6ab5OsIEnQIDAQAB
AoGAK2MWASVDkG+4RMkTfu77xpH/DYhJtApMSWe4WMqbELSfoh2xetsjHpV3BVjd
iKEq43ewuYasIh/pKZDp281sqqXdg9VI9ZW7kB00FhO2wA4emCIVj6CHMl1K9NrU
9Spy40garaYnDdud79SnKtxlKQEALOwCpTEcrjGOLBTbirUCQQD/FkP1zhpOSaOy
B32CiC13W5fFfREzBxzQ3Med1i1OYtFfBEdJqv/Z7APadNN8ySI3r+UAfGatTzJI
zbiSZ2fHAkEA+IJwWpw6d8R3t7+8UgTrqdsZhLRdidO0cHcIFcnU/QYZg+iw3F+q
Tuz/mngpfb5214r8zwcwlNzsC4+fyOOYewJBAMPstRw6Rog1FW8rQ6Kbt9hCWItO
aYR5BRADU6sOk1PuoIPLhHm3xrX6CmejbcEdt5NwHYNHCZI6DxRONmL024cCQBky
eJvnXVJJfG4IJdsXHqIBUiwPcbCI47HHj+1NoqfpF2s1i8E8ffM0upH5/xL93eTq
9ck0DGv7nn9pl6Tx1sMCQCWZbWDnmEdsSoNUQZ8fyQEDoZ/2gUP+R2/WpLikwmSA
41n7cUONVthIYOZw0qQPP//PyPtMVxcYT76D5QACEK8=
-----END RSA PRIVATE KEY-----"""
</keys>

I was researching the matter, and then I saw in the Twisted book that
I should use base64.decode in order to compare the key with the
credential.blob, but when I do that the key doesn't look the same when
compared to the blob and the authentication fails. So, maybe I may be
sending the key the wrong way, but I don't have a clue of what is the
right way.

> As to your problems using un-deprecated APIs, a wild guess is that maybe your
> PyCrypto version is too old?

I think it is not the case. I have the latest one:
>>> Crypto.__version__
'2.0.1'

I'm running on a Mac OS X Leopard, if that may help you to help me ;-)
Thanks for the help!


Kind Regards,

-- 
Adriano Monteiro Marques

http://adriano-marques.blogspot.com
http://umit.sourceforge.net
py.adriano at gmail.com

"Don't stay in bed, unless you can make money in bed." - George Burns




More information about the Twisted-Python mailing list