move getPrivateKey logic into remoteCmdOutput