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

Glyph Lefkowitz glyph at twistedmatrix.com
Tue Feb 14 23:54:42 MST 2017


> On Feb 2, 2017, at 2:00 AM, Adi Roiban <adi at 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



More information about the Twisted-Python mailing list