Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5889 defect closed fixed (fixed)

ckeygen --showpub fails with a TypeError

Reported by: Lucas Taylor Owned by: therve
Priority: normal Milestone:
Component: conch Keywords: easy
Cc: z3p Branch:
Author:

Description

The command:

ckeygen --showpub --filename=/Users/blah/.ssh/id_rsa

should display the public key, but throws a TypeError

This call in twisted.conch.scripts.ckeygen.displayPublicKey omits the 'type' argument of toString():

print keys.Key(key).public().toString()

Valid types can be one of "OPENSSH", "LSH", "AGENTV3"

twisted.conch.scripts.ckeygen.py should either provide a default format when calling toString() (OPENSSH?), or allow the user to specify the desired output format.

Attachments (3)

5589-ckeygen (1.7 KB) - added by Lucas Taylor 9 years ago.
Patch to provide 'openssh' arg, with test
5889.bugfix (78 bytes) - added by Lucas Taylor 9 years ago.
Added topfile NEWS entry
5889-ckeygen.diff (1.7 KB) - added by Lucas Taylor 9 years ago.
Patch to provide 'openssh' arg, with test (SVN diff...ignore previous attachment)

Download all attachments as: .zip

Change History (8)

comment:1 Changed 9 years ago by DefaultCC Plugin

Cc: z3p added

Changed 9 years ago by Lucas Taylor

Attachment: 5589-ckeygen added

Patch to provide 'openssh' arg, with test

comment:2 Changed 9 years ago by Lucas Taylor

Keywords: review easy added; conch removed

Changed 9 years ago by Lucas Taylor

Attachment: 5889.bugfix added

Added topfile NEWS entry

Changed 9 years ago by Lucas Taylor

Attachment: 5889-ckeygen.diff added

Patch to provide 'openssh' arg, with test (SVN diff...ignore previous attachment)

comment:3 Changed 9 years ago by therve

Keywords: review removed
Owner: set to therve

Looks good! I'm going to merge it along #5890.

comment:4 Changed 9 years ago by therve

Resolution: fixed
Status: newclosed

(In [35420]) Fix ckeygen --showpub behavior, passing a type to display in toString and catching the proper exception for encrypted keys.

Author: ltaylor.volks Reviewer: therve Fixes: #5889, #5890

comment:5 Changed 9 years ago by Jean-Paul Calderone

This patch appears to misuse str.strip. Consider:

>>> 'hello'.strip(' comment')
'hell'
>>> 

I think this new code makes no sense:

    self.assertEqual( 
        self.stdout.getvalue().strip('\n'), 
        publicRSA_openssh.strip(' comment'))

Please file a ticket for correcting this. Thanks!

Note: See TracTickets for help on using tickets.