[Twisted-Python] conch.ssh.SSHFactory publicKeys and getPublicKeys

Hi,
I am writing to ask about the reason why t.conch.ssh.Factory has both the getPublicKeys and getPrivateKeys methods ?
The public keys should be string while private keys should be twisted.conch.ssh.keys.Key
Based on my understanding if you have a private key object you can extract the public key from it.
Are there any SSH key formats which will store a private key without the public components ?
Or this is just a legacy code from the time when twisted.conch.ssh.keys.Key was not there... and getPublicKeys should be deprecated?
Thanks!

On Feb 2, 2017, at 2:00 AM, Adi Roiban adi@roiban.ro wrote:
Hi,
I am writing to ask about the reason why t.conch.ssh.Factory has both the getPublicKeys and getPrivateKeys methods ?
As with most things in Conch, the structure of these APIs was probably developed many years ago without any specific thought to how they would be exposed as a public API, and instead were just set up to make implementing the protocol logic more convenient.
The public keys should be string while private keys should be twisted.conch.ssh.keys.Key
By "should be" you mean "is"?
Based on my understanding if you have a private key object you can extract the public key from it.
Yes, via Key.public().
Are there any SSH key formats which will store a private key without the public components ?
I don't think that's possible?
Or this is just a legacy code from the time when twisted.conch.ssh.keys.Key was not there... and getPublicKeys should be deprecated?
Rather than thinking of this as "getPublicKeys should be deprecated", the first thing to work on would be "what's the right structure for this"? How would you prefer this be exposed as an interface?
-glyph
participants (2)
-
Adi Roiban
-
Glyph Lefkowitz