<s> from coro . ssh . util import packet <EOL> import dss <EOL> import rsa <EOL> keytypes = { <EOL> '<STR_LIT>' : dss . SSH_DSS , <EOL> '<STR_LIT>' : rsa . SSH_RSA , <EOL> } <EOL> class Unknown_Key_Type ( Exception ) : <EOL> def __init__ ( self , keytype ) : <EOL> self . keytype = keytype <EOL> Exception . __init__ ( self , keytype ) <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' % self . keytype <EOL> def parse_public_key ( public_key ) : <EOL> """<STR_LIT>""" <EOL> data , offset = packet . unpack_payload_get_offset ( ( packet . STRING , ) , public_key ) <EOL> keytype = data [ <NUM_LIT:0> ] <EOL> if keytype not in keytypes : <EOL> raise Unknown_Key_Type ( keytype ) <EOL> key_obj = keytypes [ keytype ] ( ) <EOL> key_obj . set_public_key ( public_key ) <EOL> return key_obj </s>
