[Twisted-Python] Need SSH help

Bad_Bob TheBadBob at gmail.com
Wed Mar 2 09:21:44 MST 2005


Thanks, that worked!

One more question: 
How do I authenticate with public keys?

What I am trying to get this to do it to authenticate based on the public key, 
not based on the password.  The program will have a list of trusted public 
keys, and only allow those to connect.  They could use a password, but if 
they have the wrong public key, I don't want them to connect.

Thanks,
Bob

Am Mittwoch, 2. März 2005 21:00 schrieb Paul Swartz:
> On Wed, 2005-03-02 at 14:58 +0000, Bad_Bob wrote:
> >I am trying to write an encrypted P2P program (cryptic6.sourceforge.net).
> >
> >I am trying to understand twisted's ssh.  Thanks to the helpful people on
> >#twisted I have am able to get the twisted client to send messages to the
> >twisted server.  This works when I use the keys provided in the example.
> >However when I try to generate my own keys it always complains that they
> > are not password.
> >
> >This is the code I am using to generate public/private key pairs:
> >
> >twisted.scripts.ckeygen.generateRSAkey({'bits':1048,'filename':
> >os.path.join(os.path.expanduser('~'),'.cryptic6/keys'),'pass':pass)
> >
> >This is the error I get:
> >
> >2005/03/02 14:37 UTC [-] Log opened.
> >2005/03/02 14:37 UTC [-] Traceback (most recent call last):
> >2005/03/02 14:37 UTC [-]  File "sshsimpleserver.py", line 97, in ?
> >2005/03/02 14:37 UTC [-]    class ExampleFactory(factory.SSHFactory):
> >2005/03/02 14:37 UTC [-]  File "sshsimpleserver.py", line 101, in
> >ExampleFactory
> >2005/03/02 14:37 UTC [-]    privateKeys = {
>
> The problem is on the next line:
>         'ssh-rsa': keys.getPrivateKeyObject(data=privateKey)
>
> That means that getPrivateKeyObject doesn't expect the key to be
> encrypted.  If it is, you need to also pass in the passphrase kwarg with
> the passphrase.
>
> -p




More information about the Twisted-Python mailing list