def _refine_enc(enc):
 rsa = ['r', 'rsa', 'ssh-rsa']
 dss = ['d', 'dsa', 'dss', 'ssh-dss']
 ecdsa = ['e', 'ecdsa', 'ecdsa-sha2-nistp521', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp256']
 ed25519 = ['ed25519', 'ssh-ed25519']
 if (enc in rsa):
  return 'ssh-rsa'
 elif (enc in dss):
  return 'ssh-dss'
 elif (enc in ecdsa):
  if (enc in ['e', 'ecdsa']):
   return 'ecdsa-sha2-nistp256'
  return enc
 elif (enc in ed25519):
  return 'ssh-ed25519'
 else:
  raise CommandExecutionError("Incorrect encryption key type '{0}'.".format(enc))

def _refine_enc ( enc ) : rsa = [ 'r' , 'rsa' , 'ssh-rsa' ] dss = [ 'd' , 'dsa' , 'dss' , 'ssh-dss' ] ecdsa = [ 'e' , 'ecdsa' , 'ecdsa-sha2-nistp521' , 'ecdsa-sha2-nistp384' , 'ecdsa-sha2-nistp256' ] ed25519 = [ 'ed25519' , 'ssh-ed25519' ] if ( enc in rsa ) : return 'ssh-rsa' elif ( enc in dss ) : return 'ssh-dss' elif ( enc in ecdsa ) : if ( enc in [ 'e' , 'ecdsa' ] ) : return 'ecdsa-sha2-nistp256' return enc elif ( enc in ed25519 ) : return 'ssh-ed25519' else : raise CommandExecutionError ( "Incorrect encryption key type '{0}'." . format ( enc ) )
return the properly formatted ssh value for the authorized encryption key type .